Răsfoiți Sursa

release rt-thread v4.1.0

jiangjianbo 3 ani în urmă
părinte
comite
27740d4d79
100 a modificat fișierele cu 41482 adăugiri și 200 ștergeri
  1. 0 9
      .gitee/ISSUE_TEMPLATE.zh-TW.md
  2. 1 0
      .gitee/PULL_REQUEST_TEMPLATE.en.md
  3. 1 0
      .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
  4. 0 29
      .gitee/PULL_REQUEST_TEMPLATE.zh-TW.md
  5. 3 0
      .github/ISSUE_TEMPLATE.md
  6. 1 0
      .github/PULL_REQUEST_TEMPLATE.md
  7. 130 61
      .github/workflows/action.yml
  8. 82 0
      .github/workflows/action_tools.yml
  9. 92 0
      .github/workflows/action_utest.yml
  10. 20 0
      .github/workflows/file_check.yml
  11. 2 0
      .gitignore
  12. 473 24
      ChangeLog.md
  13. 0 1
      Jenkinsfile
  14. 45 46
      README.md
  15. 16 30
      README_zh.md
  16. 734 0
      bsp/CME_M7/.config
  17. 78 0
      bsp/CME_M7/CME_M7.ld
  18. 22 0
      bsp/CME_M7/CME_M7.sct
  19. 93 0
      bsp/CME_M7/CMSIS/CME_M7/cmem7_it.c
  20. 401 0
      bsp/CME_M7/CMSIS/CME_M7/cmem7_it.h
  21. 288 0
      bsp/CME_M7/CMSIS/CME_M7/startup/arm/startup_cmem7.s
  22. 226 0
      bsp/CME_M7/CMSIS/CME_M7/startup/gcc/startup_CME_M7.c
  23. 39 0
      bsp/CME_M7/CMSIS/CME_M7/system_cmem7.c
  24. 93 0
      bsp/CME_M7/CMSIS/CMSIS/Include/arm_common_tables.h
  25. 7306 0
      bsp/CME_M7/CMSIS/CMSIS/Include/arm_math.h
  26. 682 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_cm0.h
  27. 793 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_cm0plus.h
  28. 1627 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_cm3.h
  29. 1772 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_cm4.h
  30. 673 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_cm4_simd.h
  31. 636 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_cmFunc.h
  32. 688 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_cmInstr.h
  33. 813 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_sc000.h
  34. 1598 0
      bsp/CME_M7/CMSIS/CMSIS/Include/core_sc300.h
  35. 30 0
      bsp/CME_M7/CMSIS/SConscript
  36. 28 0
      bsp/CME_M7/Kconfig
  37. 12 0
      bsp/CME_M7/SConscript
  38. 31 0
      bsp/CME_M7/SConstruct
  39. 14 0
      bsp/CME_M7/StdPeriph_Driver/SConscript
  40. 8014 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7.h
  41. 269 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_adc.h
  42. 52 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_aes.h
  43. 237 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_can.h
  44. 115 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_conf.h
  45. 185 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_ddr.h
  46. 116 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_dma.h
  47. 114 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_efuse.h
  48. 417 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_eth.h
  49. 218 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_flash.h
  50. 159 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_gpio.h
  51. 247 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_i2c.h
  52. 120 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_includes.h
  53. 276 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_misc.h
  54. 87 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_retarget.h
  55. 89 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_rtc.h
  56. 167 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_spi.h
  57. 101 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_tim.h
  58. 172 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_uart.h
  59. 588 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_usb.h
  60. 110 0
      bsp/CME_M7/StdPeriph_Driver/inc/cmem7_wdg.h
  61. 47 0
      bsp/CME_M7/StdPeriph_Driver/inc/system_cmem7.h
  62. 309 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_adc.c
  63. 53 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_aes.c
  64. 386 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_can.c
  65. 523 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_ddr.c
  66. 262 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_dma.c
  67. 255 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_efuse.c
  68. 692 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_eth.c
  69. 400 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_flash.c
  70. 256 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_gpio.c
  71. 321 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_i2c.c
  72. 183 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_misc.c
  73. 63 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_rtc.c
  74. 145 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_spi.c
  75. 80 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_tim.c
  76. 177 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_uart.c
  77. 842 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_usb.c
  78. 63 0
      bsp/CME_M7/StdPeriph_Driver/src/cmem7_wdg.c
  79. 11 0
      bsp/CME_M7/applications/SConscript
  80. 42 0
      bsp/CME_M7/applications/application.c
  81. 39 0
      bsp/CME_M7/applications/led.c
  82. 85 0
      bsp/CME_M7/applications/startup.c
  83. 20 0
      bsp/CME_M7/drivers/SConscript
  84. 125 0
      bsp/CME_M7/drivers/app_phy.c
  85. 32 0
      bsp/CME_M7/drivers/app_phy.h
  86. 58 0
      bsp/CME_M7/drivers/board.c
  87. 27 0
      bsp/CME_M7/drivers/board.h
  88. 455 0
      bsp/CME_M7/drivers/emac.c
  89. 217 0
      bsp/CME_M7/drivers/uart.c
  90. 170 0
      bsp/CME_M7/project.uvopt
  91. 1177 0
      bsp/CME_M7/project.uvproj
  92. 0 0
      bsp/CME_M7/readme.md
  93. 245 0
      bsp/CME_M7/rtconfig.h
  94. 125 0
      bsp/CME_M7/rtconfig.py
  95. 170 0
      bsp/CME_M7/template.uvopt
  96. 416 0
      bsp/CME_M7/template.uvproj
  97. 833 0
      bsp/Copyright_Notice.md
  98. 666 0
      bsp/Vango/v85xx/.config
  99. 109 0
      bsp/Vango/v85xx/Kconfig
  100. 7 0
      bsp/Vango/v85xx/Libraries/.ignore_format.yml

+ 0 - 9
.gitee/ISSUE_TEMPLATE.zh-TW.md

@@ -1,9 +0,0 @@
-### 該問題是怎麽引起的?
-
-
-
-### 重現步驟
-
-
-
-### 報錯信息

+ 1 - 0
.gitee/PULL_REQUEST_TEMPLATE.en.md

@@ -27,3 +27,4 @@ As part of this pull request, I've considered the following:
 - [ ] All modifications to BSP are justified and do not affect other components or BSPs.
 - [ ] I've commented appropriately where code is tricky.
 - [ ] Code in this PR is of high quality.
+- [ ] This PR complies with [RT-Thread code specification](../documentation/contribution_guide/coding_style_en.txt)

+ 1 - 0
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md

@@ -27,3 +27,4 @@
 - [ ] 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或
 - [ ] 对难懂代码均提供对应的注释
 - [ ] 本拉取/合并请求代码是高质量的
+- [ ] 本拉取/合并符合[RT-Thread代码规范](../documentation/contribution_guide/coding_style_cn.md)

+ 0 - 29
.gitee/PULL_REQUEST_TEMPLATE.zh-TW.md

@@ -1,29 +0,0 @@
-## 拉取/合並請求描述:
-
-[
-這段方括號裏的內容是您**必須填寫並替換掉**的,否則PR不可能被合並。**方括號外面的內容不需要修改,但請仔細閱讀。**
-
-請在這裏填寫您的PR描述,可以包括以下之壹的內容:為什麽提交這份PR;解決的問題是什麽,妳的解決方案是什麽;
-
-並確認並列出已經在什麽情況或板卡上進行了測試。
-]
-
-以下的內容不應該在提交PR時的message修改,修改下述message,PR會被直接關閉。請在提交PR後,瀏覽器查看PR並對以下檢查項逐項check,沒問題後逐條在頁面上打鉤。
-
-### 當前拉取/合並請求的狀態:
-
-必須選擇壹項:
-
-- [ ] 本拉取/合並請求是壹個草稿版本
-- [ ] 本拉取/合並請求是壹個成熟版本
-
-### 代碼質量:
-
-我在這個拉取/合並請求中已經考慮了:
-
-- [ ] 已經仔細查看過代碼改動的對比
-- [ ] 代碼風格正確,包括縮進空格,命名及其他風格
-- [ ] 沒有垃圾代碼,代碼盡量精簡,不包含`#if 0`代碼,不包含已經被註釋了的代碼
-- [ ] 所有變更均有原因及合理的,並且不會影響到其他軟件組件代碼或
-- [ ] 對難懂代碼均提供對應的註釋
-- [ ] 本拉取/合並請求代碼是高質量的

+ 3 - 0
.github/ISSUE_TEMPLATE.md

@@ -0,0 +1,3 @@
+<!--- 请清晰详细地描述你遇到的问题,描述问题时请给出芯片/BSP/工具链,RT-Thread版本,复现步骤及现象或者有条理地描述你的问题。在问题得到解决后,请及时关闭issue。欢迎到论坛提问:https://club.rt-thread.org/ -->
+
+<!--- Please describe your problem clearly and in detail. When describing the problem, please use numbers or bullet points to describe your problem coherently. After the problem is resolved, please close the issue in time. Welcome to the forum to ask questions: https://club.rt-thread.io/ -->

+ 1 - 0
.github/PULL_REQUEST_TEMPLATE.md

@@ -31,3 +31,4 @@ The following content must not be changed in the submitted PR message. Otherwise
 - [ ] 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
 - [ ] 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
 - [ ] 本拉取/合并请求代码是高质量的 Code in this PR is of high quality
+- [ ] 本拉取/合并使用[formatting](https://github.com/mysterywolf/formatting)等源码格式化工具确保格式符合[RT-Thread代码规范](../documentation/contribution_guide/coding_style_cn.md) This PR complies with [RT-Thread code specification](../documentation/contribution_guide/coding_style_en.txt) 

+ 130 - 61
.github/workflows/action.yml

@@ -29,45 +29,64 @@ jobs:
       fail-fast: false
       matrix:
        legs:
+         - {RTT_BSP: "acm32/acm32f0x0-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "CME_M7", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "apm32/apm32f103xe-minibroard", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "apollo2", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "asm9260t", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "at91sam9260", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "allwinner_tina", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "efm32", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "gd32e230k-start", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "gd32303e-eval", RTT_TOOL_CHAIN: "sourcery-arm"}         
+         - {RTT_BSP: "at91/at91sam9g45", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "at91/at91sam9260", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "allwinner_tina", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "ft32/ft32f072xb-starter", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32103c-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32105c-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32105r-start", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32107c-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32205r-start", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32303e-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32305r-start", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32407v-start", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32/gd32450z-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32e230k-start", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "gd32vf103v-eval", RTT_TOOL_CHAIN: "sourcery-riscv-none-embed"}
+         - {RTT_BSP: "gd32303e-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "gd32450z-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "gkipc", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "imx6sx/cortex-a9", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "imxrt/imxrt1052-atk-commander", RTT_TOOL_CHAIN: "sourcery-arm"}  
+         - {RTT_BSP: "imx6sx/cortex-a9", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "imxrt/imxrt1052-atk-commander", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "imxrt/imxrt1052-fire-pro", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "imxrt/imxrt1052-nxp-evk", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lm3s8962", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lm3s9b9x", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lm4f232", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "tm4c123bsp", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "tkm32F499", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "tm4c129x", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc43xx/M4", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc176x", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "lpc55sxx/lpc55s69_nxp_evk", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc178x", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc408x", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc1114", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc2148", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc2478", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "lpc5410x", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "lpc54114-lite", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "ls1bdev", RTT_TOOL_CHAIN: "sourcery-mips"}
-         - {RTT_BSP: "ls1cdev", RTT_TOOL_CHAIN: "sourcery-mips"}
-         - {RTT_BSP: "mb9bf500r", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "mb9bf506r", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "mb9bf618s", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "mb9bf568r", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "lpc54114-lite", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "loongson/ls1bdev", RTT_TOOL_CHAIN: "sourcery-mips"}
+         - {RTT_BSP: "loongson/ls1cdev", RTT_TOOL_CHAIN: "sourcery-mips"}
+         - {RTT_BSP: "loongson/ls2kdev", RTT_TOOL_CHAIN: "sourcery-mips"}
+         - {RTT_BSP: "fujitsu/mb9x/mb9bf500r", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "fujitsu/mb9x/mb9bf506r", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "fujitsu/mb9x/mb9bf618s", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "fujitsu/mb9x/mb9bf568r", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "mini2440", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "qemu-vexpress-a9", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "qemu-vexpress-gemini", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "sam7x", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32f072-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
+         - {RTT_BSP: "nrf5x/nrf51822", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "nrf5x/nrf52832", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "nrf5x/nrf52833", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "nrf5x/nrf52840", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "qemu-vexpress-a9", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "qemu-vexpress-gemini", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "sam7x", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f072-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f091-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f103-atk-nano", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f103-atk-warshipv3", RTT_TOOL_CHAIN: "sourcery-arm"}
@@ -75,14 +94,17 @@ jobs:
          - {RTT_BSP: "stm32/stm32f103-dofly-M3S", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f103-fire-arbitrary", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f103-hw100k-ibox", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "stm32/stm32f103-mini-system", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f103-blue-pill", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f103-onenet-nbiot", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f103-yf-ufun", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f107-uc-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f207-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f302-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f401-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f405-smdz-breadfruit", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f407-atk-explorer", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "stm32/stm32f407-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"} 
+         - {RTT_BSP: "stm32/stm32f407-robomaster-c", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f407-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f410-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f411-atk-nano", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f411-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
@@ -92,44 +114,60 @@ jobs:
          - {RTT_BSP: "stm32/stm32f429-armfly-v6", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f429-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32f429-fire-challenger", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "stm32/stm32f429-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32f446-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32f469-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"}  
-         - {RTT_BSP: "stm32/stm32f746-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"}  
-         - {RTT_BSP: "stm32/stm32f767-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32f767-fire-challenger", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32f767-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32g070-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32g071-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32g431-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}  
+         - {RTT_BSP: "stm32/stm32f429-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f446-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f469-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f746-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f767-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f767-fire-challenger-v1", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32f767-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32g070-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32g071-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32g431-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32h743-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32h743-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32h743-openmv-h7plus", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32h747-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32h750-artpi-h750", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32l4r9-st-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l4r9-st-sensortile-box", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32l010-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
          - {RTT_BSP: "stm32/stm32l053-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
-         - {RTT_BSP: "stm32/stm32l412-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32l432-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32l433-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32l475-atk-pandora", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32l475-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32l476-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32l496-ali-developer", RTT_TOOL_CHAIN: "sourcery-arm"}  
-         - {RTT_BSP: "stm32/stm32l496-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32mp157a-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32mp157a-st-ev1", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32/stm32wb55-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "stm32f20x", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "swm320-lq100", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "beaglebone", RTT_TOOL_CHAIN: "sourcery-arm"}  
-         - {RTT_BSP: "zynq7000", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "zynqmp-r5-axu4ev", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "frdm-k64f", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "fh8620", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "xplorer4330/M4", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "at32/at32f403a-start", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "at32/at32f407-start", RTT_TOOL_CHAIN: "sourcery-arm"} 
-         - {RTT_BSP: "smartfusion2", RTT_TOOL_CHAIN: "sourcery-arm"} 
+         - {RTT_BSP: "stm32/stm32l412-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l432-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l433-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l475-atk-pandora", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l475-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l476-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l433-ali-startkit", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l496-ali-developer", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l496-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32l552-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32mp157a-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32mp157a-st-ev1", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32u575-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "stm32/stm32wb55-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "wch/arm/ch32f103c8-core", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "wch/arm/ch32f203r-evt", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "swm320", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "beaglebone", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "zynqmp-r5-axu4ev", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "frdm-k64f", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "xplorer4330/M4", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "at32/at32f403a-start", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "at32/at32f407-start", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "smartfusion2", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "raspberry-pico", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "raspberry-pi/raspi3-32", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "raspberry-pi/raspi4-32", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "hc32l196", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "tae32f5300", RTT_TOOL_CHAIN: "sourcery-arm"}
+         - {RTT_BSP: "bluetrum/ab32vg1-ab-prougen", RTT_TOOL_CHAIN: "sourcery-riscv64-unknown-elf"}
+         - {RTT_BSP: "k210", RTT_TOOL_CHAIN: "sourcery-riscv-none-embed"}
+         - {RTT_BSP: "qemu-virt64-aarch64", RTT_TOOL_CHAIN: "sourcery-aarch64"}
+         - {RTT_BSP: "raspberry-pi/raspi3-64", RTT_TOOL_CHAIN: "sourcery-aarch64"}
+         - {RTT_BSP: "raspberry-pi/raspi4-64", RTT_TOOL_CHAIN: "sourcery-aarch64"}
+         - {RTT_BSP: "rockchip/rk3568", RTT_TOOL_CHAIN: "sourcery-aarch64"}
     steps:
       - uses: actions/checkout@v2
       - name: Set up Python
@@ -141,28 +179,57 @@ jobs:
         shell: bash
         run: |
           sudo apt-get update
-          sudo apt-get -qq install gcc-multilib libsdl-dev scons
+          sudo apt-get -qq install gcc-multilib libsdl-dev libncurses5-dev scons
+          sudo python -m pip install --upgrade pip -qq
+          pip install requests -qq
+          git config --global http.postBuffer 524288000
+          python -c "import tools.menuconfig; tools.menuconfig.touch_env()"
           echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
           echo "RTT_CC=gcc" >> $GITHUB_ENV
-    
+
       - name: Install Arm ToolChains
         if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && success() }}
         shell: bash
         run: |
-          wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/arm-2017q2-v6/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 
-          sudo tar xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -C /opt  
-          /opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc --version
-          echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin" >> $GITHUB_ENV
+          wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
+          sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
+          /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
+          echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
+
+      - name: Install AArch64 ToolChains
+        if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-aarch64' && success() }}
+        shell: bash
+        run: |
+          wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.6/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz
+          sudo tar -xf gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz -C /opt
+          /opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc --version
+          echo "RTT_EXEC_PATH=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin" >> $GITHUB_ENV
 
       - name: Install Mips ToolChains
         if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-mips' && success() }}
         shell: bash
         run: |
-          wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.1/mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 
-          sudo tar xjf mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 -C /opt  
+          wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.1/mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2
+          sudo tar xjf mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
           /opt/mips-2016.05/bin/mips-sde-elf-gcc --version
           echo "RTT_EXEC_PATH=/opt/mips-2016.05/bin" >> $GITHUB_ENV
 
+      - name: Install Riscv64-unknown-elf ToolChains
+        if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-riscv64-unknown-elf' && success() }}
+        run: |
+          wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
+          sudo tar zxvf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt
+          /opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
+          echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
+
+      - name: Install Riscv-none-embed ToolChains
+        if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-riscv-none-embed' && success() }}
+        run: |
+          wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.5/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz
+          sudo tar zxvf xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -C /opt
+          /opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin/riscv-none-embed-gcc --version
+          echo "RTT_EXEC_PATH=/opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin" >> $GITHUB_ENV
+
       - name: Bsp Scons Compile
         if: ${{ success() }}
         shell: bash
@@ -170,4 +237,6 @@ jobs:
           RTT_BSP: ${{ matrix.legs.RTT_BSP }}
           RTT_TOOL_CHAIN: ${{ matrix.legs.RTT_TOOL_CHAIN }}
         run: |
+          source ~/.env/env.sh
+          pushd bsp/$RTT_BSP && pkgs --update && popd
           scons -C bsp/$RTT_BSP

+ 82 - 0
.github/workflows/action_tools.yml

@@ -0,0 +1,82 @@
+name: ToolsCI
+
+# Controls when the action will run. Triggers the workflow on push or pull request
+# events but only for the master branch
+on:
+  # Runs at 16:00 UTC (BeiJing 00:00) on the 1st of every month
+  schedule:
+    - cron:  '0 16 1 * *'
+  push:
+    branches:
+      - master
+    paths-ignore:
+      - documentation/**
+      - '**/README.md'
+      - '**/README_zh.md'
+      - '**/*.c'
+      - '**/*.h'
+      - '**/*.cpp'
+  pull_request:
+    branches:
+      - master
+    paths-ignore:
+      - documentation/**
+      - '**/README.md'
+      - '**/README_zh.md'
+      - '**/*.c'
+      - '**/*.h'
+      - '**/*.cpp'
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    name: Tools
+    strategy:
+      fail-fast: false
+    env:
+      TEST_BSP_ROOT: bsp/stm32/stm32f407-atk-explorer
+    steps:
+    - uses: actions/checkout@v1
+
+    - name: Install Tools
+      shell: bash
+      run: |
+        sudo apt-get update
+        sudo apt-get -yqq install scons
+
+    - name: Install Arm ToolChains
+      if: ${{ success() }}
+      shell: bash
+      run: |
+        wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
+        sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
+        /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
+        echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
+
+    - name: Build Tools
+      run: |
+        scons --pyconfig-silent -C $TEST_BSP_ROOT
+        scons -j$(nproc) -C $TEST_BSP_ROOT
+
+    - name: Project generate Tools
+      if: ${{ success() }}
+      run: |
+        echo "Test to generate mdk project"
+        scons --target=mdk -s -C $TEST_BSP_ROOT
+        scons --target=mdk4 -s -C $TEST_BSP_ROOT
+        scons --target=mdk5 -s -C $TEST_BSP_ROOT
+        echo "Test to generate iar project"
+        scons --target=iar -s -C $TEST_BSP_ROOT
+        echo "Test to generate eclipse project"
+        scons --target=eclipse -s -C $TEST_BSP_ROOT
+        echo "Test to generate cmake project"
+        scons --target=cmake -s -C $TEST_BSP_ROOT
+        echo "Test to generate makefile project"
+        scons --target=makefile -s -C $TEST_BSP_ROOT
+
+    - name: Project dist Tools
+      if: ${{ success() }}
+      run: |
+        echo "Test to dist project"
+        scons --dist -C $TEST_BSP_ROOT
+        scons --dist-ide -C $TEST_BSP_ROOT

+ 92 - 0
.github/workflows/action_utest.yml

@@ -0,0 +1,92 @@
+name: AutoTestCI
+
+# Controls when the action will run. Triggers the workflow on push or pull request
+# events but only for the master branch
+on:
+  # Runs at 16:00 UTC (BeiJing 00:00) on the 1st of every month
+  schedule:
+    - cron:  '0 16 1 * *'
+  push:
+    branches:
+      - master
+    paths-ignore:
+      - documentation/**
+      - '**/README.md'
+      - '**/README_zh.md'
+  pull_request:
+    branches:
+      - master
+    paths-ignore:
+      - documentation/**
+      - '**/README.md'
+      - '**/README_zh.md'
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    name: ${{ matrix.legs.UTEST }}
+    strategy:
+      fail-fast: false
+      matrix:
+       legs:
+         - {UTEST: "kernel/mem",       RTT_BSP: "bsp/qemu-vexpress-a9",    QEMU_ARCH: "arm",      QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/mem.conf",     SD_FILE: "sd.bin"}
+         - {UTEST: "kernel/ipc",       RTT_BSP: "bsp/qemu-vexpress-a9",    QEMU_ARCH: "arm",      QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/ipc.conf",     SD_FILE: "sd.bin"}
+         - {UTEST: "kernel/irq",       RTT_BSP: "bsp/qemu-vexpress-a9",    QEMU_ARCH: "arm",      QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/irq.conf",     SD_FILE: "sd.bin"}
+         - {UTEST: "kernel/timer",     RTT_BSP: "bsp/qemu-vexpress-a9",    QEMU_ARCH: "arm",      QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/timer.conf",   SD_FILE: "sd.bin"}
+         - {UTEST: "kernel/thread",    RTT_BSP: "bsp/qemu-vexpress-a9",    QEMU_ARCH: "arm",      QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/thread.conf",  SD_FILE: "sd.bin"}
+         - {UTEST: "components/utest", RTT_BSP: "bsp/qemu-vexpress-a9",    QEMU_ARCH: "arm",      QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "utest_self/self.conf", SD_FILE: "sd.bin"}
+         - {UTEST: "kernel/mem/riscv64", RTT_BSP: "bsp/qemu-riscv-virt64", QEMU_ARCH: "riscv64",  QEMU_MACHINE: "virt",  CONFIG_FILE: "kernel/mem.conf",   SD_FILE: "None"}
+    env:
+      TEST_QEMU_ARCH: ${{ matrix.legs.QEMU_ARCH }}
+      TEST_QEMU_MACHINE: ${{ matrix.legs.QEMU_MACHINE }}
+      TEST_BSP_ROOT: ${{ matrix.legs.RTT_BSP }}
+      TEST_CONFIG_FILE: ${{ matrix.legs.CONFIG_FILE }}
+      TEST_SD_FILE: ${{ matrix.legs.SD_FILE }}
+    steps:
+    - uses: actions/checkout@v1
+
+    - name: Install Tools
+      shell: bash
+      run: |
+        sudo apt-get update
+        sudo apt-get -yqq install scons qemu-system git
+
+    - name: Install Arm ToolChains
+      if: ${{ matrix.legs.QEMU_ARCH == 'arm' && success() }}
+      shell: bash
+      run: |
+        wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
+        sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
+        /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
+        echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
+
+    - name: Install RISC-V ToolChains
+      if: ${{ matrix.legs.QEMU_ARCH == 'riscv64' && success() }}
+      run: |
+        wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
+        sudo tar zxvf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt
+        /opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
+        echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
+
+    - name: Build BSP
+      run: |
+        echo CONFIG_RT_USING_UTESTCASES=y >> $TEST_BSP_ROOT/.config
+        cat examples/utest/configs/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
+        scons --pyconfig-silent -C $TEST_BSP_ROOT
+        scons -j$(nproc) -C $TEST_BSP_ROOT
+
+    - name: Start Test
+      if: ${{ success() }}
+      run: |
+        git clone https://github.com/armink/UtestRunner.git
+        pushd $TEST_BSP_ROOT
+        dd if=/dev/zero of=sd.bin bs=1024 count=65536
+        popd
+        pushd UtestRunner
+        if [ $TEST_SD_FILE != "None" ]; then
+          python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.elf --sd ../$TEST_BSP_ROOT/$TEST_SD_FILE
+        else
+          python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.elf
+        fi
+        cat rtt_console.log
+        popd

+ 20 - 0
.github/workflows/file_check.yml

@@ -0,0 +1,20 @@
+name: Check File Format and License
+
+on: [pull_request]
+
+jobs:
+  scancode_job:
+    runs-on: ubuntu-latest
+    name: Scan code format and license
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up Python
+        uses: actions/setup-python@master
+        with:
+          python-version: 3.8
+      
+      - name: Check Format and License
+        shell: bash
+        run: |
+          pip install click chardet PyYaml
+          python tools/file_check.py check 'https://github.com/RT-Thread/rt-thread' 'master'

+ 2 - 0
.gitignore

@@ -38,5 +38,7 @@ ncscope.*
 tags
 
 .idea
+.vscode
+.history
 CMakeLists.txt
 cmake-build-debug

+ 473 - 24
ChangeLog.md

@@ -1,28 +1,477 @@
-# RT-Thread v4.0.5 released
+# RT-Thread v4.1.0 released
+
+Change log since v4.1.0 Beta released
+
+## Kernel
+
+- src/clock.c add hook for rt_tick_increase
+- fix thread init bug if you open RT_USING_MODULE
+- Fixed issue that could all timers stop
+- remove duplicated clear to 0 in the "thread.c"
+- Revert modifications to the semaphore
+- Fix 64 bit compilation warning
+- src/device.c add RT_DEBUG_LOG
+
+## Components
+
+- ulog
+  - Optimize code to improve readability
+  - remove the useless function declaration about "localtime_r"
+  - Optimize "ULOG_OUTPUT_FLOAT" to avoid use "vsnprintf" that provided by complier tools chain
+  - solve the interference when enable the ulog timestamp
+  - Fixed the issue LOG_HEX no output at asyn mode
+- drivers
+  - misc
+    - modify the error name in the "dac.c"
+  - remove useless head file to avoid problem about recursion
+  - add the header file to avoid compiler error
+  - Open RT_USING_POSIX_STDIO caused serial_v2 to compile failed
+  - add the simulative spi bus drivers  that based on spi bus drivers
+  - remove the complier warning in C99 about "ipc/ringbuffer.c"
+  - improve serial_v2 structure
+- dfs
+  - offer complete path when use command "list_fd"
+- libc
+  - posix
+    - add the included head file
+    - add the header file to avoid compiler error
+    - add RT_USING_POSIX_SOCKET
+  - fix a typo
+- net
+  - adjust folder structure
+  - lwip
+    - integrate lwip porting layer
+    - integrate and improve lwipopts.h
+    - add lwip latest version
+- utest
+  - add dependence RT_USING_UTESTCASES
+- finsh
+  - remove extra code
+  - fix finsh bug
+- fal
+  - add fal component
+- utilities
+  - adjust the order of compiler macros
+  - var_export
+    - replace the search algorithm and fix some problems
+- tidy the folder name and structure about Kconfig
+
+## BSP and CPU porting
+
+- libcpu
+  - aarch64
+    - rt_hw_trap_irq get irq instead of iar when using gicv2
+    - disable irq/fiq when switch thread
+    - add gtimer frq set and stack align
+    - add gicv3 support
+  - mips
+    - correct the watch dog register address about "gs232.h"
+    - modify the problem that can't feed hardware watch dog
+  - arm
+    - fix syscall_iar.S compiler error based on cortex-m33
+- essemi
+  - fix bugs
+- nuvoton
+  - Update configuration files and fix issue
+  - Nuvoton drivers updating and more LVGL supporting
+  - Update drivers and project setting
+  - format code
+- raspberry-pico
+  - add Raspberry-Pico-LVGL README.md
+- simulator
+  - Optimize the auto initization
+- qemu
+  - vexpress-a9
+    - Fix a typo in qemu.sh
+- n32g452xx
+  - add drv_spi.c
+- at91sam9260
+  - add mtdnand driver to support "uffs" file system
+- at32
+  - upload bsp package based firmware library v2.0
+  - add ingore_format.yml
+- gd32
+  - Optimize UART
+- add Soft spi for gd32303e-eval
+- ft32
+  - modify the name that head files are included
+- apm32
+  - apm32f103xe-minibroard
+    - add project and device drivers
+    - update readme picture name
+  - fix the startup files of apm32f1
+- stm32
+  - Add support with pwm6 to pwm13
+  - add qspi flash and sdio for openmv h7plus
+  - modify the bug that the CRC custom configuration can't work
+  - stm32f469-st-disco
+    - add readme in english
+  - stm32f072-st-nucleo
+    - add arduino support
+    - support pwm for arduino
+  - stm32f407-atk-explorer
+    - add board identification word
+  - stm32l475-atk-pandora
+    - update application/arduino folder
+    - enable i2c4 bus
+    - fix the bug when using LCD demo
+    - fullly  support analog output(PWM) and analog input(ADC)
+    - support backlight with brightness adjustable
+    - Adding dependencies
+  - stm32h750-art-pi
+    - porting LVGL to ART-Pi with Media-IO
+  - stm32f769-st-disco
+    - fix wrong CPPDEFINES and close lwip
+    - add stm32f7xx_hal_dsi.c when using LTDC/MIPI-DSI
+  - stm32h743-openmv-h7plus
+    - add usbcdc for openmv
+- imxrt
+  - imxrt1060-nxp-evk
+    - add imxrt1060-evk BSP
+    - README_zh.md, led blink
+    - fix gcc can't runing issue
+- vango
+  - add v85xxp bsp
+  - migrate v85xx and v85xxp into the subcatalog of vango
+  - remove duplicated files
+- acm32f0x0-nucleo
+  - Add some drivers
+- delete swm320-lq100 bsp
+- add ch579m bsp
+- add air105 bsp
+- add RA series bsp
+- add bsp-ft32
+- migrate acm32f0x0-nucleo and acm32f4xx-nucleo into the subcatalog of acm32
+- migrate at91sam9260 and at91sam9g45 into the subcatalog of at91
+- migrate mb9xxx series into the subcatalog of fujitsu
+- migrate lsxx series into the subcatalog of loongson
+- add rockchip/rk3568 bsp
+
+## Documentation
+
+- move documentation repo to rt-thread repo
+- update documentation
+- Fixed Program Memory Distribution - Basic.md
+
+## Tools
+
+- fix the problem that print 'b' when complier code that after RT-Threadv4.0.3
+- use the relative path to create "CMakefile.txt" when use "scons" command
+- allow users to set specific link scripts
+- update the template for projcfg.ini in rt-studio
+- keil.py Distinguish LOCAL_CFLAGS/LOCAL_CXXFLAGS, refine file control
+
+# RT-Thread v4.1.0 Beta released
 
 Change log since v4.0.4
 
 ## Kernel
 
-- Remove weak symbol from `rt_memset` , `rt_memcmp`, and add it for `rt_vsnprintf`
+- rt_show_version update the year
+- Improve comments and parameter checking
+- [pm] beautify code
+- remove RT_THREAD_BLOCK
+- remove .init_priority
+- update notes
+- Delete an extra semicolon
+- change all double-empty-lines to single-empty-lines
+- move some __on_rt_xxxxx_hook from rtdef.h to dedicated c soure files
+- [kservice] add RT_KSERVICE_USING_STDLIB_MEMSET、 RT_KSERVICE_USING_STDLIB_MEMCPY
+- [memheap] Fix 64 bit potential risk
+- update Kconfig, add RT_HOOK_USING_FUNC_PTR
+- Improving hooking methods
+- Backward compatible with existing function-pointer based hooking method
+- Using RT_USING_HOOK as an on/off switch
+- Introducing a new low-overhead macro-based hooking method
+- [include/rtthread.h] Add function declarations to avoid compilation warnings
+- ipc init/create add flag judgement
+- Adjust RT_ASSERT and RT_DEBUG_NOT_IN_INTERRUPT to maintain code style
+- Add a new algorithm to find the lowest non-zero bit of a byte
+- Add weak RT_KSERVICE_USING_TINY_FFS definition
+- A simplified version of rt_ffs function
+- Add RT_WEAK for rt_vsnprintf
+- Change the return value type from signed int to int, in accordance with ISO C standards, to prevent compiler errors
+- Fix rt_size_t as rt_uint32_t
+- Cfg cancels rt_kprintf declaration
+- [kservice] add return value's comment
+- Modify rt_size_t's type
+- [timer] Update the RT_TIMER_CTRL_GET_STATE code in rt_timer_control
+- Fix up .bss size define in link.lds and set spsel=1 in aarch64
+- remove duplicate work between idle and thread_exit
+- When memheap memory management is used, rT_malloc 0 returns RT_NULL, consistent with slab and small memory management algorithms.
+- Aligns the address passed in by rt_system_heap_init when using the memheap memory management algorithm
+- Set rt_thread_timeout to a private function
+- Add __attribute__(...) for rt_kprintf() to let the compiler check the format string parameters
+- Return thread error when resumed by signal
 
 ## Components
 
-- Update Libc
-  - Fix the error when invoking `fopen` with mode "b"
-- [AT] Fix the overflow problem of input array
-- lwIP
-  - Fix the problem of implicit declaration of "lwip_ip4_route_src"
-  - Solve the conflict between multi BYTE_ORDERs
+- libc
+  - Clear the POSIX/IO folder
+  - Move libdl to posix folder
+  - Add the support for PSE51
+  - Optimize the nanosleep function
+  - Add RT_USING_POSIX_STDIO
+  - To deal with compilation problems under win32 platform
+  - Remove getline
+  - Create 'posix' folder and move related files into it
+  - Put getline into posix folder
+  - Optimize posix structure in libc
+  - Eliminate judgments in code that rely on RT_LIBC_USING_FILEIO
+  - Move libc.c/.h to posix folder
+  - Remove gettid and other functions that do not comply with PSE51
+  - Add RT_USING_POSIX_SELECT RT_USING_POSIX_POLL
+  - Add RT_USING_POSIX_DELAY
+  - Add RT_USING_POSIX_STDIO
+  - Add delay.c as default
+  - Select RT_USING_POSIX_STDIO for RT_LIBC_USING_FILEIO
+  - Add readme
+  - Revert kconfig of pthread
+  - Move mmap to src folder
+  - Implement delay functions as RT_USING_POSIX_DELAY
+  - Fix a bug caused by two different macro encoding methods in fcntl.h
+  - Improve IAR and KEIL's read write pile function
+  - Memory functions add error warnings when HEAP is not enabled
+  - Revise some RT_USING_POSIX to RT_USING_POSIX_DEVIO
+  - Add RT_USING_POSIX_FS
+  - Separate posix into a Kconfig directory
+  - Fix the bug of _sys_read and _sys_write
+  - Modify time.h to sys/time.h
+  - Add dataqueue.c function annotation
+  - Fix armclang Cpp11 memory leak and compilation warning issues
+  - Add ipc header files
+  - Create the mman folder
+
+- drivers
+  - Rename src folder as ipc
+  - Optimize scripts for compiler judgment
+  - Add rt_work_urgent
+  - Change the time parameter to ticks to prevent misinterpretation of the unit as ms
+  - Improve comment
+  - [sdio] Fix compile warning and optimized code.
+  - Rename rt_workqueue_critical_work as rt_workqueue_urgent_work
+  - Fix sensor_cmd.c build error.
+  - Cputime support 64bit.
+  - Update cputime_cortexm.c support 64bit.
+  - Add IPC for POSIX and add pipe for it
+  - [components] framework update
+  - Add waitqueue.c function annotation
+  - Fix compile warning in cdc_vcom.c
+
+- lwip
+  - Improve lwip support for 64-bit architecture
+  - Remove lwip 2.0.2
+  - Fix ioctl and lwip socket definitions
+  - modify annotation for sys_arch_mbox_tryfetch
+  - Fix the return value for sys_arch_mbox_fetch in lwip stack
+  - Fix dhcpd not including version 2.0.3
+  - Define RT_USING_BIG_ENDIAN for the long-term version
+  - ping cmd with specified netif in lwip-2.1.2
+  - Fix sys_arch.c
+  - Solve the conflict between multi BYTE_ORDER(s)
+  - Fix the problem of implicit declaration for "lwip_ip4_route_src".
+
+- dfs
+  - Move dfs_posix.h to legacy/dfs/dfs_posix.h
+  - Move dfs_posix dfs_poll dfs_select.c to posix folder
+  - Remove dfs_select.h and dfs_poll.h
+  - Update fatfs to the latest version
+  - Saved dfs_poll.h dfs_select.h,add warning log
+  - Remove RT_USING_LIBC from dfs_fs.h
+  - Move dfs back
+
+- Shrink pThread to POSIX. Change DFS from POSIX to POSIX from DFS
+- Adjust the SAL dependency
+- Implement legacy support
+- Revise RT_USING_POSIX_STDIO to RT_USING_POSIX_DEVIO
+- Add macro definition restrictions to finsh set Device calls
+
+- shell
+  - Update the list_timer cmd.
+  - Update the code format
+
+- kservice
+  - Optimize RT_PRINTF_LONGLONG,reduce duplicate code
+  - Simplification RT_PRINTF_PRECISION
+  - Fix the problem of rt_strlen crashed in win32
+
+- [kernel] Collating of Kconfig
+- [ulog] Add ulog backend filter.
+- [posix] Organize IO categories according to advanced Unix environment programming
+- Add creat() function
+- [Ymodem]  silent warnings
+- Use rt_memcpy rt_memset instead of  memcpy memset
+- Fixed AT component in CLI mode, the command input is too long, resulting in the array out of bounds
+- [example] Remove RT_USING_TC
+- Fix armclang Cpp11 memory leak and compilation warning issues
+- Improve and add comments in examples/network/ including tcpserver.c
 
-## BSP
+## BSP and CPU porting
+
+- [at91sam9260] Fix "rt_interrupt_dispatch" Undefined error
+- Add pulse encoder porting to imxrt1052
+- libcpu
+  - Solve the problem of mixing tab and space
+  - [arm] Fix thumb instruction set assembly syntax error
+  - [aarch64] Add smp support
+  - [nuclei] Fix context switch  in nuclei
+  - Fix s-mode issue
+  - [t-head] Fix rt_hw_interrupt_disable/rt_hw_interrupt_enable bug
+  - [libcpu] Add ARCH_CPU_BIG_ENDIAN
+
+- Add and update gd32 bsp
+  - gd32103c-eval
+  - gd32105c-eval
+  - gd32107c-eval
+  - gd32303e-eval
+  - gd32450z-eval
+  - gd32105r-start
+  - gd32205r-start
+  - gd32305r-start
+
+- Update n32g452xx
+  - Reinit .config based on default setting
+  - Regenerate rtconfig.h based on default configuration
+  - Reformat code
+  - Init update
+  - Add rt_pin_get support
+  - Add n32g45x can driver
+  - Unified header file definition. "GPIO_H__" to "DRV_GPIO_H". "USART_H" to "DRV_USART_H"
+  - In drv_pwm.c, variable meaning is different with RT-Thread interface definition. Fixed and tested.
+  - Add support for UART4/UART5.
+  - In drv_gpio.c Modify "N32F10X_PIN_NUMBERS" to "N32G45X_PIN_NUMBERS"
+  - Perfect ADC driver and format code
+  - Add ble support
+  - Fix formatting issues
+  - Remove unnecessary comments
+  - Add gpio input nopull
+  - rtc add version check
+  - n32g452xx direct structure base at32
+
+- Nuvoton
+  - Support LVGLv81 RTT music demo for N9H30 and NUC980.
+  - Update drivers
+  - [N9H30/NUC980] Update SDH driver
+  - Fix SDH_Set_clock function.
+  - Correct EMMC, SDH0 and SDH1 options for N9H30.
+  - Fix IRQ trap issues.
+  - Update porting drivers and configurations.
+
+- [raspberry-pico] Add lvgl_8.1.0 support
+- simulator
+  - Resolves the warning that the "Gm" option was rejected and will be removed in a future release
+  - Clear the warning under vs
+  - update project
+
+- [gd32] Repair startup_gd32f30x_cl.s
+- Remove the problematic rtconfig.h
+- [console] Fixed an error when using device without defining RT_USING_DEVICE
+- Use __clang__ instead of __CLANG_ARM
+
+- Update essemi bsp
+  - es32f0654
+  - es32f369x
+  - es32f365x
+
+- [nuclei] change hbird_eval bsp to nuclei_fpga_eval
+- The sconscript script in the application folder increases the recursion searching capability
+- [Vango V85xx] modify NULL to RT_NULL
+- fix the compiling issue for qemu-riscv64
+- update K210 bsp and base on https://github.com/kendryte/K210-Micropython-OpenMV
+
+- [lpc55s69_nxp_evk]
+  - Fix the scons --dist
+  - Add the fixed gcc version
+  - Add the ci machine
+
+- Correction of 'BSP /Copyright notice.md' errors
+
+- nrf5x
+  - Add the fixed lds
+  - Add hwtimer driver
+  - Add hwtimer config & tinyusb config
+  - Fix i2c driver bug
+
+- Remove the bsp of nrf51822
+- Add tkm32f499 bsp and  flash_download app
+- Remove empty rt_hw_us_delay
+- [at32] Optimized the pin-index algorithm
+
+- ra6m4
+  - Organize the project configuration
+  - Add DAC, ADC and SPI drivers
+  - Formatting code Style
+  - Add Flash Driver
+  - Add SPI, Flash, ADC, DAC documentation
+  - Add PWM driver
+  - Fix incorrect dependency macros in scons scripts
+  - Fix bugs in the code
+  - Update the error description in the documentation
+
+- MAX32660-EVK
+  - Update pin map instruction
+  - Add MAX32660-EVK pin map
+  - drv_soft_i2c.c was not in libraries
+  - delete drv_soft_i2c.c for it was not be used
+
+- [bluetrum] add flash support
+- [ra6m4-cpk] add gcc build support.
+
+- stm32
+  - Fix STM32 USB driver matching hal library version
+  - stm32h743-openmv-h7plus bsp add sdram for openmv
+  - Add tinyusb for stm32 driver
+  - Add stm32g474-st-nucleo bsp
+  - Add stm32u575-st-nucleo bsp
+  - Add stm32l552ze-nucleo bsp
+  - [gcc] Fix stack 0 bug, expand stack to 0x400 (same as Keil IAR)
+  - Modify variable name p_tm to tm
+  - drv_common.c add LOW_E for Error_Handler
+  - Add i2c config for stm32l496-st-nucleo bsp
+  - For STM32F4 series, CAN is configured according to different ABP1 bus frequencies
+  - Improved STM32H7 series SPI driver using DMA
+  - Add BSP ART-PI download algorithm
+  - Add lvgl music demo for stm32f469-st-disco bsp.
+  - Refresh using dma2d,screen refresh average 25fps for stm32f469-st-disco bsp
+  - Add esp8266 configuration option takeover
+  - add SOC_SERIES_STM32G0 to use "stm32_wdt.hiwdg.Init.Window = 0x00000FFF", otherwise the watchdog always reset.
+  - Fix STM32L4 series flash will fail to erase the first time after downloading the program
+
+  - stm32l475-atk-pandora
+    - Add ADC PWM pin definition
+    - Preliminary realization of Arduino ecological compatibility
+    - Add lcd_fill_array()
+    - Add lvgl demo
+    - Add BSP_USING_LCD_SAMPLE in rttlogo.h
+    - Enable SPI3-DMA2 for LCD
+    - Beautify kconfig of board
+    - Fix issue where board folder sconscript script did not continue scanning subfolders
+    - Improve the structrue of sconscript
+    - Add ESP8266 quick build option, serial port driver is changed from V2 to V1
+
+- Fix compile warnings on qemu-vexpress-a9 platform (-Wimplicit-function-declaration)
+- [qemu-a9] add lvgl support.
+- [fix] The baud rate is configured according to the different APB1 frequencies. f4-series only.
+- [qemu] update Kconfig
+- Fix Raspi3 GPIO driver write bug
+- [ls1cdev] add stack size to avoid stack overflow when boot
+- [rp6m4-cpk] Add new drivers and improve BSP
+
+## Tools
+
+- CI
+  - Optimize AutoTestCI trigger timing
+  - Add scons tools test
+  - Add the ci of nrf5x
+  - Ci toolchain download using github link.
 
-- [qemu-vexpress-gemini] fix build errors
-- STM32
-  - Add SOC_SERIES_STM32G0 to use "stm32_wdt.hiwdg.Init.Window = 0x00000FFF"; otherwise, the watchdog will always reset.
-  - [STM32L4] Fix the failure of the first erase after programming
-- [GD32F4xx] Fix the problem of startup file
-- Revert STM32 stack size to 0x400, which is set by mistake in [#5129](https://github.com/RT-Thread/rt-thread/pull/5129)
+- Fix bug with missing brackets in eclipse.py
+- Change ccflags to cflags,add LOCAL_CCFLAGS、LOCAL_CLFAGS、LOCAL_CXXFLAGS
+- Fix generate .project file error
+- Remove unused file 1.txt
+- Update buildbot.py
+- Fix adding empty lists and empty strings
+- Add function of auto-update rtconfig.h
 
 # RT-Thread v4.0.4 released
 
@@ -400,7 +849,7 @@ Change log since v4.0.2
   * [wlan] Add raw frame send interface and Management frame filter interface
   * [Sensor] Add vendor info and sensor types for cmd
   * [Sensor] Support custom commands for rt_sensor_control
-  * [sensor] Support TOF sensor class 
+  * [sensor] Support TOF sensor class
   * [SFUD] Update the 'sf bench' command.
   * [spi] Fix "response+1" causing hard fault of unaligned access to SPI memory of STM32 HAL library
   * [RTC] Optimize RTC alarm function, add alarm function for SOFT_RTC
@@ -527,7 +976,7 @@ Change log since v4.0.2
 * Add C++ support for eclipse target
 * Keep user's lib configuration while running --target=eclipse
 * Add Libraries when perform `scons --dist`
-* Update tools/building.py and add `tackanalysis` option 
+* Update tools/building.py and add `tackanalysis` option
 * Improve the logic of generating `rtconfig.h` files in scons with command `scons --menuconfig`
 * Fix makeimg.py wrong on linux
 * Add Studio IDE dist feature for stm32 BSP
@@ -629,7 +1078,7 @@ Change log since v4.0.1
 * The porting of loongson 1B and 1C CPU are combined into one GS232 porting;
 * Add support for RISC-V Hummingbird processor porting;
 * The context switch exit operation of risc-v is forced back to machine mode;
-* Fix the issue of switch interruption during TI C28x DSP porting; 
+* Fix the issue of switch interruption during TI C28x DSP porting;
 * Add _ffs like implementation in the TI C28x DSP porting;
 * Unify the .data .bss section to 8bytes alignment in GCC tool chain;
 * The es32f0334 BSP is moved to `bsp/essemi/es32f0334`;
@@ -676,7 +1125,7 @@ Change log since v4.0.1
   * Add pulse encoding driver;
   * Optimize hardware timer driver;
   * Add support for UART 7/8 in serial driver;
-  * Optimize WDT driver; 
+  * Optimize WDT driver;
 
 ## Tools
 
@@ -690,7 +1139,7 @@ Change log since v4.0.1
 
 * Fix the `rt_tick_from_millisecond()` compilation warning issue;
 * Remove unnecessary code that disable interrupt several times during startup initialization;
-* Fix the issue that the system object is not detached when handling defunct threads. 
+* Fix the issue that the system object is not detached when handling defunct threads.
 * Add the value checking of semaphore (the maximum value of semaphore is up to 65535)
 * Fix the 64-bit issue in kservice.c
 * Add the checking and assertion of re-initialization of object.
@@ -800,7 +1249,7 @@ Change log since v4.0.1
 * When formatting the file system, adds FM_SFD option to create a volume in SFD format for FatFs; (HubretXie)
 * Add file system handle pointer in `struct dfs_fd' structure;
 * Fix stdio fd issue when POSIX api is used; (gbcwbz)
-* Fix the `fd_is_open()` issue: when the sub-path is the same in different mounted filesystem. 
+* Fix the `fd_is_open()` issue: when the sub-path is the same in different mounted filesystem.
 * Change the critical lock/unlock to dfs_lock/unlock in `getcwd()` function of DFS (the critical lock/unlock is different in SMP environment);
 * Rewrite `list_thread/list_*` implementation of finsh cmd to avoid multi-core competition case;
 * Fix the `aio_result` issue, which is returned by `aio_read_work` in AIO; (fullhan)
@@ -1122,7 +1571,7 @@ Tools
     #include <rtdbg.h>
 ```
 
-When close the DBG_ENABLE definition, the debug log will be closed. Otherwise, the `dbg_log(level, fmt, ...)` can be used to print debug information. 
+When close the DBG_ENABLE definition, the debug log will be closed. Otherwise, the `dbg_log(level, fmt, ...)` can be used to print debug information.
 
 DBG_SECTION_NAME - The prefix information for each log line;
 DBG_LEVEL - The debug log level;
@@ -1209,7 +1658,7 @@ DBG_COLOR - Whether use color log in console.
 * Fix the filesystem_operation_table issue.
 * Enhance USB stack for USB slave (HID/ECM/RNDIS/WINUSB or composite device);
 * Enhance USB stack for USB host (HID/MSC etc);
-* Fix memory leak issue when close a pipe.  
+* Fix memory leak issue when close a pipe.
 * Fix the romfs open issue;
 * Add SoftAP device in Wi-Fi framework;
 * Re-order the lwIP/ETH initialization;
@@ -1413,7 +1862,7 @@ RT-Thread v2.0.1是2.0这个系列的bug修正版,而v2.1.0 alpha则是当前
 
 发布时间:2014/11/4
 
-随着RT-Thread功能越来越多,如何发布版本也成为一件头疼的事情,因为需要仔细对比最近三个月来的修改记录。这次的发布距离上一次beta版本依然是三个月的时间,但按照发布计划已然推迟了一个月进行发布。 
+随着RT-Thread功能越来越多,如何发布版本也成为一件头疼的事情,因为需要仔细对比最近三个月来的修改记录。这次的发布距离上一次beta版本依然是三个月的时间,但按照发布计划已然推迟了一个月进行发布。
 
 在这三个月中,开源社区上也发生了很多有趣的事情:
 

+ 0 - 1
Jenkinsfile

@@ -104,7 +104,6 @@ pipeline {
                         // ['stm32/stm32l496-ali-developer', 'sourcery-arm'], /* CI compile C99 not support */
                         // ['stm32/stm32l496-st-nucleo', 'sourcery-arm'], /* CI compile C99 not support */
                         ['stm32f20x', 'sourcery-arm'],
-                        ['swm320-lq100', 'sourcery-arm'],
                         ['beaglebone', 'sourcery-arm'],
                         ['frdm-k64f', 'sourcery-arm'],
                         ['xplorer4330/M4', 'sourcery-arm'],

+ 45 - 46
README.md

@@ -1,6 +1,8 @@
-# RT-Thread #
+<p align="center">
+<img src="documentation/figures/logo.png" width="60%" >
+</p>
 
-[中文页](README_zh.md) |
+**English** | [中文](README_zh.md) |
 
 [![GitHub](https://img.shields.io/github/license/RT-Thread/rt-thread.svg)](https://github.com/RT-Thread/rt-thread/blob/master/LICENSE)
 [![GitHub release](https://img.shields.io/github/release/RT-Thread/rt-thread.svg)](https://github.com/RT-Thread/rt-thread/releases)
@@ -9,13 +11,13 @@
 [![GitHub pull-requests](https://img.shields.io/github/issues-pr/RT-Thread/rt-thread.svg)](https://github.com/RT-Thread/rt-thread/pulls)
 [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://github.com/RT-Thread/rt-thread/pulls)
 
-# Introduction
+# RT-Thread
 
-RT-Thread was born in 2006, it is an open source, neutral, and community-based real-time operating system (RTOS). 
+RT-Thread was born in 2006, it is an open source, neutral, and community-based real-time operating system (RTOS).
 
-RT-Thread is mainly written in C language, easy to understand and easy to port(can be quickly port to a wide range of mainstream MCUs and module chips). It applies object-oriented programming methods to real-time system design, making the code elegant, structured, modular, and very tailorable. 
+RT-Thread is mainly written in C language, easy to understand and easy to port(can be quickly port to a wide range of mainstream MCUs and module chips). It applies object-oriented programming methods to real-time system design, making the code elegant, structured, modular, and very tailorable.
 
-RT-Thread has Standard version and Nano version. For resource-constrained microcontroller (MCU) systems, the NANO kernel version that requires only 3KB Flash and 1.2KB RAM memory resources can be tailored  with easy-to-use tools; And for resource-rich IoT devices, RT-Thread can use the on-line software package management tool, together with system configuration tools, to achieve intuitive and rapid modular cutting, seamlessly import rich software packages, thus achieving complex functions like Android's graphical interface and touch sliding effects, smart voice interaction effects, and so on.
+RT-Thread has Standard version and Nano version. For resource-constrained microcontroller (MCU) systems, the Nano version that requires only 3KB Flash and 1.2KB RAM memory resources can be tailored with easy-to-use tools. For resource-rich IoT devices, RT-Thread can use the on-line software package management tool, together with system configuration tools, to achieve intuitive and rapid modular cutting, seamlessly import rich software packages; thus, achieving complex functions like Android's graphical interface and touch sliding effects, smart voice interaction effects, and so on.
 
 ## RT-Thread Architecture
 
@@ -29,23 +31,20 @@ It includes:
 
 - Kernel layer: RT-Thread kernel, the core part of RT-Thread, includes the implementation of objects in the kernel system, such as multi-threading and its scheduling, semaphore, mailbox, message queue, memory management, timer, etc.; libcpu/BSP (Chip Migration Related Files/Board Support Package) is closely related to hardware and consists of peripheral drivers and CPU porting.
 
-- Components and Service Layer: Components are based on upper-level software on top of the RT-Thread kernel, such as virtual file systems, FinSH command-line interfaces, network frameworks, device frameworks, and more. Its modular design allows for high internal cohesion inside the components and low coupling between components. 
-  
-- RT-Thread software package: A general-purpose software component running on the RT-Thread IoT operating system platform for different application areas, consisting of description information, source code or library files. RT-Thread provides an open package platform with officially available or developer-supplied packages that provide developers with a choice of reusable packages that are an important part of the RT-Thread ecosystem. The package ecosystem is critical to the choice of an operating system because these packages are highly reusable and modular, making it easy for application developers to build the system they want in the shortest amount of time. RT-Thread supports more than 180 software packages. 
+- Components and Service Layer: Components are based on upper-level software on top of the RT-Thread kernel, such as virtual file systems, FinSH command-line interfaces, network frameworks, device frameworks, and more. Its modular design allows for high internal cohesion inside the components and low coupling between components.
 
-## RT-Thread Features
-
-- Designed for resource-constrained devices, the minimum kernel requires only 1.2KB of RAM and 3 KB of Flash.                                                                                                              
-
-- Has rich components and a prosperous and fast growing package ecosystem.                                                              
-
-- Elegant code style, easy to use, read and master.                                                                                                                                                                             
+- [RT-Thread software package](https://packages.rt-thread.org/en/index.html): A general-purpose software component running on the RT-Thread IoT operating system platform for different application areas, consisting of description information, source code or library files. RT-Thread provides an open package platform with officially available or developer-supplied packages that provide developers with a choice of reusable packages that are an important part of the RT-Thread ecosystem. The package ecosystem is critical to the choice of an operating system because these packages are highly reusable and modular, making it easy for application developers to build the system they want in the shortest amount of time. RT-Thread supports more than 370 software packages.
 
-- High Scalability. RT-Thread has high-quality scalable software architecture, loose coupling, modularity, is easy to tailor and expand.                                                                                                                                                                           
-
-- Supports high-performance applications.                                                                                                                    
+## RT-Thread Features
 
-- Supports cross-platform and a wide range of chips.                                                                                                          
+- Designed for resource-constrained devices, the minimum kernel requires only 1.2KB of RAM and 3 KB of Flash.
+- A variety of standard interfaces, such as POSIX, CMSIS, C++ application environment.
+- Has rich components and a prosperous and fast growing package ecosystem.
+- Elegant code style, easy to use, read and master.
+- High Scalability. RT-Thread has high-quality scalable software architecture, loose coupling, modularity, is easy to tailor and expand.
+- Supports high-performance applications.
+- Supports all mainstream compiling tools such as GCC, Keil and IAR.
+- Supports a wide range of <a href="https://www.rt-thread.io/board.html">architectures and chips</a>.
 
 ## Code Catalogue
 
@@ -62,12 +61,7 @@ It includes:
 | src           | The source files for the RT-Thread kernel. |
 | tools         | The script files for the RT-Thread command build tool. |
 
-RT-Thread has now been ported for nearly 90 development boards, most BSPs support MDK, IAR development environment and GCC compiler, and have provided default MDK and IAR project, which allows users to add their own application code directly based on the project. Each BSP has a similar directory structure, and most BSPs provide a README.md file, which is a markdown-format file that contains the basic introduction of BSP, and introduces how to simply start using BSP.
-
-Env is a development tool developed by RT-Thread which provides a build environment, text graphical system configuration, and package management capabilities for project based on the RT-Thread operating system. Its built-in `menuconfig` provides an easy-to-use configuration tool. It can tailor the kernels, components and software packages freely, so that the system can be constructed by building blocks.
-
-- [Download Env Tool](https://www.rt-thread.io/download.html?download=Env)
-- [User manual of Env](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/env/env.md)
+RT-Thread has now been ported for nearly 200 development boards, most BSPs support MDK, IAR development environment and GCC compiler, and have provided default MDK and IAR project, which allows users to add their own application code directly based on the project. Each BSP has a similar directory structure, and most BSPs provide a README.md file, which is a markdown-format file that contains the basic introduction of BSP, and introduces how to simply start using BSP.
 
 # Resources
 
@@ -80,13 +74,14 @@ RT-Thread supports many architectures, and has covered the major architectures i
 - **ARM Cortex-M4**:manufacturers like ST、Nuvton、NXP、GigaDevice、Realtek、Ambiq Micro, ect.
 - **ARM Cortex-M7**:manufacturers like ST、NXP
 - **ARM Cortex-M23**:manufacturers like GigaDevice
+- **ARM Cortex-M33**:manufacturers like ST
 - **ARM Cortex-R4**
 - **ARM Cortex-A8/A9**:manufacturers like NXP
 - **ARM7**:manufacturers like Samsung
 - **ARM9**:manufacturers like Allwinner、Xilinx 、GOKE
 - **ARM11**:manufacturers like Fullhan
 - **MIPS32**:manufacturers like loongson、Ingenic
-- **RISC-V**:manufacturers like Hifive、Kendryte、[Nuclei](https://nucleisys.com/)
+- **RISC-V**:manufacturers like Hifive、Kendryte、Nuclei
 - **ARC**:manufacturers like SYNOPSYS
 - **DSP**:manufacturers like TI
 - **C-Sky**
@@ -96,35 +91,40 @@ RT-Thread supports many architectures, and has covered the major architectures i
 
 The main IDE/compilers supported by RT-Thread are:
 
+- RT-Thread Studio IDE
 - MDK KEIL
 - IAR
 - GCC
-- RT-Thread Studio
 
-Use Python-based [scons](http://www.scons.org/) for command-line builds.
+## RT-Thread Studio IDE
 
-RT-Thread Studio Demonstration:
+[User Manual](https://www.rt-thread.io/document/site/rtthread-studio/um/studio-user-manual/) | [Tutorial Videos](https://youtu.be/ucq5eJgZIQg)
 
-![studio](./documentation/figures/studio.gif)                                                 
+RT-Thread Studio IDE (a.k.a. RT-Studio) is a one-stop intergrated development environment built by RT-Thread team. It has a easy-to-use graphical configuration system and a wealth of software packages and components resources. RT-Studio has the features of project creation, configuration and management,as well as code editing, SDK management, build configuration, debugging configuration, program download and debug. We're looking to make the use of RT-Studio as intuitive as possible, reducing the duplication of work and improving the development efficiency.
 
-## Getting Started
+![studio](./documentation/figures/studio.gif)
 
-RT-Thread BSP can be compiled directly and downloaded to the corresponding development board for use. In addition, RT-Thread also provides qemu-vexpress-a9 BSP, which can be used without hardware platform. See the getting started guide below for details.
+## Env Tool
+
+[User Manual](documentation/env/env/) | [Tutorial Videos](https://www.youtube.com/watch?v=dEK94o_YoSo)
 
-- [Getting Started of QEMU (Windows)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu.md)
+In the early stage, RT-Thread team also created an auxiliary tool called Env. It is an auxiliary tool with a TUI (Text-based user interface). Developers can use Env tool to configure and generate the GCC, Keil MDK, and IAR projects.
 
-- [Getting Started of QEMU (Ubuntu)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu_linux.md)
+![env](./documentation/figures/env.png)
 
-## Documentation
+# Getting Started
 
-[RT-Thread Programming Guide](https://github.com/RT-Thread/rtthread-manual-doc) | [RT-Thread Supported Chips & Boards](https://www.rt-thread.io/board.html) |
-[RT-Thread Software Package](https://github.com/RT-Thread/packages) | [RT-Thread Studio](https://www.rt-thread.io/studio.html) 
+[RT-Thread Programming Guide](https://www.rt-thread.io/document/site/tutorial/quick-start/introduction/introduction/) | [RT-Thread Studio IDE](https://www.rt-thread.io/studio.html) | [Kernel Sample](https://github.com/RT-Thread-packages/kernel-sample) | [RT-Thread Beginners Guide](https://www.youtube.com/watch?v=ZMi1O-Rr7yc&list=PLXUV89C_M3G5KVw2IerI-pqApdSM_IaZo)
 
-## Sample
+Based on [STM32F103 BluePill](https://github.com/RT-Thread/rt-thread/tree/master/bsp/stm32/stm32f103-blue-pill) | [Raspberry Pi Pico](https://github.com/RT-Thread/rt-thread/tree/master/bsp/raspberry-pico)
 
-[Kernel Sample](https://github.com/RT-Thread-packages/kernel-sample) | [Device Sample Code](https://github.com/RT-Thread-packages/peripheral-sample) | [File System Sample Code](https://github.com/RT-Thread-packages/filesystem-sample ) | [Network Sample Code](https://github.com/RT-Thread-packages/network-sample ) | 
+## Simulator
+
+RT-Thread BSP can be compiled directly and downloaded to the corresponding development board for use. In addition, RT-Thread also provides qemu-vexpress-a9 BSP, which can be used without hardware platform. See the getting started guide below for details.
 
-[Based on the STM32L475 IoT Board SDK](https://github.com/RT-Thread/IoT_Board) | [Based on the W601 IoT Board SDK](https://github.com/RT-Thread/W601_IoT_Board)
+- [Getting Started of QEMU with Env(Windows)](documentation/quick-start/quick_start_qemu/quick_start_qemu.md)
+
+- [Getting Started of QEMU with Env(Ubuntu)](documentation/quick-start/quick_start_qemu/quick_start_qemu_linux.md)
 
 # License
 
@@ -138,14 +138,13 @@ RT-Thread is an open source software and has been licensed under Apache License
  */
 ```
 
-To avoid possible future license conflicts, developers need to sign a Contributor License Agreement (CLA) when submitting PR to RT-Thread.
-
 # Community
 
-RT-Thread is very grateful for the support from all community developers, and if you have any ideas, suggestions or questions in the process of using RT-Thread, RT-Thread can be reached by the following means, and we are also updating RT-Thread in real time on these channels. At the same time, Any questions can be asked in the [issue section of rtthread-manual-doc](https://github.com/RT-Thread/rtthread-manual-doc/issues). By creating a new issue to describe your questions, community members will answer them.
+RT-Thread is very grateful for the support from all community developers, and if you have any ideas, suggestions or questions in the process of using RT-Thread, RT-Thread can be reached by the following means, and we are also updating RT-Thread in real time on these channels. At the same time, any questions can be asked in the [issue section of RT-Thread repository](https://github.com/RT-Thread/rt-thread/issues) or [RT-Thread forum](https://club.rt-thread.io/), and community members will answer them.
 
-[Website](https://www.rt-thread.io) | [Twitter](https://twitter.com/rt_thread) | [Youtube]( https://www.youtube.com/channel/UCdDHtIfSYPq4002r27ffqPw?view_as=subscriber) | [Gitter](  https://gitter.im/RT-Thread) | [Facebook](https://www.facebook.com/RT-Thread-IoT-OS-110395723808463/?modal=admin_todo_tour) | [Medium](https://medium.com/@rt_thread)
+[Website](https://www.rt-thread.io) | [Github](https://github.com/RT-Thread/rt-thread) | [Twitter](https://twitter.com/rt_thread) | [LinkedIn](https://www.linkedin.com/company/rt-thread-iot-os/posts/?feedView=all) | [Youtube](https://www.youtube.com/channel/UCdDHtIfSYPq4002r27ffqPw) | [Facebook](https://www.facebook.com/RT-Thread-IoT-OS-110395723808463/?modal=admin_todo_tour) | [Medium](https://rt-thread.medium.com/)
 
 # Contribution
 
-If you are interested in RT-Thread and want to join in the development of RT-Thread and become a code contributor,please refer to the [Code Contribution Guide](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/contribution_guide/contribution_guide.md).
+If you are interested in RT-Thread and want to join in the development of RT-Thread and become a code contributor,please refer to the [Code Contribution Guide](documentation/contribution_guide/contribution_guide.md).
+

+ 16 - 30
README_zh.md

@@ -9,7 +9,7 @@ RT-Thread有完整版和Nano版,对于资源受限的微控制器(MCU)系
 
 RT-Thread是一个集实时操作系统(RTOS)内核、中间件组件的物联网操作系统,架构如下:
 
-![architecturezh](./documentation/figures/architecturezh.png)  
+![architecturezh](./documentation/figures/architecturezh.png)
 
 
 
@@ -19,14 +19,14 @@ RT-Thread是一个集实时操作系统(RTOS)内核、中间件组件的物
 
 
 - RT-Thread软件包:运行于 RT-Thread物联网操作系统平台上,面向不同应用领域的通用软件组件,由描述信息、源代码或库文件组成。RT-Thread提供了开放的软件包平台,这里存放了官方提供或开发者提供的软件包,该平台为开发者提供了众多可重用软件包的选择,这也是 RT-Thread生态的重要组成部分。软件包生态对于一个操作系统的选择至关重要,因为这些软件包具有很强的可重用性,模块化程度很高,极大的方便应用开发者在最短时间内,打造出自己想要的系统。RT-Thread已经支持的软件包数量已经达到 180+。
-  
+
 
 
 ## RT-Thread的特点
 
 - 资源占用极低,超低功耗设计,最小内核(Nano版本)仅需1.2KB RAM,3KB Flash。
 
-- 组件丰富,繁荣发展的软件包生态 。                                 
+- 组件丰富,繁荣发展的软件包生态 。
 
 - 简单易用 ,优雅的代码风格,易于阅读、掌握。
 
@@ -58,7 +58,7 @@ Env 是RT-Thread推出的开发辅助工具,针对基于RT-Thread操作系统
 
 [下载 Env 工具](https://www.rt-thread.org/page/download.html)
 
-[Env 用户手册](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/env/env.md)
+[Env 用户手册](https://www.rt-thread.org/document/site/#/development-tools/env/env)
 
 
 # 资源文档
@@ -68,35 +68,21 @@ Env 是RT-Thread推出的开发辅助工具,针对基于RT-Thread操作系统
 RT-Thread RTOS 支持许多架构,并且已经涵盖了当前应用中的主要架构。涉及的架构和芯片制造商有:
 
 - ARM Cortex-M0/M0+:如芯片制造商 ST
-
 - ARM Cortex-M3:如芯片制造商 ST、全志、灵动等.
-
 - ARM Cortex-M4:如芯片制造商 ST、Nuvton、NXP、GigaDevice、Realtek、Ambiq Micro等
-
 - ARM Cortex-M7:如芯片制造商 ST、NXP
-
 - ARM Cortex-M23:如芯片制造商 GigaDevice
-
+- ARM Cortex-M33:如芯片制造商 ST
 - ARM Cortex-R4
-
 - ARM Cortex-A8/A9:如芯片制造商 NXP
-
 - ARM7:如芯片制造商Samsung
-
 - ARM9:如芯片制造商Allwinner、Xilinx 、GOKE
-
 - ARM11:如芯片制造商Fullhan
-
 - MIPS32:如芯片制造商loongson、Ingenic
-
 - RISC-V:如芯片制造商Hifive、Kendryte、[芯来Nuclei](https://nucleisys.com/)
-
 - ARC:如芯片制造商SYNOPSYS
-
 - DSP:如芯片制造商 TI
-
 - C-Sky
-
 - x86
 
 
@@ -117,29 +103,29 @@ RT-Thread主要支持的IDE/编译器包括:
 RT-Thread Studio演示:
 
 
-![studiozh](./documentation/figures/studiozh.gif)                                        
+![studiozh](./documentation/figures/studiozh.gif)
 
 
 ## **快速上手**
 
 RT-Thread BSP可以直接编译并下载到相应的开发板使用。此外,RT-Thread还提供 qemu-vexpress-a9 BSP,无需硬件平台即可使用。有关详细信息,请参阅下面的入门指南。
 
-[QEMU 入门指南(Windows)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu.md)
+[QEMU 入门指南(Windows)](documentation/quick-start/quick_start_qemu/quick_start_qemu.md)
 
-[QEMU 入门指南(Ubuntu)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu_linux.md)
+[QEMU 入门指南(Ubuntu)](documentation/quick-start/quick_start_qemu/quick_start_qemu_linux.md)
 
 
 ## 文档
 
-[文档中心](https://www.rt-thread.org/document/site/ ) | [编程指南](https://www.rt-thread.org/document/site/programming-manual/basic/basic/ ) 
+[文档中心](https://www.rt-thread.org/document/site/ ) | [编程指南](https://www.rt-thread.org/document/site/programming-manual/basic/basic/ )
 
-[应用 RT-Thread 实现蜂鸣器播放器教程](https://www.rt-thread.org/document/site/tutorial/beep-player/) | [分布式温度监控系统教程](https://www.rt-thread.org/document/site/tutorial/temperature-system/ ) | [智能车连载教程](https://www.rt-thread.org/document/site/tutorial/smart-car/ ) 
+[应用 RT-Thread 实现蜂鸣器播放器教程](https://www.rt-thread.org/document/site/tutorial/beep-player/) | [分布式温度监控系统教程](https://www.rt-thread.org/document/site/tutorial/temperature-system/ ) | [智能车连载教程](https://www.rt-thread.org/document/site/tutorial/smart-car/ )
 
 ## 例程
 
-[内核示例](https://github.com/RT-Thread-packages/kernel-sample)  | [设备示例代码](https://github.com/RT-Thread-packages/peripheral-sample ) | [文件系统示例代码](https://github.com/RT-Thread-packages/filesystem-sample ) | [网络示例代码](https://github.com/RT-Thread-packages/network-sample ) | [RT-Thread API参考手册](https://www.rt-thread.org/document/api/ ) 
+[内核示例](https://github.com/RT-Thread-packages/kernel-sample)  | [设备示例代码](https://github.com/RT-Thread-packages/peripheral-sample ) | [文件系统示例代码](https://github.com/RT-Thread-packages/filesystem-sample ) | [网络示例代码](https://github.com/RT-Thread-packages/network-sample ) | [RT-Thread API参考手册](https://www.rt-thread.org/document/api/ )
 
-[基于STM32L475 IoT Board 开发板SDK](https://github.com/RT-Thread/IoT_Board) | [基于W601 IoT Board 开发板SDK](https://github.com/RT-Thread/W601_IoT_Board) 
+[基于STM32L475 IoT Board 开发板SDK](https://github.com/RT-Thread/IoT_Board) | [基于W601 IoT Board 开发板SDK](https://github.com/RT-Thread/W601_IoT_Board)
 
 ## 视频
 
@@ -163,16 +149,16 @@ RT-Thread系统完全开源,3.1.0 及以前的版本遵循 GPL V2 + 开源许
 
 # 社区支持
 
-RT-Thread非常感谢所有社区小伙伴的支持,在使用RT-Thread的过程中若您有任何的想法,建议或疑问都可通过以下方式联系到 RT-Thread,我们也实时在这些频道更新RT-Thread的最新讯息。同时,任何问题都可以在 [issue section](https://github.com/RT-Thread/rtthread-manual-doc/issues) 中提出。通过创建一个issue来描述您的问题,社区成员将回答这些问题。
+RT-Thread非常感谢所有社区小伙伴的支持,在使用RT-Thread的过程中若您有任何的想法,建议或疑问都可通过以下方式联系到 RT-Thread,我们也实时在这些频道更新RT-Thread的最新讯息。同时,任何问题都可以在 [论坛](https://club.rt-thread.org/index.html) 中提出,社区成员将回答这些问题。
 
-[官网]( https://www.rt-thread.org) | [论坛]( https://www.rt-thread.org/qa/forum.php) | [哔哩哔哩官方账号](https://space.bilibili.com/423462075?spm_id_from=333.788.b_765f7570696e666f.2) | [微博官方账号](https://weibo.com/rtthread?is_hot=1) | [知乎官方账号](https://www.zhihu.com/topic/19964581/hot) 
+[官网]( https://www.rt-thread.org) | [论坛]( https://www.rt-thread.org/qa/forum.php) | [哔哩哔哩官方账号](https://space.bilibili.com/423462075?spm_id_from=333.788.b_765f7570696e666f.2) | [微博官方账号](https://weibo.com/rtthread?is_hot=1) | [知乎官方账号](https://www.zhihu.com/topic/19964581/hot)
 
 RT-Thread微信公众号:
 
-![qrcode](./documentation/figures/qrcode.png)
+![qrcode](./documentation/figures/qrcode.jpg)
 
 
 # 贡献代码
 
-如果您对RT-Thread感兴趣,并希望参与RT-Thread的开发并成为代码贡献者,请参阅[代码贡献指南](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/contribution_guide/contribution_guide.md)。
+如果您对RT-Thread感兴趣,并希望参与RT-Thread的开发并成为代码贡献者,请参阅[代码贡献指南](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/githubd)。
 

+ 734 - 0
bsp/CME_M7/.config

@@ -0,0 +1,734 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# RT-Thread Configuration
+#
+
+#
+# RT-Thread Kernel
+#
+CONFIG_RT_NAME_MAX=8
+# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
+# CONFIG_RT_USING_SMP is not set
+CONFIG_RT_ALIGN_SIZE=4
+# CONFIG_RT_THREAD_PRIORITY_8 is not set
+CONFIG_RT_THREAD_PRIORITY_32=y
+# CONFIG_RT_THREAD_PRIORITY_256 is not set
+CONFIG_RT_THREAD_PRIORITY_MAX=32
+CONFIG_RT_TICK_PER_SECOND=100
+CONFIG_RT_USING_OVERFLOW_CHECK=y
+CONFIG_RT_USING_HOOK=y
+CONFIG_RT_HOOK_USING_FUNC_PTR=y
+CONFIG_RT_USING_IDLE_HOOK=y
+CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
+CONFIG_IDLE_THREAD_STACK_SIZE=256
+CONFIG_RT_USING_TIMER_SOFT=y
+CONFIG_RT_TIMER_THREAD_PRIO=4
+CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
+
+#
+# kservice optimization
+#
+# CONFIG_RT_KSERVICE_USING_STDLIB is not set
+# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
+# CONFIG_RT_USING_TINY_FFS is not set
+# CONFIG_RT_PRINTF_LONGLONG is not set
+CONFIG_RT_DEBUG=y
+# CONFIG_RT_DEBUG_COLOR is not set
+# CONFIG_RT_DEBUG_INIT_CONFIG is not set
+# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
+# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
+# CONFIG_RT_DEBUG_IPC_CONFIG is not set
+# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
+# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
+# CONFIG_RT_DEBUG_MEM_CONFIG is not set
+# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
+# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
+# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
+
+#
+# Inter-Thread communication
+#
+CONFIG_RT_USING_SEMAPHORE=y
+CONFIG_RT_USING_MUTEX=y
+CONFIG_RT_USING_EVENT=y
+CONFIG_RT_USING_MAILBOX=y
+CONFIG_RT_USING_MESSAGEQUEUE=y
+# CONFIG_RT_USING_SIGNALS is not set
+
+#
+# Memory Management
+#
+CONFIG_RT_USING_MEMPOOL=y
+CONFIG_RT_USING_SMALL_MEM=y
+# CONFIG_RT_USING_SLAB is not set
+# CONFIG_RT_USING_MEMHEAP is not set
+CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y
+# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
+# CONFIG_RT_USING_SLAB_AS_HEAP is not set
+# CONFIG_RT_USING_USERHEAP is not set
+# CONFIG_RT_USING_NOHEAP is not set
+# CONFIG_RT_USING_MEMTRACE is not set
+# CONFIG_RT_USING_HEAP_ISR is not set
+CONFIG_RT_USING_HEAP=y
+
+#
+# Kernel Device Object
+#
+CONFIG_RT_USING_DEVICE=y
+# CONFIG_RT_USING_DEVICE_OPS is not set
+# CONFIG_RT_USING_INTERRUPT_INFO is not set
+CONFIG_RT_USING_CONSOLE=y
+CONFIG_RT_CONSOLEBUF_SIZE=128
+CONFIG_RT_CONSOLE_DEVICE_NAME="uart2"
+CONFIG_RT_VER_NUM=0x40100
+CONFIG_ARCH_ARM=y
+CONFIG_RT_USING_CPU_FFS=y
+CONFIG_ARCH_ARM_CORTEX_M=y
+CONFIG_ARCH_ARM_CORTEX_M3=y
+# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
+
+#
+# RT-Thread Components
+#
+CONFIG_RT_USING_COMPONENTS_INIT=y
+# CONFIG_RT_USING_USER_MAIN is not set
+# CONFIG_RT_USING_LEGACY is not set
+CONFIG_RT_USING_MSH=y
+CONFIG_RT_USING_FINSH=y
+CONFIG_FINSH_USING_MSH=y
+CONFIG_FINSH_THREAD_NAME="tshell"
+CONFIG_FINSH_THREAD_PRIORITY=20
+CONFIG_FINSH_THREAD_STACK_SIZE=4096
+CONFIG_FINSH_USING_HISTORY=y
+CONFIG_FINSH_HISTORY_LINES=5
+CONFIG_FINSH_USING_SYMTAB=y
+CONFIG_FINSH_CMD_SIZE=80
+CONFIG_MSH_USING_BUILT_IN_COMMANDS=y
+CONFIG_FINSH_USING_DESCRIPTION=y
+# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
+# CONFIG_FINSH_USING_AUTH is not set
+CONFIG_FINSH_ARG_MAX=10
+CONFIG_RT_USING_DFS=y
+CONFIG_DFS_USING_POSIX=y
+CONFIG_DFS_USING_WORKDIR=y
+CONFIG_DFS_FILESYSTEMS_MAX=4
+CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
+CONFIG_DFS_FD_MAX=16
+# CONFIG_RT_USING_DFS_MNTTABLE is not set
+CONFIG_RT_USING_DFS_ELMFAT=y
+
+#
+# elm-chan's FatFs, Generic FAT Filesystem Module
+#
+CONFIG_RT_DFS_ELM_CODE_PAGE=437
+CONFIG_RT_DFS_ELM_WORD_ACCESS=y
+# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
+# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
+# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
+CONFIG_RT_DFS_ELM_USE_LFN_3=y
+CONFIG_RT_DFS_ELM_USE_LFN=3
+CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y
+# CONFIG_RT_DFS_ELM_LFN_UNICODE_1 is not set
+# CONFIG_RT_DFS_ELM_LFN_UNICODE_2 is not set
+# CONFIG_RT_DFS_ELM_LFN_UNICODE_3 is not set
+CONFIG_RT_DFS_ELM_LFN_UNICODE=0
+CONFIG_RT_DFS_ELM_MAX_LFN=255
+CONFIG_RT_DFS_ELM_DRIVES=2
+CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
+# CONFIG_RT_DFS_ELM_USE_ERASE is not set
+CONFIG_RT_DFS_ELM_REENTRANT=y
+CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000
+# CONFIG_RT_USING_DFS_DEVFS is not set
+# CONFIG_RT_USING_DFS_ROMFS is not set
+# CONFIG_RT_USING_DFS_RAMFS is not set
+# CONFIG_RT_USING_DFS_NFS is not set
+# CONFIG_RT_USING_FAL is not set
+# CONFIG_RT_USING_LWP is not set
+
+#
+# Device Drivers
+#
+CONFIG_RT_USING_DEVICE_IPC=y
+# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
+CONFIG_RT_USING_SERIAL=y
+CONFIG_RT_USING_SERIAL_V1=y
+# CONFIG_RT_USING_SERIAL_V2 is not set
+CONFIG_RT_SERIAL_USING_DMA=y
+CONFIG_RT_SERIAL_RB_BUFSZ=64
+# CONFIG_RT_USING_CAN is not set
+# CONFIG_RT_USING_HWTIMER is not set
+# CONFIG_RT_USING_CPUTIME is not set
+# CONFIG_RT_USING_I2C is not set
+# CONFIG_RT_USING_PHY is not set
+CONFIG_RT_USING_PIN=y
+# CONFIG_RT_USING_ADC is not set
+# CONFIG_RT_USING_DAC is not set
+# CONFIG_RT_USING_PWM is not set
+# CONFIG_RT_USING_MTD_NOR is not set
+# CONFIG_RT_USING_MTD_NAND is not set
+# CONFIG_RT_USING_PM is not set
+# CONFIG_RT_USING_RTC is not set
+# CONFIG_RT_USING_SDIO is not set
+# CONFIG_RT_USING_SPI is not set
+# CONFIG_RT_USING_WDT is not set
+# CONFIG_RT_USING_AUDIO is not set
+# CONFIG_RT_USING_SENSOR is not set
+# CONFIG_RT_USING_TOUCH is not set
+# CONFIG_RT_USING_HWCRYPTO is not set
+# CONFIG_RT_USING_PULSE_ENCODER is not set
+# CONFIG_RT_USING_INPUT_CAPTURE is not set
+# CONFIG_RT_USING_WIFI is not set
+
+#
+# Using USB
+#
+# CONFIG_RT_USING_USB is not set
+# CONFIG_RT_USING_USB_HOST is not set
+# CONFIG_RT_USING_USB_DEVICE is not set
+
+#
+# C/C++ and POSIX layer
+#
+CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
+
+#
+# POSIX (Portable Operating System Interface) layer
+#
+# CONFIG_RT_USING_POSIX_FS is not set
+# CONFIG_RT_USING_POSIX_DELAY is not set
+# CONFIG_RT_USING_POSIX_CLOCK is not set
+# CONFIG_RT_USING_POSIX_TIMER is not set
+# CONFIG_RT_USING_PTHREADS is not set
+# CONFIG_RT_USING_MODULE is not set
+
+#
+# Interprocess Communication (IPC)
+#
+# CONFIG_RT_USING_POSIX_PIPE is not set
+# CONFIG_RT_USING_POSIX_MESSAGE_QUEUE is not set
+# CONFIG_RT_USING_POSIX_MESSAGE_SEMAPHORE is not set
+
+#
+# Socket is in the 'Network' category
+#
+# CONFIG_RT_USING_CPLUSPLUS is not set
+
+#
+# Network
+#
+# CONFIG_RT_USING_SAL is not set
+# CONFIG_RT_USING_NETDEV is not set
+CONFIG_NETDEV_USING_PING=y
+CONFIG_RT_USING_LWIP=y
+# CONFIG_RT_USING_LWIP_LOCAL_VERSION is not set
+# CONFIG_RT_USING_LWIP141 is not set
+CONFIG_RT_USING_LWIP203=y
+# CONFIG_RT_USING_LWIP212 is not set
+# CONFIG_RT_USING_LWIP_LATEST is not set
+CONFIG_RT_USING_LWIP_VER_NUM=0x20003
+# CONFIG_RT_USING_LWIP_IPV6 is not set
+CONFIG_RT_LWIP_MEM_ALIGNMENT=4
+CONFIG_RT_LWIP_IGMP=y
+CONFIG_RT_LWIP_ICMP=y
+# CONFIG_RT_LWIP_SNMP is not set
+CONFIG_RT_LWIP_DNS=y
+CONFIG_RT_LWIP_DHCP=y
+CONFIG_IP_SOF_BROADCAST=1
+CONFIG_IP_SOF_BROADCAST_RECV=1
+
+#
+# Static IPv4 Address
+#
+CONFIG_RT_LWIP_IPADDR="192.168.1.30"
+CONFIG_RT_LWIP_GWADDR="192.168.1.1"
+CONFIG_RT_LWIP_MSKADDR="255.255.255.0"
+CONFIG_RT_LWIP_UDP=y
+CONFIG_RT_LWIP_TCP=y
+CONFIG_RT_LWIP_RAW=y
+# CONFIG_RT_LWIP_PPP is not set
+CONFIG_RT_MEMP_NUM_NETCONN=12
+CONFIG_RT_LWIP_PBUF_NUM=3
+CONFIG_RT_LWIP_RAW_PCB_NUM=2
+CONFIG_RT_LWIP_UDP_PCB_NUM=4
+CONFIG_RT_LWIP_TCP_PCB_NUM=8
+CONFIG_RT_LWIP_TCP_SEG_NUM=40
+CONFIG_RT_LWIP_TCP_SND_BUF=4380
+CONFIG_RT_LWIP_TCP_WND=4380
+CONFIG_RT_LWIP_TCPTHREAD_PRIORITY=12
+CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=4
+CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE=1024
+# CONFIG_LWIP_NO_RX_THREAD is not set
+# CONFIG_LWIP_NO_TX_THREAD is not set
+CONFIG_RT_LWIP_ETHTHREAD_PRIORITY=15
+CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=512
+CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=4
+# CONFIG_RT_LWIP_REASSEMBLY_FRAG is not set
+CONFIG_LWIP_NETIF_STATUS_CALLBACK=1
+CONFIG_LWIP_NETIF_LINK_CALLBACK=1
+CONFIG_SO_REUSE=1
+CONFIG_LWIP_SO_RCVTIMEO=1
+CONFIG_LWIP_SO_SNDTIMEO=1
+CONFIG_LWIP_SO_RCVBUF=1
+CONFIG_LWIP_SO_LINGER=0
+# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
+CONFIG_LWIP_NETIF_LOOPBACK=0
+# CONFIG_RT_LWIP_STATS is not set
+# CONFIG_RT_LWIP_USING_HW_CHECKSUM is not set
+CONFIG_RT_LWIP_USING_PING=y
+# CONFIG_LWIP_USING_DHCPD is not set
+# CONFIG_RT_LWIP_DEBUG is not set
+# CONFIG_RT_USING_AT is not set
+
+#
+# Utilities
+#
+# CONFIG_RT_USING_RYM is not set
+# CONFIG_RT_USING_ULOG is not set
+# CONFIG_RT_USING_UTEST is not set
+# CONFIG_RT_USING_VAR_EXPORT is not set
+# CONFIG_RT_USING_RT_LINK is not set
+# CONFIG_RT_USING_VBUS is not set
+
+#
+# RT-Thread Utestcases
+#
+# CONFIG_RT_USING_UTESTCASES is not set
+
+#
+# RT-Thread online packages
+#
+
+#
+# IoT - internet of things
+#
+# CONFIG_PKG_USING_LWIP is not set
+# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
+# CONFIG_PKG_USING_PAHOMQTT is not set
+# CONFIG_PKG_USING_UMQTT is not set
+# CONFIG_PKG_USING_WEBCLIENT is not set
+# CONFIG_PKG_USING_WEBNET is not set
+# CONFIG_PKG_USING_MONGOOSE is not set
+# CONFIG_PKG_USING_MYMQTT is not set
+# CONFIG_PKG_USING_KAWAII_MQTT is not set
+# CONFIG_PKG_USING_BC28_MQTT is not set
+# CONFIG_PKG_USING_WEBTERMINAL is not set
+# CONFIG_PKG_USING_LIBMODBUS is not set
+# CONFIG_PKG_USING_FREEMODBUS is not set
+# CONFIG_PKG_USING_NANOPB is not set
+
+#
+# Wi-Fi
+#
+
+#
+# Marvell WiFi
+#
+# CONFIG_PKG_USING_WLANMARVELL is not set
+
+#
+# Wiced WiFi
+#
+# CONFIG_PKG_USING_WLAN_WICED is not set
+# CONFIG_PKG_USING_RW007 is not set
+# CONFIG_PKG_USING_COAP is not set
+# CONFIG_PKG_USING_NOPOLL is not set
+# CONFIG_PKG_USING_NETUTILS is not set
+# CONFIG_PKG_USING_CMUX is not set
+# CONFIG_PKG_USING_PPP_DEVICE is not set
+# CONFIG_PKG_USING_AT_DEVICE is not set
+# CONFIG_PKG_USING_ATSRV_SOCKET is not set
+# CONFIG_PKG_USING_WIZNET is not set
+# CONFIG_PKG_USING_ZB_COORDINATOR is not set
+
+#
+# IoT Cloud
+#
+# CONFIG_PKG_USING_ONENET is not set
+# CONFIG_PKG_USING_GAGENT_CLOUD is not set
+# CONFIG_PKG_USING_ALI_IOTKIT is not set
+# CONFIG_PKG_USING_AZURE is not set
+# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set
+# CONFIG_PKG_USING_JIOT-C-SDK is not set
+# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
+# CONFIG_PKG_USING_JOYLINK is not set
+# CONFIG_PKG_USING_EZ_IOT_OS is not set
+# CONFIG_PKG_USING_NIMBLE is not set
+# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
+# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
+# CONFIG_PKG_USING_IPMSG is not set
+# CONFIG_PKG_USING_LSSDP is not set
+# CONFIG_PKG_USING_AIRKISS_OPEN is not set
+# CONFIG_PKG_USING_LIBRWS is not set
+# CONFIG_PKG_USING_TCPSERVER is not set
+# CONFIG_PKG_USING_PROTOBUF_C is not set
+# CONFIG_PKG_USING_DLT645 is not set
+# CONFIG_PKG_USING_QXWZ is not set
+# CONFIG_PKG_USING_SMTP_CLIENT is not set
+# CONFIG_PKG_USING_ABUP_FOTA is not set
+# CONFIG_PKG_USING_LIBCURL2RTT is not set
+# CONFIG_PKG_USING_CAPNP is not set
+# CONFIG_PKG_USING_AGILE_TELNET is not set
+# CONFIG_PKG_USING_NMEALIB is not set
+# CONFIG_PKG_USING_PDULIB is not set
+# CONFIG_PKG_USING_BTSTACK is not set
+# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
+# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
+# CONFIG_PKG_USING_MAVLINK is not set
+# CONFIG_PKG_USING_BSAL is not set
+# CONFIG_PKG_USING_AGILE_MODBUS is not set
+# CONFIG_PKG_USING_AGILE_FTP is not set
+# CONFIG_PKG_USING_EMBEDDEDPROTO is not set
+# CONFIG_PKG_USING_RT_LINK_HW is not set
+# CONFIG_PKG_USING_LORA_PKT_FWD is not set
+# CONFIG_PKG_USING_LORA_GW_DRIVER_LIB is not set
+# CONFIG_PKG_USING_LORA_PKT_SNIFFER is not set
+# CONFIG_PKG_USING_HM is not set
+# CONFIG_PKG_USING_SMALL_MODBUS is not set
+# CONFIG_PKG_USING_NET_SERVER is not set
+
+#
+# security packages
+#
+# CONFIG_PKG_USING_MBEDTLS is not set
+# CONFIG_PKG_USING_LIBSODIUM is not set
+# CONFIG_PKG_USING_TINYCRYPT is not set
+# CONFIG_PKG_USING_TFM is not set
+# CONFIG_PKG_USING_YD_CRYPTO is not set
+
+#
+# language packages
+#
+
+#
+# JSON: JavaScript Object Notation, a lightweight data-interchange format
+#
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
+
+#
+# XML: Extensible Markup Language
+#
+# CONFIG_PKG_USING_SIMPLE_XML is not set
+# CONFIG_PKG_USING_EZXML is not set
+# CONFIG_PKG_USING_LUATOS_SOC is not set
+# CONFIG_PKG_USING_LUA is not set
+# CONFIG_PKG_USING_JERRYSCRIPT is not set
+# CONFIG_PKG_USING_MICROPYTHON is not set
+# CONFIG_PKG_USING_PIKASCRIPT is not set
+
+#
+# multimedia packages
+#
+
+#
+# LVGL: powerful and easy-to-use embedded GUI library
+#
+# CONFIG_PKG_USING_LVGL is not set
+# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
+# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
+
+#
+# u8g2: a monochrome graphic library
+#
+# CONFIG_PKG_USING_U8G2_OFFICIAL is not set
+# CONFIG_PKG_USING_U8G2 is not set
+# CONFIG_PKG_USING_OPENMV is not set
+# CONFIG_PKG_USING_MUPDF is not set
+# CONFIG_PKG_USING_STEMWIN is not set
+# CONFIG_PKG_USING_WAVPLAYER is not set
+# CONFIG_PKG_USING_TJPGD is not set
+# CONFIG_PKG_USING_PDFGEN is not set
+# CONFIG_PKG_USING_HELIX is not set
+# CONFIG_PKG_USING_AZUREGUIX is not set
+# CONFIG_PKG_USING_TOUCHGFX2RTT is not set
+# CONFIG_PKG_USING_NUEMWIN is not set
+# CONFIG_PKG_USING_MP3PLAYER is not set
+# CONFIG_PKG_USING_TINYJPEG is not set
+# CONFIG_PKG_USING_UGUI is not set
+
+#
+# PainterEngine: A cross-platform graphics application framework written in C language
+#
+# CONFIG_PKG_USING_PAINTERENGINE is not set
+# CONFIG_PKG_USING_PAINTERENGINE_AUX is not set
+# CONFIG_PKG_USING_MCURSES is not set
+# CONFIG_PKG_USING_TERMBOX is not set
+# CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
+
+#
+# tools packages
+#
+# CONFIG_PKG_USING_CMBACKTRACE is not set
+# CONFIG_PKG_USING_EASYFLASH is not set
+# CONFIG_PKG_USING_EASYLOGGER is not set
+# CONFIG_PKG_USING_SYSTEMVIEW is not set
+# CONFIG_PKG_USING_SEGGER_RTT is not set
+# CONFIG_PKG_USING_RDB is not set
+# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
+# CONFIG_PKG_USING_ULOG_FILE is not set
+# CONFIG_PKG_USING_LOGMGR is not set
+# CONFIG_PKG_USING_ADBD is not set
+# CONFIG_PKG_USING_COREMARK is not set
+# CONFIG_PKG_USING_DHRYSTONE is not set
+# CONFIG_PKG_USING_MEMORYPERF is not set
+# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
+# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
+# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
+# CONFIG_PKG_USING_BS8116A is not set
+# CONFIG_PKG_USING_GPS_RMC is not set
+# CONFIG_PKG_USING_URLENCODE is not set
+# CONFIG_PKG_USING_UMCN is not set
+# CONFIG_PKG_USING_LWRB2RTT is not set
+# CONFIG_PKG_USING_CPU_USAGE is not set
+# CONFIG_PKG_USING_GBK2UTF8 is not set
+# CONFIG_PKG_USING_VCONSOLE is not set
+# CONFIG_PKG_USING_KDB is not set
+# CONFIG_PKG_USING_WAMR is not set
+# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set
+# CONFIG_PKG_USING_LWLOG is not set
+# CONFIG_PKG_USING_ANV_TRACE is not set
+# CONFIG_PKG_USING_ANV_MEMLEAK is not set
+# CONFIG_PKG_USING_ANV_TESTSUIT is not set
+# CONFIG_PKG_USING_ANV_BENCH is not set
+# CONFIG_PKG_USING_DEVMEM is not set
+# CONFIG_PKG_USING_REGEX is not set
+# CONFIG_PKG_USING_MEM_SANDBOX is not set
+# CONFIG_PKG_USING_SOLAR_TERMS is not set
+# CONFIG_PKG_USING_GAN_ZHI is not set
+# CONFIG_PKG_USING_FDT is not set
+# CONFIG_PKG_USING_CBOX is not set
+# CONFIG_PKG_USING_SNOWFLAKE is not set
+
+#
+# system packages
+#
+
+#
+# enhanced kernel services
+#
+# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
+# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
+# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
+
+#
+# POSIX extension functions
+#
+# CONFIG_PKG_USING_POSIX_GETLINE is not set
+# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
+# CONFIG_PKG_USING_POSIX_ITOA is not set
+# CONFIG_PKG_USING_POSIX_STRINGS is not set
+
+#
+# acceleration: Assembly language or algorithmic acceleration packages
+#
+# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
+# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
+# CONFIG_PKG_USING_QFPLIB_M3 is not set
+
+#
+# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
+#
+# CONFIG_PKG_USING_CMSIS_5 is not set
+# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
+
+#
+# Micrium: Micrium software products porting for RT-Thread
+#
+# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set
+# CONFIG_PKG_USING_UCOSII_WRAPPER is not set
+# CONFIG_PKG_USING_UC_CRC is not set
+# CONFIG_PKG_USING_UC_CLK is not set
+# CONFIG_PKG_USING_UC_COMMON is not set
+# CONFIG_PKG_USING_UC_MODBUS is not set
+# CONFIG_PKG_USING_RTDUINO is not set
+# CONFIG_PKG_USING_CAIRO is not set
+# CONFIG_PKG_USING_PIXMAN is not set
+# CONFIG_PKG_USING_PARTITION is not set
+# CONFIG_PKG_USING_FLASHDB is not set
+# CONFIG_PKG_USING_SQLITE is not set
+# CONFIG_PKG_USING_RTI is not set
+# CONFIG_PKG_USING_DFS_YAFFS is not set
+# CONFIG_PKG_USING_LITTLEFS is not set
+# CONFIG_PKG_USING_DFS_JFFS2 is not set
+# CONFIG_PKG_USING_DFS_UFFS is not set
+# CONFIG_PKG_USING_LWEXT4 is not set
+# CONFIG_PKG_USING_THREAD_POOL is not set
+# CONFIG_PKG_USING_ROBOTS is not set
+# CONFIG_PKG_USING_EV is not set
+# CONFIG_PKG_USING_SYSWATCH is not set
+# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
+# CONFIG_PKG_USING_PLCCORE is not set
+# CONFIG_PKG_USING_RAMDISK is not set
+# CONFIG_PKG_USING_MININI is not set
+# CONFIG_PKG_USING_QBOOT is not set
+# CONFIG_PKG_USING_PPOOL is not set
+# CONFIG_PKG_USING_OPENAMP is not set
+# CONFIG_PKG_USING_LPM is not set
+# CONFIG_PKG_USING_TLSF is not set
+# CONFIG_PKG_USING_EVENT_RECORDER is not set
+# CONFIG_PKG_USING_ARM_2D is not set
+# CONFIG_PKG_USING_MCUBOOT is not set
+# CONFIG_PKG_USING_TINYUSB is not set
+# CONFIG_PKG_USING_CHERRYUSB is not set
+# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+
+#
+# peripheral libraries and drivers
+#
+# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
+# CONFIG_PKG_USING_REALTEK_AMEBA is not set
+# CONFIG_PKG_USING_SHT2X is not set
+# CONFIG_PKG_USING_SHT3X is not set
+# CONFIG_PKG_USING_AS7341 is not set
+# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_ICM20608 is not set
+# CONFIG_PKG_USING_BUTTON is not set
+# CONFIG_PKG_USING_PCF8574 is not set
+# CONFIG_PKG_USING_SX12XX is not set
+# CONFIG_PKG_USING_SIGNAL_LED is not set
+# CONFIG_PKG_USING_LEDBLINK is not set
+# CONFIG_PKG_USING_LITTLED is not set
+# CONFIG_PKG_USING_LKDGUI is not set
+# CONFIG_PKG_USING_NRF5X_SDK is not set
+# CONFIG_PKG_USING_NRFX is not set
+# CONFIG_PKG_USING_WM_LIBRARIES is not set
+# CONFIG_PKG_USING_KENDRYTE_SDK is not set
+# CONFIG_PKG_USING_INFRARED is not set
+# CONFIG_PKG_USING_MULTI_INFRARED is not set
+# CONFIG_PKG_USING_AGILE_BUTTON is not set
+# CONFIG_PKG_USING_AGILE_LED is not set
+# CONFIG_PKG_USING_AT24CXX is not set
+# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
+# CONFIG_PKG_USING_AD7746 is not set
+# CONFIG_PKG_USING_PCA9685 is not set
+# CONFIG_PKG_USING_I2C_TOOLS is not set
+# CONFIG_PKG_USING_NRF24L01 is not set
+# CONFIG_PKG_USING_TOUCH_DRIVERS is not set
+# CONFIG_PKG_USING_MAX17048 is not set
+# CONFIG_PKG_USING_RPLIDAR is not set
+# CONFIG_PKG_USING_AS608 is not set
+# CONFIG_PKG_USING_RC522 is not set
+# CONFIG_PKG_USING_WS2812B is not set
+# CONFIG_PKG_USING_EMBARC_BSP is not set
+# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set
+# CONFIG_PKG_USING_MULTI_RTIMER is not set
+# CONFIG_PKG_USING_MAX7219 is not set
+# CONFIG_PKG_USING_BEEP is not set
+# CONFIG_PKG_USING_EASYBLINK is not set
+# CONFIG_PKG_USING_PMS_SERIES is not set
+# CONFIG_PKG_USING_CAN_YMODEM is not set
+# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set
+# CONFIG_PKG_USING_QLED is not set
+# CONFIG_PKG_USING_PAJ7620 is not set
+# CONFIG_PKG_USING_AGILE_CONSOLE is not set
+# CONFIG_PKG_USING_LD3320 is not set
+# CONFIG_PKG_USING_WK2124 is not set
+# CONFIG_PKG_USING_LY68L6400 is not set
+# CONFIG_PKG_USING_DM9051 is not set
+# CONFIG_PKG_USING_SSD1306 is not set
+# CONFIG_PKG_USING_QKEY is not set
+# CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_RS232 is not set
+# CONFIG_PKG_USING_NES is not set
+# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
+# CONFIG_PKG_USING_VDEVICE is not set
+# CONFIG_PKG_USING_SGM706 is not set
+# CONFIG_PKG_USING_STM32WB55_SDK is not set
+# CONFIG_PKG_USING_RDA58XX is not set
+# CONFIG_PKG_USING_LIBNFC is not set
+# CONFIG_PKG_USING_MFOC is not set
+# CONFIG_PKG_USING_TMC51XX is not set
+# CONFIG_PKG_USING_TCA9534 is not set
+# CONFIG_PKG_USING_KOBUKI is not set
+# CONFIG_PKG_USING_ROSSERIAL is not set
+# CONFIG_PKG_USING_MICRO_ROS is not set
+# CONFIG_PKG_USING_MCP23008 is not set
+# CONFIG_PKG_USING_BLUETRUM_SDK is not set
+# CONFIG_PKG_USING_MISAKA_AT24CXX is not set
+# CONFIG_PKG_USING_MISAKA_RGB_BLING is not set
+# CONFIG_PKG_USING_LORA_MODEM_DRIVER is not set
+# CONFIG_PKG_USING_BL_MCU_SDK is not set
+# CONFIG_PKG_USING_SOFT_SERIAL is not set
+# CONFIG_PKG_USING_MB85RS16 is not set
+# CONFIG_PKG_USING_CW2015 is not set
+# CONFIG_PKG_USING_RFM300 is not set
+
+#
+# AI packages
+#
+# CONFIG_PKG_USING_LIBANN is not set
+# CONFIG_PKG_USING_NNOM is not set
+# CONFIG_PKG_USING_ONNX_BACKEND is not set
+# CONFIG_PKG_USING_ONNX_PARSER is not set
+# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
+# CONFIG_PKG_USING_ELAPACK is not set
+# CONFIG_PKG_USING_ULAPACK is not set
+# CONFIG_PKG_USING_QUEST is not set
+# CONFIG_PKG_USING_NAXOS is not set
+
+#
+# miscellaneous packages
+#
+
+#
+# project laboratory
+#
+
+#
+# samples: kernel and components samples
+#
+# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
+# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
+# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
+# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+
+#
+# entertainment: terminal games and other interesting software packages
+#
+# CONFIG_PKG_USING_CMATRIX is not set
+# CONFIG_PKG_USING_SL is not set
+# CONFIG_PKG_USING_CAL is not set
+# CONFIG_PKG_USING_ACLOCK is not set
+# CONFIG_PKG_USING_THREES is not set
+# CONFIG_PKG_USING_2048 is not set
+# CONFIG_PKG_USING_SNAKE is not set
+# CONFIG_PKG_USING_TETRIS is not set
+# CONFIG_PKG_USING_DONUT is not set
+# CONFIG_PKG_USING_COWSAY is not set
+# CONFIG_PKG_USING_LIBCSV is not set
+# CONFIG_PKG_USING_OPTPARSE is not set
+# CONFIG_PKG_USING_FASTLZ is not set
+# CONFIG_PKG_USING_MINILZO is not set
+# CONFIG_PKG_USING_QUICKLZ is not set
+# CONFIG_PKG_USING_LZMA is not set
+# CONFIG_PKG_USING_MULTIBUTTON is not set
+# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
+# CONFIG_PKG_USING_CANFESTIVAL is not set
+# CONFIG_PKG_USING_ZLIB is not set
+# CONFIG_PKG_USING_MINIZIP is not set
+# CONFIG_PKG_USING_HEATSHRINK is not set
+# CONFIG_PKG_USING_DSTR is not set
+# CONFIG_PKG_USING_TINYFRAME is not set
+# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
+# CONFIG_PKG_USING_DIGITALCTRL is not set
+# CONFIG_PKG_USING_UPACKER is not set
+# CONFIG_PKG_USING_UPARAM is not set
+# CONFIG_PKG_USING_HELLO is not set
+# CONFIG_PKG_USING_VI is not set
+# CONFIG_PKG_USING_KI is not set
+# CONFIG_PKG_USING_ARMv7M_DWT is not set
+# CONFIG_PKG_USING_UKAL is not set
+# CONFIG_PKG_USING_CRCLIB is not set
+# CONFIG_PKG_USING_LWGPS is not set
+# CONFIG_PKG_USING_STATE_MACHINE is not set
+# CONFIG_PKG_USING_DESIGN_PATTERN is not set
+# CONFIG_PKG_USING_CONTROLLER is not set
+# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
+# CONFIG_PKG_USING_MFBD is not set
+CONFIG_SOC_CME_M7=y

+ 78 - 0
bsp/CME_M7/CME_M7.ld

@@ -0,0 +1,78 @@
+/******************************************************************************
+ *
+ * CME_M7.ld - Linker configuration file for project.
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2014-11-02     aozima       first implementation
+ *
+ *****************************************************************************/
+
+/* Program Entry, set to mark it as "used" and avoid gc */
+MEMORY
+{
+    FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* !!! real 128K, up to 256K for linker. */
+    SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+SECTIONS
+{
+    .text :
+    {
+        _text = .;
+        KEEP(*(.isr_vector))
+        *(.text*)
+        *(.rodata*)
+
+        /* section information for finsh shell */
+        . = ALIGN(4);
+        __fsymtab_start = .;
+        KEEP(*(FSymTab))
+        __fsymtab_end = .;
+        . = ALIGN(4);
+        __vsymtab_start = .;
+        KEEP(*(VSymTab))
+        __vsymtab_end = .;
+        . = ALIGN(4);
+
+        /* section information for components init. */
+        . = ALIGN(4);
+        __rt_init_start = .;
+        KEEP(*(SORT(.rti_fn*)))
+        __rt_init_end = .;
+        . = ALIGN(4);
+
+    } > FLASH
+
+    /* .ARM.exidx is sorted, so has to go in its own output section.  */
+    __exidx_start = .;
+    .ARM.exidx :
+    {
+        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+
+        /* This is used by the startup in order to initialize the .data secion */
+        _sidata = .;
+    } > FLASH
+    __exidx_end = .;
+
+	/* end of all text. */
+    _etext = .;
+	
+    .data : AT(_etext)
+    {
+        _data = .;
+        *(vtable)
+        *(.data*)
+        _edata = .;
+    } > SRAM
+
+    .bss :
+    {
+        _bss = .;
+        *(.bss*)
+        *(COMMON)
+        _ebss = .;
+    } > SRAM
+    __bss_end = .;
+
+}

+ 22 - 0
bsp/CME_M7/CME_M7.sct

@@ -0,0 +1,22 @@
+; *************************************************************
+; *** Scatter-Loading Description File generated by uVision ***
+; *************************************************************
+
+; load 		region 			size_region
+LR_IROM1 	(0)				(1024 * 128)
+{
+	; load address = execution address
+	ER_IROM1 (0) 			(1024 * 128)
+	{
+		*.o (RESET, +First)
+		*(InRoot$$Sections)
+		.ANY (+RO)
+	}
+
+	; RW data
+	RW_IRAM1 0x20000000 (1024 * 48)
+	{
+		.ANY (+RW +ZI)
+	}
+}
+

+ 93 - 0
bsp/CME_M7/CMSIS/CME_M7/cmem7_it.c

@@ -0,0 +1,93 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_it.c
+	*
+	* @brief    CMEM7 system exception file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note      
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_it.h"
+
+void NMI_Handler(void)
+{
+	while (1);
+}
+
+void HardFault_Handler(void)
+{
+  if (CoreDebug->DHCSR & 1) { // check C_DEBUGEN == 1-> Debugger Connected
+    __breakpoint (0); // halt program execution here
+  }
+  /* Go to infinite loop when Hard Fault exception occurs */
+  while (1)
+  {
+  }
+}
+
+void MemManage_Handler(void)
+{
+  if (CoreDebug->DHCSR & 1) { // check C_DEBUGEN == 1-> Debugger Connected
+    __breakpoint (0); // halt program execution here
+  }
+  /* Go to infinite loop when Memory Manage exception occurs */
+  while (1)
+  {
+  }
+}
+
+void BusFault_Handler(void)
+{
+  if (CoreDebug->DHCSR & 1) { // check C_DEBUGEN == 1-> Debugger Connected
+    __breakpoint (0); // halt program execution here
+  }
+  /* Go to infinite loop when Bus Fault exception occurs */
+  while (1)
+  {
+  }
+}
+
+void UsageFault_Handler(void)
+{
+  if (CoreDebug->DHCSR & 1) { // check C_DEBUGEN == 1-> Debugger Connected
+    __breakpoint (0); // halt program execution here
+  }
+  /* Go to infinite loop when Usage Fault exception occurs */
+  while (1)
+  {
+  }
+}
+
+void SVC_Handler(void)
+{
+}
+
+void DebugMon_Handler(void)
+{
+}
+
+void PendSV_Handler(void)
+{
+}
+
+void SysTick_Handler(void)
+{
+}
+

+ 401 - 0
bsp/CME_M7/CMSIS/CME_M7/cmem7_it.h

@@ -0,0 +1,401 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_it.h
+	*
+	* @brief    CMEM7 system exception interrupt header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note     Actually, you don't have to implement below involved function 
+	*           whick were defined as weak dummy functions in startup file.
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#ifndef __CMEM7_IT_H
+#define __CMEM7_IT_H
+
+#include "cmem7.h"
+
+/**
+  * @brief  This function handles NMI exception.
+  * @param  None
+  * @retval None
+  */
+void NMI_Handler(void);
+
+/**
+  * @brief  This function handles Hard Fault exception.
+  * @param  None
+  * @retval None
+  */
+void HardFault_Handler(void);
+
+/**
+  * @brief  This function handles Memory Manage exception.
+  * @param  None
+  * @retval None
+  */
+void MemManage_Handler(void);
+
+/**
+  * @brief  This function handles Bus Fault exception.
+  * @param  None
+  * @retval None
+  */
+void BusFault_Handler(void);
+
+/**
+  * @brief  This function handles Usage Fault exception.
+  * @param  None
+  * @retval None
+  */
+void UsageFault_Handler(void);
+
+/**
+  * @brief  This function handles SVCall exception.
+  * @param  None
+  * @retval None
+  */
+void SVC_Handler(void);
+
+/**
+  * @brief  This function handles Debug Monitor exception.
+  * @param  None
+  * @retval None
+  */
+void DebugMon_Handler(void);
+
+/**
+  * @brief  This function handles PendSV_Handler exception.
+  * @param  None
+  * @retval None
+  */
+void PendSV_Handler(void);
+
+/**
+  * @brief  This function handles SysTick Handler.
+  * @param  None
+  * @retval None
+  */
+void SysTick_Handler(void);
+
+/**
+  * @brief  This function handles ethernet interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void ETH_IRQHandler(void);
+
+/**
+  * @brief  This function handles USB interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void USB_IRQHandler(void);
+
+/**
+  * @brief  This function handles DMA interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void DMAC_IRQHandler(void);
+
+/**
+  * @brief  This function handles CAN0 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void CAN0_IRQHandler(void); 
+
+/**
+  * @brief  This function handles CAN1 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void CAN1_IRQHandler(void); 
+
+/**
+  * @brief  This function handles FP0 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP0_IRQHandler(void);  
+
+/**
+  * @brief  This function handles FP1 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP1_IRQHandler(void);          
+
+/**
+  * @brief  This function handles FP2 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP2_IRQHandler(void);          		
+
+/**
+  * @brief  This function handles FP3 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP3_IRQHandler(void); 
+
+/**
+  * @brief  This function handles FP4 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP4_IRQHandler(void); 
+
+/**
+  * @brief  This function handles FP5 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP5_IRQHandler(void); 
+
+/**
+  * @brief  This function handles FP6 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP6_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP7 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP7_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP8 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP8_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP9 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP9_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP10 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP10_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP11 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP11_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP12 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP12_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP13 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP13_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP14 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP14_IRQHandler(void);
+
+/**
+  * @brief  This function handles FP15 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void FP15_IRQHandler(void); 
+
+/**
+  * @brief  This function handles UART0 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void UART0_IRQHandler(void);
+
+/**
+  * @brief  This function handles UART1 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void UART1_IRQHandler(void);
+
+/**
+  * @brief  This function handles ADC interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void ADC_IRQHandler(void); 
+
+/**
+  * @brief  This function handles GPIO interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void GPIO_IRQHandler(void);
+
+/**
+  * @brief  This function handles SPI1 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void SPI1_IRQHandler(void);
+
+/**
+  * @brief  This function handles I2C1 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void I2C1_IRQHandler(void);
+
+/**
+  * @brief  This function handles SPI0 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void SPI0_IRQHandler(void);
+
+/**
+  * @brief  This function handles I2C0 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void I2C0_IRQHandler(void);
+
+/**
+  * @brief  This function handles RTC second interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void RTC_1S_IRQHandler(void); 
+
+/**
+  * @brief  This function handles RTC microsecond interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void RTC_1MS_IRQHandler(void);
+
+/**
+  * @brief  This function handles watchdog interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void WDG_IRQHandler(void); 
+
+/**
+  * @brief  This function handles timer interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void TIMER_IRQHandler(void); 
+
+/**
+  * @brief  This function handles DDR interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void DDRC_SW_PROC_IRQHandler(void); 
+
+/**
+  * @brief  This function handles ethernet pmt interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void ETH_PMT_IRQHandler(void); 
+
+/**
+  * @brief  This function handles pad interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void PAD_IRQHandler(void);
+
+/**
+  * @brief  This function handles DDR interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void DDRC_LANE_SYNC_IRQHandler(void); 
+
+/**
+  * @brief  This function handles UART2 interrupt.
+  * @param  None
+  * @retval None
+	* @note   Implement it in your interrupt handler
+  */
+void UART2_IRQHandler(void);            
+
+#endif /* __CMEM7_IT_H */
+

+ 288 - 0
bsp/CME_M7/CMSIS/CME_M7/startup/arm/startup_cmem7.s

@@ -0,0 +1,288 @@
+;*****************************************************************************
+;* @file     start_cmem7.h
+;*
+;* @brief    CMEM7 startup file
+;*
+;*
+;* @version  V1.0
+;* @date     3. September 2013
+;*
+;* @note               
+;*           
+;*****************************************************************************
+;* @attention
+;*
+;* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+;* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+;* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+;* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+;* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+;* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+;*
+;* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+;*****************************************************************************
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; <h> Stack Configuration
+;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+; </h>
+
+Stack_Size      EQU     0x00000400
+
+                AREA    STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem       SPACE   Stack_Size
+__initial_sp
+
+
+; <h> Heap Configuration
+;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+; </h>
+
+Heap_Size       EQU     0x00000200
+
+                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem        SPACE   Heap_Size
+__heap_limit
+
+                PRESERVE8
+                THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+                AREA    RESET, DATA, READONLY
+                EXPORT  __Vectors
+                EXPORT  __Vectors_End
+                EXPORT  __Vectors_Size
+
+__Vectors       DCD     __initial_sp               ; Top of Stack
+                DCD     Reset_Handler              ; Reset Handler
+                DCD     NMI_Handler                ; NMI Handler
+                DCD     HardFault_Handler          ; Hard Fault Handler
+                DCD     MemManage_Handler          ; MPU Fault Handler
+                DCD     BusFault_Handler           ; Bus Fault Handler
+                DCD     UsageFault_Handler         ; Usage Fault Handler
+                DCD     0                          ; Reserved
+                DCD     0                          ; Reserved
+                DCD     0                          ; Reserved
+                DCD     0                          ; Reserved
+                DCD     SVC_Handler                ; SVCall Handler
+                DCD     DebugMon_Handler           ; Debug Monitor Handler
+                DCD     0                          ; Reserved
+                DCD     PendSV_Handler             ; PendSV Handler
+                DCD     SysTick_Handler            ; SysTick Handler
+
+                ; External Interrupts
+				DCD     ETH_IRQHandler             ; ETH
+				DCD     USB_IRQHandler             ; USB
+				DCD     DMAC_IRQHandler            ; DMAC
+				DCD     CAN0_IRQHandler            ; CAN0
+				DCD     CAN1_IRQHandler            ; CAN1
+				DCD     FP0_IRQHandler             ; FP[0:15]
+				DCD     FP1_IRQHandler
+				DCD     FP2_IRQHandler
+				DCD     FP3_IRQHandler
+				DCD     FP4_IRQHandler
+				DCD     FP5_IRQHandler
+				DCD     FP6_IRQHandler
+				DCD     FP7_IRQHandler
+				DCD     FP8_IRQHandler
+				DCD     FP9_IRQHandler
+				DCD     FP10_IRQHandler
+				DCD     FP11_IRQHandler
+				DCD     FP12_IRQHandler
+				DCD     FP13_IRQHandler
+				DCD     FP14_IRQHandler
+				DCD     FP15_IRQHandler			   ; 21
+				DCD     UART0_IRQHandler           ; UART0
+                DCD     UART1_IRQHandler           ; UART1
+				DCD     ADC_IRQHandler             ; ADC
+				DCD     GPIO_IRQHandler            ; GPIO
+				DCD     SPI1_IRQHandler            ; SPI1
+				DCD     I2C1_IRQHandler            ; I2C1
+				DCD     SPI0_IRQHandler            ; SPI0
+				DCD     I2C0_IRQHandler            ; I2C0
+				DCD     RTC_1S_IRQHandler          ; RTC 1S
+				DCD     RTC_1MS_IRQHandler         ; RTC 1MS
+				DCD     WDG_IRQHandler             ; Watchdog
+				DCD     TIMER_IRQHandler           ; Timer 0 || 1 || 2 || 3
+                DCD     DDRC_SW_PROC_IRQHandler    ; DDRC sw proc       				
+				DCD     ETH_PMT_IRQHandler         ; ETH pmt
+				DCD     PAD_IRQHandler             ; PAD
+				DCD     DDRC_LANE_SYNC_IRQHandler  ; DDRC lane sync
+				DCD     UART2_IRQHandler           ; UART2
+
+__Vectors_End
+
+__Vectors_Size  EQU  __Vectors_End - __Vectors
+
+                AREA    |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler    PROC
+                 EXPORT  Reset_Handler             [WEAK]
+        IMPORT  SystemInit
+        IMPORT  __main
+                 LDR     R0, =SystemInit
+                 BLX     R0
+                 LDR     R0, =__main
+                 BX      R0
+                 ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler     PROC
+                EXPORT  NMI_Handler                [WEAK]
+                B       .
+                ENDP
+HardFault_Handler\
+                PROC
+                EXPORT  HardFault_Handler          [WEAK]
+                B       .
+                ENDP
+MemManage_Handler\
+                PROC
+                EXPORT  MemManage_Handler          [WEAK]
+                B       .
+                ENDP
+BusFault_Handler\
+                PROC
+                EXPORT  BusFault_Handler           [WEAK]
+                B       .
+                ENDP
+UsageFault_Handler\
+                PROC
+                EXPORT  UsageFault_Handler         [WEAK]
+                B       .
+                ENDP
+SVC_Handler     PROC
+                EXPORT  SVC_Handler                [WEAK]
+                B       .
+                ENDP
+DebugMon_Handler\
+                PROC
+                EXPORT  DebugMon_Handler           [WEAK]
+                B       .
+                ENDP
+PendSV_Handler  PROC
+                EXPORT  PendSV_Handler             [WEAK]
+                B       .
+                ENDP
+SysTick_Handler PROC
+                EXPORT  SysTick_Handler            [WEAK]
+                B       .
+                ENDP
+
+Default_Handler PROC               
+				EXPORT  ETH_IRQHandler             [WEAK]
+                EXPORT  USB_IRQHandler             [WEAK]
+				EXPORT  DMAC_IRQHandler            [WEAK]
+				EXPORT  CAN0_IRQHandler            [WEAK]
+				EXPORT  CAN1_IRQHandler            [WEAK]
+				EXPORT  FP0_IRQHandler             [WEAK]
+				EXPORT  FP1_IRQHandler             [WEAK]
+				EXPORT  FP2_IRQHandler             [WEAK]
+				EXPORT  FP3_IRQHandler             [WEAK]
+				EXPORT  FP4_IRQHandler             [WEAK]
+				EXPORT  FP5_IRQHandler             [WEAK]
+				EXPORT  FP6_IRQHandler             [WEAK]
+				EXPORT  FP7_IRQHandler             [WEAK]
+				EXPORT  FP8_IRQHandler             [WEAK]
+				EXPORT  FP9_IRQHandler             [WEAK]
+				EXPORT  FP10_IRQHandler            [WEAK]
+				EXPORT  FP11_IRQHandler            [WEAK]
+				EXPORT  FP12_IRQHandler            [WEAK]
+				EXPORT  FP13_IRQHandler            [WEAK]
+				EXPORT  FP14_IRQHandler            [WEAK]
+				EXPORT  FP15_IRQHandler            [WEAK]
+				EXPORT  UART0_IRQHandler           [WEAK]
+                EXPORT  UART1_IRQHandler           [WEAK]
+                EXPORT  ADC_IRQHandler             [WEAK]
+				EXPORT  GPIO_IRQHandler            [WEAK]
+                EXPORT  SPI1_IRQHandler            [WEAK]
+				EXPORT  I2C1_IRQHandler            [WEAK]
+                EXPORT  SPI0_IRQHandler            [WEAK]
+                EXPORT  I2C0_IRQHandler            [WEAK]
+				EXPORT  RTC_1S_IRQHandler          [WEAK]
+				EXPORT  RTC_1MS_IRQHandler         [WEAK]
+                EXPORT  WDG_IRQHandler             [WEAK]				
+                EXPORT  TIMER_IRQHandler           [WEAK] 
+                EXPORT  DDRC_SW_PROC_IRQHandler    [WEAK]           				
+				EXPORT  ETH_PMT_IRQHandler         [WEAK]           				
+				EXPORT  PAD_IRQHandler             [WEAK]           				
+				EXPORT  DDRC_LANE_SYNC_IRQHandler  [WEAK]           				
+				EXPORT  UART2_IRQHandler           [WEAK]           				         				
+ETH_IRQHandler
+USB_IRQHandler
+DMAC_IRQHandler
+CAN0_IRQHandler
+CAN1_IRQHandler
+FP0_IRQHandler
+FP1_IRQHandler
+FP2_IRQHandler
+FP3_IRQHandler
+FP4_IRQHandler
+FP5_IRQHandler
+FP6_IRQHandler
+FP7_IRQHandler
+FP8_IRQHandler
+FP9_IRQHandler
+FP10_IRQHandler
+FP11_IRQHandler
+FP12_IRQHandler
+FP13_IRQHandler
+FP14_IRQHandler
+FP15_IRQHandler
+UART0_IRQHandler
+UART1_IRQHandler          
+ADC_IRQHandler 
+GPIO_IRQHandler
+SPI1_IRQHandler          
+I2C1_IRQHandler         
+SPI0_IRQHandler          
+I2C0_IRQHandler  
+RTC_1S_IRQHandler
+RTC_1MS_IRQHandler
+WDG_IRQHandler            
+TIMER_IRQHandler 
+DDRC_SW_PROC_IRQHandler    				
+ETH_PMT_IRQHandler               				
+PAD_IRQHandler                  				
+DDRC_LANE_SYNC_IRQHandler     				
+UART2_IRQHandler          
+                B       .
+
+                ENDP
+
+                ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+                 IF      :DEF:__MICROLIB
+                
+                 EXPORT  __initial_sp
+                 EXPORT  __heap_base
+                 EXPORT  __heap_limit
+                
+                 ELSE
+                
+                 IMPORT  __use_two_region_memory
+                 EXPORT  __user_initial_stackheap
+                 
+__user_initial_stackheap
+
+                 LDR     R0, =  Heap_Mem
+                 LDR     R1, =(Stack_Mem + Stack_Size)
+                 LDR     R2, = (Heap_Mem +  Heap_Size)
+                 LDR     R3, = Stack_Mem
+                 BX      LR
+
+                 ALIGN
+
+                 ENDIF
+
+                 END
+
+;******************* (C) COPYRIGHT 2011 Capital Micro *****END OF FILE*****

+ 226 - 0
bsp/CME_M7/CMSIS/CME_M7/startup/gcc/startup_CME_M7.c

@@ -0,0 +1,226 @@
+//*****************************************************************************
+//
+// Startup code for use with GNU tools.
+//
+//*****************************************************************************
+
+
+//*****************************************************************************
+//
+// Forward declaration of the default fault handlers.
+//
+//*****************************************************************************
+static void Reset_Handler(void);
+static void Default_Handler(void);
+
+//*****************************************************************************
+//
+// External declaration for the interrupt handler used by the application.
+//
+//*****************************************************************************
+void NMI_Handler(void)          __attribute__((weak, alias("Default_Handler")));
+void HardFault_Handler(void)    __attribute__((weak, alias("Default_Handler")));
+void MemManage_Handler(void)    __attribute__((weak, alias("Default_Handler")));
+void BusFault_Handler(void)     __attribute__((weak, alias("Default_Handler")));
+void UsageFault_Handler(void)   __attribute__((weak, alias("Default_Handler")));
+void SVC_Handler(void)          __attribute__((weak, alias("Default_Handler")));
+void DebugMon_Handler(void)     __attribute__((weak, alias("Default_Handler")));
+void PendSV_Handler(void)       __attribute__((weak, alias("Default_Handler")));
+void SysTick_Handler(void)      __attribute__((weak, alias("Default_Handler")));
+
+void ETH_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void USB_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void DMAC_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void CAN0_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void CAN1_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+
+void FP0_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP1_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP2_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP3_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP4_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP5_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP6_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP7_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP8_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP9_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void FP10_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void FP11_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void FP12_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void FP13_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void FP14_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void FP15_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void UART0_IRQHandler(void)     __attribute__((weak, alias("Default_Handler")));
+void UART1_IRQHandler(void)     __attribute__((weak, alias("Default_Handler")));
+void ADC_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void GPIO_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void SPI1_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void I2C1_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void SPI0_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void I2C0_IRQHandler(void)      __attribute__((weak, alias("Default_Handler")));
+void RTC_1S_IRQHandler(void)    __attribute__((weak, alias("Default_Handler")));
+void RTC_1MS_IRQHandler(void)   __attribute__((weak, alias("Default_Handler")));
+void WDG_IRQHandler(void)       __attribute__((weak, alias("Default_Handler")));
+void TIMER_IRQHandler(void)          __attribute__((weak, alias("Default_Handler")));
+void DDRC_SW_PROC_IRQHandler(void)   __attribute__((weak, alias("Default_Handler")));
+void ETH_PMT_IRQHandler(void)        __attribute__((weak, alias("Default_Handler")));
+void PAD_IRQHandler(void)            __attribute__((weak, alias("Default_Handler")));
+void DDRC_LANE_SYNC_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
+void UART2_IRQHandler(void)          __attribute__((weak, alias("Default_Handler")));
+
+//*****************************************************************************
+//
+// The entry point for the application.
+//
+//*****************************************************************************
+extern int main(void);
+
+//*****************************************************************************
+//
+// Reserve space for the system stack.
+//
+//*****************************************************************************
+static unsigned long pulStack[512];
+
+//*****************************************************************************
+//
+// The vector table.  Note that the proper constructs must be placed on this to
+// ensure that it ends up at physical address 0x0000.0000.
+//
+//*****************************************************************************
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) =
+{
+    (void (*)(void))((unsigned long)pulStack + sizeof(pulStack)),
+    // The initial stack pointer
+    Reset_Handler,              // Reset Handler
+    NMI_Handler,                // NMI Handler
+    HardFault_Handler,          // Hard Fault Handler
+    MemManage_Handler,          // MPU Fault Handler
+    BusFault_Handler,           // Bus Fault Handler
+    UsageFault_Handler,         // Usage Fault Handler
+    0,                          // Reserved
+    0,                          // Reserved
+    0,                          // Reserved
+    0,                          // Reserved
+    SVC_Handler,                // SVCall Handler
+    DebugMon_Handler,           // Debug Monitor Handler
+    0,                          // Reserved
+    PendSV_Handler,             // PendSV Handler
+    SysTick_Handler,            // SysTick Handler
+
+    // External Interrupts
+    ETH_IRQHandler,
+    USB_IRQHandler,
+    DMAC_IRQHandler,
+    CAN0_IRQHandler,
+    CAN1_IRQHandler,
+    FP0_IRQHandler,
+    FP1_IRQHandler,
+    FP2_IRQHandler,
+    FP3_IRQHandler,
+    FP4_IRQHandler,
+    FP5_IRQHandler,
+    FP6_IRQHandler,
+    FP7_IRQHandler,
+    FP8_IRQHandler,
+    FP9_IRQHandler,
+    FP10_IRQHandler,
+    FP11_IRQHandler,
+    FP12_IRQHandler,
+    FP13_IRQHandler,
+    FP14_IRQHandler,
+    FP15_IRQHandler,
+    UART0_IRQHandler,
+    UART1_IRQHandler,
+    ADC_IRQHandler,
+    GPIO_IRQHandler,
+    SPI1_IRQHandler,
+    I2C1_IRQHandler,
+    SPI0_IRQHandler,
+    I2C0_IRQHandler,
+    RTC_1S_IRQHandler,
+    RTC_1MS_IRQHandler,
+    WDG_IRQHandler,
+    TIMER_IRQHandler,
+    DDRC_SW_PROC_IRQHandler,
+    ETH_PMT_IRQHandler,
+    PAD_IRQHandler,
+    DDRC_LANE_SYNC_IRQHandler,
+    UART2_IRQHandler,
+};
+
+//*****************************************************************************
+//
+// The following are constructs created by the linker, indicating where the
+// the "data" and "bss" segments reside in memory.  The initializers for the
+// for the "data" segment resides immediately following the "text" segment.
+//
+//*****************************************************************************
+extern unsigned long _etext;
+extern unsigned long _data;
+extern unsigned long _edata;
+extern unsigned long _bss;
+extern unsigned long _ebss;
+
+//*****************************************************************************
+//
+// This is the code that gets called when the processor first starts execution
+// following a reset event.  Only the absolutely necessary set is performed,
+// after which the application supplied entry() routine is called.  Any fancy
+// actions (such as making decisions based on the reset cause register, and
+// resetting the bits in that register) are left solely in the hands of the
+// application.
+//
+//*****************************************************************************
+static void Reset_Handler(void)
+{
+    unsigned long *pulSrc, *pulDest;
+
+    //
+    // Copy the data segment initializers from flash to SRAM.
+    //
+    pulSrc = &_etext;
+    for(pulDest = &_data; pulDest < &_edata; )
+    {
+        *pulDest++ = *pulSrc++;
+    }
+
+    //
+    // Zero fill the bss segment.
+    //
+    __asm("    ldr     r0, =_bss\n"
+          "    ldr     r1, =_ebss\n"
+          "    mov     r2, #0\n"
+          "    .thumb_func\n"
+          "zero_loop:\n"
+          "        cmp     r0, r1\n"
+          "        it      lt\n"
+          "        strlt   r2, [r0], #4\n"
+          "        blt     zero_loop");
+
+    // call system init.	
+	SystemInit();
+
+    //
+    // Call the application's entry point.
+    //
+    main();
+}
+
+//*****************************************************************************
+//
+// This is the code that gets called when the processor receives an unexpected
+// interrupt.  This simply enters an infinite loop, preserving the system state
+// for examination by a debugger.
+//
+//*****************************************************************************
+static void Default_Handler(void)
+{
+    //
+    // Go into an infinite loop.
+    //
+    while(1)
+    {
+    }
+}

+ 39 - 0
bsp/CME_M7/CMSIS/CME_M7/system_cmem7.c

@@ -0,0 +1,39 @@
+/**
+	*****************************************************************************
+	* @file     system_cmem7.c
+	*
+	* @brief    CMEM7 system initial file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note      
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#include "cmem7.h"
+#include "cmem7_includes.h"
+
+void SystemInit (void) {
+	// Generally, we use DLL clock as system clock, not default oscillator
+	GLB_SelectSysClkSource(SYS_CLK_SEL_DLL);
+
+	// change NMI to PAD IRQ
+	GLB_SetNmiIrqNum(PAD_INT_IRQn);	
+	
+	return ;
+}
+

+ 93 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/arm_common_tables.h

@@ -0,0 +1,93 @@
+/* ----------------------------------------------------------------------
+* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
+*
+* $Date:        17. January 2013
+* $Revision:    V1.4.1
+*
+* Project:      CMSIS DSP Library
+* Title:        arm_common_tables.h
+*
+* Description:  This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
+*
+* Target Processor: Cortex-M4/Cortex-M3
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*   - Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   - Redistributions in binary form must reproduce the above copyright
+*     notice, this list of conditions and the following disclaimer in
+*     the documentation and/or other materials provided with the
+*     distribution.
+*   - Neither the name of ARM LIMITED nor the names of its contributors
+*     may be used to endorse or promote products derived from this
+*     software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+* -------------------------------------------------------------------- */
+
+#ifndef _ARM_COMMON_TABLES_H
+#define _ARM_COMMON_TABLES_H
+
+#include "arm_math.h"
+
+extern const uint16_t armBitRevTable[1024];
+extern const q15_t armRecipTableQ15[64];
+extern const q31_t armRecipTableQ31[64];
+extern const q31_t realCoefAQ31[1024];
+extern const q31_t realCoefBQ31[1024];
+extern const float32_t twiddleCoef_16[32];
+extern const float32_t twiddleCoef_32[64];
+extern const float32_t twiddleCoef_64[128];
+extern const float32_t twiddleCoef_128[256];
+extern const float32_t twiddleCoef_256[512];
+extern const float32_t twiddleCoef_512[1024];
+extern const float32_t twiddleCoef_1024[2048];
+extern const float32_t twiddleCoef_2048[4096];
+extern const float32_t twiddleCoef_4096[8192];
+#define twiddleCoef twiddleCoef_4096
+extern const q31_t twiddleCoefQ31[6144];
+extern const q15_t twiddleCoefQ15[6144];
+extern const float32_t twiddleCoef_rfft_32[32];
+extern const float32_t twiddleCoef_rfft_64[64];
+extern const float32_t twiddleCoef_rfft_128[128];
+extern const float32_t twiddleCoef_rfft_256[256];
+extern const float32_t twiddleCoef_rfft_512[512];
+extern const float32_t twiddleCoef_rfft_1024[1024];
+extern const float32_t twiddleCoef_rfft_2048[2048];
+extern const float32_t twiddleCoef_rfft_4096[4096];
+
+
+#define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20  )
+#define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48  )
+#define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56  )
+#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 )
+#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 )
+#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 )
+#define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800)
+#define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808)
+#define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032)
+
+extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH];
+
+#endif /*  ARM_COMMON_TABLES_H */

+ 7306 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/arm_math.h

@@ -0,0 +1,7306 @@
+/* ----------------------------------------------------------------------
+* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
+*
+* $Date:        17. January 2013
+* $Revision:    V1.4.1
+*
+* Project:      CMSIS DSP Library
+* Title:        arm_math.h
+*
+* Description:  Public header file for CMSIS DSP Library
+*
+* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*   - Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   - Redistributions in binary form must reproduce the above copyright
+*     notice, this list of conditions and the following disclaimer in
+*     the documentation and/or other materials provided with the
+*     distribution.
+*   - Neither the name of ARM LIMITED nor the names of its contributors
+*     may be used to endorse or promote products derived from this
+*     software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+ * -------------------------------------------------------------------- */
+
+/**
+   \mainpage CMSIS DSP Software Library
+   *
+   * <b>Introduction</b>
+   *
+   * This user manual describes the CMSIS DSP software library,
+   * a suite of common signal processing functions for use on Cortex-M processor based devices.
+   *
+   * The library is divided into a number of functions each covering a specific category:
+   * - Basic math functions
+   * - Fast math functions
+   * - Complex math functions
+   * - Filters
+   * - Matrix functions
+   * - Transforms
+   * - Motor control functions
+   * - Statistical functions
+   * - Support functions
+   * - Interpolation functions
+   *
+   * The library has separate functions for operating on 8-bit integers, 16-bit integers,
+   * 32-bit integer and 32-bit floating-point values.
+   *
+   * <b>Using the Library</b>
+   *
+   * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
+   * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
+   * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
+   * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
+   * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
+   * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
+   * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
+   * - arm_cortexM0l_math.lib (Little endian on Cortex-M0)
+   * - arm_cortexM0b_math.lib (Big endian on Cortex-M3)
+   *
+   * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
+   * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
+   * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
+   * Define the appropriate pre processor MACRO ARM_MATH_CM4 or  ARM_MATH_CM3 or
+   * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
+   *
+   * <b>Examples</b>
+   *
+   * The library ships with a number of examples which demonstrate how to use the library functions.
+   *
+   * <b>Toolchain Support</b>
+   *
+   * The library has been developed and tested with MDK-ARM version 4.60.
+   * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
+   *
+   * <b>Building the Library</b>
+   *
+   * The library installer contains project files to re build libraries on MDK Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
+   * - arm_cortexM0b_math.uvproj
+   * - arm_cortexM0l_math.uvproj
+   * - arm_cortexM3b_math.uvproj
+   * - arm_cortexM3l_math.uvproj
+   * - arm_cortexM4b_math.uvproj
+   * - arm_cortexM4l_math.uvproj
+   * - arm_cortexM4bf_math.uvproj
+   * - arm_cortexM4lf_math.uvproj
+   *
+   *
+   * The project can be built by opening the appropriate project in MDK-ARM 4.60 chain and defining the optional pre processor MACROs detailed above.
+   *
+   * <b>Pre-processor Macros</b>
+   *
+   * Each library project have differant pre-processor macros.
+   *
+   * - UNALIGNED_SUPPORT_DISABLE:
+   *
+   * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
+   *
+   * - ARM_MATH_BIG_ENDIAN:
+   *
+   * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
+   *
+   * - ARM_MATH_MATRIX_CHECK:
+   *
+   * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
+   *
+   * - ARM_MATH_ROUNDING:
+   *
+   * Define macro ARM_MATH_ROUNDING for rounding on support functions
+   *
+   * - ARM_MATH_CMx:
+   *
+   * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
+   * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target.
+   *
+   * - __FPU_PRESENT:
+   *
+   * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
+   *
+   * <b>Copyright Notice</b>
+   *
+   * Copyright (C) 2010-2013 ARM Limited. All rights reserved.
+   */
+
+
+/**
+ * @defgroup groupMath Basic Math Functions
+ */
+
+/**
+ * @defgroup groupFastMath Fast Math Functions
+ * This set of functions provides a fast approximation to sine, cosine, and square root.
+ * As compared to most of the other functions in the CMSIS math library, the fast math functions
+ * operate on individual values and not arrays.
+ * There are separate functions for Q15, Q31, and floating-point data.
+ *
+ */
+
+/**
+ * @defgroup groupCmplxMath Complex Math Functions
+ * This set of functions operates on complex data vectors.
+ * The data in the complex arrays is stored in an interleaved fashion
+ * (real, imag, real, imag, ...).
+ * In the API functions, the number of samples in a complex array refers
+ * to the number of complex values; the array contains twice this number of
+ * real values.
+ */
+
+/**
+ * @defgroup groupFilters Filtering Functions
+ */
+
+/**
+ * @defgroup groupMatrix Matrix Functions
+ *
+ * This set of functions provides basic matrix math operations.
+ * The functions operate on matrix data structures.  For example,
+ * the type
+ * definition for the floating-point matrix structure is shown
+ * below:
+ * <pre>
+ *     typedef struct
+ *     {
+ *       uint16_t numRows;     // number of rows of the matrix.
+ *       uint16_t numCols;     // number of columns of the matrix.
+ *       float32_t *pData;     // points to the data of the matrix.
+ *     } arm_matrix_instance_f32;
+ * </pre>
+ * There are similar definitions for Q15 and Q31 data types.
+ *
+ * The structure specifies the size of the matrix and then points to
+ * an array of data.  The array is of size <code>numRows X numCols</code>
+ * and the values are arranged in row order.  That is, the
+ * matrix element (i, j) is stored at:
+ * <pre>
+ *     pData[i*numCols + j]
+ * </pre>
+ *
+ * \par Init Functions
+ * There is an associated initialization function for each type of matrix
+ * data structure.
+ * The initialization function sets the values of the internal structure fields.
+ * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
+ * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types,  respectively.
+ *
+ * \par
+ * Use of the initialization function is optional. However, if initialization function is used
+ * then the instance structure cannot be placed into a const data section.
+ * To place the instance structure in a const data
+ * section, manually initialize the data structure.  For example:
+ * <pre>
+ * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
+ * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
+ * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
+ * </pre>
+ * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
+ * specifies the number of columns, and <code>pData</code> points to the
+ * data array.
+ *
+ * \par Size Checking
+ * By default all of the matrix functions perform size checking on the input and
+ * output matrices.  For example, the matrix addition function verifies that the
+ * two input matrices and the output matrix all have the same number of rows and
+ * columns.  If the size check fails the functions return:
+ * <pre>
+ *     ARM_MATH_SIZE_MISMATCH
+ * </pre>
+ * Otherwise the functions return
+ * <pre>
+ *     ARM_MATH_SUCCESS
+ * </pre>
+ * There is some overhead associated with this matrix size checking.
+ * The matrix size checking is enabled via the \#define
+ * <pre>
+ *     ARM_MATH_MATRIX_CHECK
+ * </pre>
+ * within the library project settings.  By default this macro is defined
+ * and size checking is enabled.  By changing the project settings and
+ * undefining this macro size checking is eliminated and the functions
+ * run a bit faster.  With size checking disabled the functions always
+ * return <code>ARM_MATH_SUCCESS</code>.
+ */
+
+/**
+ * @defgroup groupTransforms Transform Functions
+ */
+
+/**
+ * @defgroup groupController Controller Functions
+ */
+
+/**
+ * @defgroup groupStats Statistics Functions
+ */
+/**
+ * @defgroup groupSupport Support Functions
+ */
+
+/**
+ * @defgroup groupInterpolation Interpolation Functions
+ * These functions perform 1- and 2-dimensional interpolation of data.
+ * Linear interpolation is used for 1-dimensional data and
+ * bilinear interpolation is used for 2-dimensional data.
+ */
+
+/**
+ * @defgroup groupExamples Examples
+ */
+#ifndef _ARM_MATH_H
+#define _ARM_MATH_H
+
+#define __CMSIS_GENERIC         /* disable NVIC and Systick functions */
+
+#if defined (ARM_MATH_CM4)
+#include "core_cm4.h"
+#elif defined (ARM_MATH_CM3)
+#include "core_cm3.h"
+#elif defined (ARM_MATH_CM0)
+#include "core_cm0.h"
+#define ARM_MATH_CM0_FAMILY
+#elif defined (ARM_MATH_CM0PLUS)
+#include "core_cm0plus.h"
+#define ARM_MATH_CM0_FAMILY
+#else
+#include "ARMCM4.h"
+#warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
+#endif
+
+#undef  __CMSIS_GENERIC         /* enable NVIC and Systick functions */
+#include "string.h"
+#include "math.h"
+#ifdef	__cplusplus
+extern "C"
+{
+#endif
+
+
+  /**
+   * @brief Macros required for reciprocal calculation in Normalized LMS
+   */
+
+#define DELTA_Q31 			(0x100)
+#define DELTA_Q15 			0x5
+#define INDEX_MASK 			0x0000003F
+#ifndef PI
+#define PI					3.14159265358979f
+#endif
+
+  /**
+   * @brief Macros required for SINE and COSINE Fast math approximations
+   */
+
+#define TABLE_SIZE			256
+#define TABLE_SPACING_Q31	0x800000
+#define TABLE_SPACING_Q15	0x80
+
+  /**
+   * @brief Macros required for SINE and COSINE Controller functions
+   */
+  /* 1.31(q31) Fixed value of 2/360 */
+  /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
+#define INPUT_SPACING			0xB60B61
+
+  /**
+   * @brief Macro for Unaligned Support
+   */
+#ifndef UNALIGNED_SUPPORT_DISABLE
+    #define ALIGN4
+#else
+  #if defined  (__GNUC__)
+    #define ALIGN4 __attribute__((aligned(4)))
+  #else
+    #define ALIGN4 __align(4)
+  #endif
+#endif	/*	#ifndef UNALIGNED_SUPPORT_DISABLE	*/
+
+  /**
+   * @brief Error status returned by some functions in the library.
+   */
+
+  typedef enum
+  {
+    ARM_MATH_SUCCESS = 0,                /**< No error */
+    ARM_MATH_ARGUMENT_ERROR = -1,        /**< One or more arguments are incorrect */
+    ARM_MATH_LENGTH_ERROR = -2,          /**< Length of data buffer is incorrect */
+    ARM_MATH_SIZE_MISMATCH = -3,         /**< Size of matrices is not compatible with the operation. */
+    ARM_MATH_NANINF = -4,                /**< Not-a-number (NaN) or infinity is generated */
+    ARM_MATH_SINGULAR = -5,              /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
+    ARM_MATH_TEST_FAILURE = -6           /**< Test Failed  */
+  } arm_status;
+
+  /**
+   * @brief 8-bit fractional data type in 1.7 format.
+   */
+  typedef int8_t q7_t;
+
+  /**
+   * @brief 16-bit fractional data type in 1.15 format.
+   */
+  typedef int16_t q15_t;
+
+  /**
+   * @brief 32-bit fractional data type in 1.31 format.
+   */
+  typedef int32_t q31_t;
+
+  /**
+   * @brief 64-bit fractional data type in 1.63 format.
+   */
+  typedef int64_t q63_t;
+
+  /**
+   * @brief 32-bit floating-point type definition.
+   */
+  typedef float float32_t;
+
+  /**
+   * @brief 64-bit floating-point type definition.
+   */
+  typedef double float64_t;
+
+  /**
+   * @brief definition to read/write two 16 bit values.
+   */
+#if defined __CC_ARM
+#define __SIMD32_TYPE int32_t __packed
+#define CMSIS_UNUSED __attribute__((unused))
+#elif defined __ICCARM__
+#define CMSIS_UNUSED
+#define __SIMD32_TYPE int32_t __packed
+#elif defined __GNUC__
+#define __SIMD32_TYPE int32_t
+#define CMSIS_UNUSED __attribute__((unused))
+#else
+#error Unknown compiler
+#endif
+
+#define __SIMD32(addr)  (*(__SIMD32_TYPE **) & (addr))
+#define __SIMD32_CONST(addr)  ((__SIMD32_TYPE *)(addr))
+
+#define _SIMD32_OFFSET(addr)  (*(__SIMD32_TYPE *)  (addr))
+
+#define __SIMD64(addr)  (*(int64_t **) & (addr))
+
+#if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
+  /**
+   * @brief definition to pack two 16 bit values.
+   */
+#define __PKHBT(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0x0000FFFF) | \
+                                         (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000)  )
+#define __PKHTB(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0xFFFF0000) | \
+                                         (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF)  )
+
+#endif
+
+
+   /**
+   * @brief definition to pack four 8 bit values.
+   */
+#ifndef ARM_MATH_BIG_ENDIAN
+
+#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) <<  0) & (int32_t)0x000000FF) |	\
+                                (((int32_t)(v1) <<  8) & (int32_t)0x0000FF00) |	\
+							    (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) |	\
+							    (((int32_t)(v3) << 24) & (int32_t)0xFF000000)  )
+#else
+
+#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) <<  0) & (int32_t)0x000000FF) |	\
+                                (((int32_t)(v2) <<  8) & (int32_t)0x0000FF00) |	\
+							    (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) |	\
+							    (((int32_t)(v0) << 24) & (int32_t)0xFF000000)  )
+
+#endif
+
+
+  /**
+   * @brief Clips Q63 to Q31 values.
+   */
+  static __INLINE q31_t clip_q63_to_q31(
+  q63_t x)
+  {
+    return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
+      ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
+  }
+
+  /**
+   * @brief Clips Q63 to Q15 values.
+   */
+  static __INLINE q15_t clip_q63_to_q15(
+  q63_t x)
+  {
+    return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
+      ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
+  }
+
+  /**
+   * @brief Clips Q31 to Q7 values.
+   */
+  static __INLINE q7_t clip_q31_to_q7(
+  q31_t x)
+  {
+    return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
+      ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
+  }
+
+  /**
+   * @brief Clips Q31 to Q15 values.
+   */
+  static __INLINE q15_t clip_q31_to_q15(
+  q31_t x)
+  {
+    return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
+      ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
+  }
+
+  /**
+   * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
+   */
+
+  static __INLINE q63_t mult32x64(
+  q63_t x,
+  q31_t y)
+  {
+    return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
+            (((q63_t) (x >> 32) * y)));
+  }
+
+
+#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM   )
+#define __CLZ __clz
+#endif
+
+#if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
+
+  static __INLINE uint32_t __CLZ(
+  q31_t data);
+
+
+  static __INLINE uint32_t __CLZ(
+  q31_t data)
+  {
+    uint32_t count = 0;
+    uint32_t mask = 0x80000000;
+
+    while((data & mask) == 0)
+    {
+      count += 1u;
+      mask = mask >> 1u;
+    }
+
+    return (count);
+
+  }
+
+#endif
+
+  /**
+   * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
+   */
+
+  static __INLINE uint32_t arm_recip_q31(
+  q31_t in,
+  q31_t * dst,
+  q31_t * pRecipTable)
+  {
+
+    uint32_t out, tempVal;
+    uint32_t index, i;
+    uint32_t signBits;
+
+    if(in > 0)
+    {
+      signBits = __CLZ(in) - 1;
+    }
+    else
+    {
+      signBits = __CLZ(-in) - 1;
+    }
+
+    /* Convert input sample to 1.31 format */
+    in = in << signBits;
+
+    /* calculation of index for initial approximated Val */
+    index = (uint32_t) (in >> 24u);
+    index = (index & INDEX_MASK);
+
+    /* 1.31 with exp 1 */
+    out = pRecipTable[index];
+
+    /* calculation of reciprocal value */
+    /* running approximation for two iterations */
+    for (i = 0u; i < 2u; i++)
+    {
+      tempVal = (q31_t) (((q63_t) in * out) >> 31u);
+      tempVal = 0x7FFFFFFF - tempVal;
+      /*      1.31 with exp 1 */
+      //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
+      out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
+    }
+
+    /* write output */
+    *dst = out;
+
+    /* return num of signbits of out = 1/in value */
+    return (signBits + 1u);
+
+  }
+
+  /**
+   * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
+   */
+  static __INLINE uint32_t arm_recip_q15(
+  q15_t in,
+  q15_t * dst,
+  q15_t * pRecipTable)
+  {
+
+    uint32_t out = 0, tempVal = 0;
+    uint32_t index = 0, i = 0;
+    uint32_t signBits = 0;
+
+    if(in > 0)
+    {
+      signBits = __CLZ(in) - 17;
+    }
+    else
+    {
+      signBits = __CLZ(-in) - 17;
+    }
+
+    /* Convert input sample to 1.15 format */
+    in = in << signBits;
+
+    /* calculation of index for initial approximated Val */
+    index = in >> 8;
+    index = (index & INDEX_MASK);
+
+    /*      1.15 with exp 1  */
+    out = pRecipTable[index];
+
+    /* calculation of reciprocal value */
+    /* running approximation for two iterations */
+    for (i = 0; i < 2; i++)
+    {
+      tempVal = (q15_t) (((q31_t) in * out) >> 15);
+      tempVal = 0x7FFF - tempVal;
+      /*      1.15 with exp 1 */
+      out = (q15_t) (((q31_t) out * tempVal) >> 14);
+    }
+
+    /* write output */
+    *dst = out;
+
+    /* return num of signbits of out = 1/in value */
+    return (signBits + 1);
+
+  }
+
+
+  /*
+   * @brief C custom defined intrinisic function for only M0 processors
+   */
+#if defined(ARM_MATH_CM0_FAMILY)
+
+  static __INLINE q31_t __SSAT(
+  q31_t x,
+  uint32_t y)
+  {
+    int32_t posMax, negMin;
+    uint32_t i;
+
+    posMax = 1;
+    for (i = 0; i < (y - 1); i++)
+    {
+      posMax = posMax * 2;
+    }
+
+    if(x > 0)
+    {
+      posMax = (posMax - 1);
+
+      if(x > posMax)
+      {
+        x = posMax;
+      }
+    }
+    else
+    {
+      negMin = -posMax;
+
+      if(x < negMin)
+      {
+        x = negMin;
+      }
+    }
+    return (x);
+
+
+  }
+
+#endif /* end of ARM_MATH_CM0_FAMILY */
+
+
+
+  /*
+   * @brief C custom defined intrinsic function for M3 and M0 processors
+   */
+#if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
+
+  /*
+   * @brief C custom defined QADD8 for M3 and M0 processors
+   */
+  static __INLINE q31_t __QADD8(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum;
+    q7_t r, s, t, u;
+
+    r = (q7_t) x;
+    s = (q7_t) y;
+
+    r = __SSAT((q31_t) (r + s), 8);
+    s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
+    t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
+    u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
+
+    sum =
+      (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
+      (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
+
+    return sum;
+
+  }
+
+  /*
+   * @brief C custom defined QSUB8 for M3 and M0 processors
+   */
+  static __INLINE q31_t __QSUB8(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum;
+    q31_t r, s, t, u;
+
+    r = (q7_t) x;
+    s = (q7_t) y;
+
+    r = __SSAT((r - s), 8);
+    s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
+    t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
+    u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
+
+    sum =
+      (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
+                                                                0x000000FF);
+
+    return sum;
+  }
+
+  /*
+   * @brief C custom defined QADD16 for M3 and M0 processors
+   */
+
+  /*
+   * @brief C custom defined QADD16 for M3 and M0 processors
+   */
+  static __INLINE q31_t __QADD16(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum;
+    q31_t r, s;
+
+    r = (short) x;
+    s = (short) y;
+
+    r = __SSAT(r + s, 16);
+    s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
+
+    sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
+
+    return sum;
+
+  }
+
+  /*
+   * @brief C custom defined SHADD16 for M3 and M0 processors
+   */
+  static __INLINE q31_t __SHADD16(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum;
+    q31_t r, s;
+
+    r = (short) x;
+    s = (short) y;
+
+    r = ((r >> 1) + (s >> 1));
+    s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
+
+    sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
+
+    return sum;
+
+  }
+
+  /*
+   * @brief C custom defined QSUB16 for M3 and M0 processors
+   */
+  static __INLINE q31_t __QSUB16(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum;
+    q31_t r, s;
+
+    r = (short) x;
+    s = (short) y;
+
+    r = __SSAT(r - s, 16);
+    s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
+
+    sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
+
+    return sum;
+  }
+
+  /*
+   * @brief C custom defined SHSUB16 for M3 and M0 processors
+   */
+  static __INLINE q31_t __SHSUB16(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t diff;
+    q31_t r, s;
+
+    r = (short) x;
+    s = (short) y;
+
+    r = ((r >> 1) - (s >> 1));
+    s = (((x >> 17) - (y >> 17)) << 16);
+
+    diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
+
+    return diff;
+  }
+
+  /*
+   * @brief C custom defined QASX for M3 and M0 processors
+   */
+  static __INLINE q31_t __QASX(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum = 0;
+
+    sum =
+      ((sum +
+        clip_q31_to_q15((q31_t) ((short) (x >> 16) + (short) y))) << 16) +
+      clip_q31_to_q15((q31_t) ((short) x - (short) (y >> 16)));
+
+    return sum;
+  }
+
+  /*
+   * @brief C custom defined SHASX for M3 and M0 processors
+   */
+  static __INLINE q31_t __SHASX(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum;
+    q31_t r, s;
+
+    r = (short) x;
+    s = (short) y;
+
+    r = ((r >> 1) - (y >> 17));
+    s = (((x >> 17) + (s >> 1)) << 16);
+
+    sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
+
+    return sum;
+  }
+
+
+  /*
+   * @brief C custom defined QSAX for M3 and M0 processors
+   */
+  static __INLINE q31_t __QSAX(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum = 0;
+
+    sum =
+      ((sum +
+        clip_q31_to_q15((q31_t) ((short) (x >> 16) - (short) y))) << 16) +
+      clip_q31_to_q15((q31_t) ((short) x + (short) (y >> 16)));
+
+    return sum;
+  }
+
+  /*
+   * @brief C custom defined SHSAX for M3 and M0 processors
+   */
+  static __INLINE q31_t __SHSAX(
+  q31_t x,
+  q31_t y)
+  {
+
+    q31_t sum;
+    q31_t r, s;
+
+    r = (short) x;
+    s = (short) y;
+
+    r = ((r >> 1) + (y >> 17));
+    s = (((x >> 17) - (s >> 1)) << 16);
+
+    sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
+
+    return sum;
+  }
+
+  /*
+   * @brief C custom defined SMUSDX for M3 and M0 processors
+   */
+  static __INLINE q31_t __SMUSDX(
+  q31_t x,
+  q31_t y)
+  {
+
+    return ((q31_t) (((short) x * (short) (y >> 16)) -
+                     ((short) (x >> 16) * (short) y)));
+  }
+
+  /*
+   * @brief C custom defined SMUADX for M3 and M0 processors
+   */
+  static __INLINE q31_t __SMUADX(
+  q31_t x,
+  q31_t y)
+  {
+
+    return ((q31_t) (((short) x * (short) (y >> 16)) +
+                     ((short) (x >> 16) * (short) y)));
+  }
+
+  /*
+   * @brief C custom defined QADD for M3 and M0 processors
+   */
+  static __INLINE q31_t __QADD(
+  q31_t x,
+  q31_t y)
+  {
+    return clip_q63_to_q31((q63_t) x + y);
+  }
+
+  /*
+   * @brief C custom defined QSUB for M3 and M0 processors
+   */
+  static __INLINE q31_t __QSUB(
+  q31_t x,
+  q31_t y)
+  {
+    return clip_q63_to_q31((q63_t) x - y);
+  }
+
+  /*
+   * @brief C custom defined SMLAD for M3 and M0 processors
+   */
+  static __INLINE q31_t __SMLAD(
+  q31_t x,
+  q31_t y,
+  q31_t sum)
+  {
+
+    return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
+            ((short) x * (short) y));
+  }
+
+  /*
+   * @brief C custom defined SMLADX for M3 and M0 processors
+   */
+  static __INLINE q31_t __SMLADX(
+  q31_t x,
+  q31_t y,
+  q31_t sum)
+  {
+
+    return (sum + ((short) (x >> 16) * (short) (y)) +
+            ((short) x * (short) (y >> 16)));
+  }
+
+  /*
+   * @brief C custom defined SMLSDX for M3 and M0 processors
+   */
+  static __INLINE q31_t __SMLSDX(
+  q31_t x,
+  q31_t y,
+  q31_t sum)
+  {
+
+    return (sum - ((short) (x >> 16) * (short) (y)) +
+            ((short) x * (short) (y >> 16)));
+  }
+
+  /*
+   * @brief C custom defined SMLALD for M3 and M0 processors
+   */
+  static __INLINE q63_t __SMLALD(
+  q31_t x,
+  q31_t y,
+  q63_t sum)
+  {
+
+    return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
+            ((short) x * (short) y));
+  }
+
+  /*
+   * @brief C custom defined SMLALDX for M3 and M0 processors
+   */
+  static __INLINE q63_t __SMLALDX(
+  q31_t x,
+  q31_t y,
+  q63_t sum)
+  {
+
+    return (sum + ((short) (x >> 16) * (short) y)) +
+      ((short) x * (short) (y >> 16));
+  }
+
+  /*
+   * @brief C custom defined SMUAD for M3 and M0 processors
+   */
+  static __INLINE q31_t __SMUAD(
+  q31_t x,
+  q31_t y)
+  {
+
+    return (((x >> 16) * (y >> 16)) +
+            (((x << 16) >> 16) * ((y << 16) >> 16)));
+  }
+
+  /*
+   * @brief C custom defined SMUSD for M3 and M0 processors
+   */
+  static __INLINE q31_t __SMUSD(
+  q31_t x,
+  q31_t y)
+  {
+
+    return (-((x >> 16) * (y >> 16)) +
+            (((x << 16) >> 16) * ((y << 16) >> 16)));
+  }
+
+
+  /*
+   * @brief C custom defined SXTB16 for M3 and M0 processors
+   */
+  static __INLINE q31_t __SXTB16(
+  q31_t x)
+  {
+
+    return ((((x << 24) >> 24) & 0x0000FFFF) |
+            (((x << 8) >> 8) & 0xFFFF0000));
+  }
+
+
+#endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
+
+
+  /**
+   * @brief Instance structure for the Q7 FIR filter.
+   */
+  typedef struct
+  {
+    uint16_t numTaps;        /**< number of filter coefficients in the filter. */
+    q7_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    q7_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
+  } arm_fir_instance_q7;
+
+  /**
+   * @brief Instance structure for the Q15 FIR filter.
+   */
+  typedef struct
+  {
+    uint16_t numTaps;         /**< number of filter coefficients in the filter. */
+    q15_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    q15_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
+  } arm_fir_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q31 FIR filter.
+   */
+  typedef struct
+  {
+    uint16_t numTaps;         /**< number of filter coefficients in the filter. */
+    q31_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    q31_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps. */
+  } arm_fir_instance_q31;
+
+  /**
+   * @brief Instance structure for the floating-point FIR filter.
+   */
+  typedef struct
+  {
+    uint16_t numTaps;     /**< number of filter coefficients in the filter. */
+    float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
+  } arm_fir_instance_f32;
+
+
+  /**
+   * @brief Processing function for the Q7 FIR filter.
+   * @param[in] *S points to an instance of the Q7 FIR filter structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+  void arm_fir_q7(
+  const arm_fir_instance_q7 * S,
+  q7_t * pSrc,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Initialization function for the Q7 FIR filter.
+   * @param[in,out] *S points to an instance of the Q7 FIR structure.
+   * @param[in] numTaps  Number of filter coefficients in the filter.
+   * @param[in] *pCoeffs points to the filter coefficients.
+   * @param[in] *pState points to the state buffer.
+   * @param[in] blockSize number of samples that are processed.
+   * @return none
+   */
+  void arm_fir_init_q7(
+  arm_fir_instance_q7 * S,
+  uint16_t numTaps,
+  q7_t * pCoeffs,
+  q7_t * pState,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Processing function for the Q15 FIR filter.
+   * @param[in] *S points to an instance of the Q15 FIR structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+  void arm_fir_q15(
+  const arm_fir_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
+   * @param[in] *S points to an instance of the Q15 FIR filter structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+  void arm_fir_fast_q15(
+  const arm_fir_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the Q15 FIR filter.
+   * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
+   * @param[in] numTaps  Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
+   * @param[in] *pCoeffs points to the filter coefficients.
+   * @param[in] *pState points to the state buffer.
+   * @param[in] blockSize number of samples that are processed at a time.
+   * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
+   * <code>numTaps</code> is not a supported value.
+   */
+
+  arm_status arm_fir_init_q15(
+  arm_fir_instance_q15 * S,
+  uint16_t numTaps,
+  q15_t * pCoeffs,
+  q15_t * pState,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q31 FIR filter.
+   * @param[in] *S points to an instance of the Q31 FIR filter structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+  void arm_fir_q31(
+  const arm_fir_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
+   * @param[in] *S points to an instance of the Q31 FIR structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+  void arm_fir_fast_q31(
+  const arm_fir_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the Q31 FIR filter.
+   * @param[in,out] *S points to an instance of the Q31 FIR structure.
+   * @param[in] 	numTaps  Number of filter coefficients in the filter.
+   * @param[in] 	*pCoeffs points to the filter coefficients.
+   * @param[in] 	*pState points to the state buffer.
+   * @param[in] 	blockSize number of samples that are processed at a time.
+   * @return 		none.
+   */
+  void arm_fir_init_q31(
+  arm_fir_instance_q31 * S,
+  uint16_t numTaps,
+  q31_t * pCoeffs,
+  q31_t * pState,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the floating-point FIR filter.
+   * @param[in] *S points to an instance of the floating-point FIR structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+  void arm_fir_f32(
+  const arm_fir_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the floating-point FIR filter.
+   * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
+   * @param[in] 	numTaps  Number of filter coefficients in the filter.
+   * @param[in] 	*pCoeffs points to the filter coefficients.
+   * @param[in] 	*pState points to the state buffer.
+   * @param[in] 	blockSize number of samples that are processed at a time.
+   * @return    	none.
+   */
+  void arm_fir_init_f32(
+  arm_fir_instance_f32 * S,
+  uint16_t numTaps,
+  float32_t * pCoeffs,
+  float32_t * pState,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Instance structure for the Q15 Biquad cascade filter.
+   */
+  typedef struct
+  {
+    int8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
+    q15_t *pState;            /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
+    q15_t *pCoeffs;           /**< Points to the array of coefficients.  The array is of length 5*numStages. */
+    int8_t postShift;         /**< Additional shift, in bits, applied to each output sample. */
+
+  } arm_biquad_casd_df1_inst_q15;
+
+
+  /**
+   * @brief Instance structure for the Q31 Biquad cascade filter.
+   */
+  typedef struct
+  {
+    uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
+    q31_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
+    q31_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */
+    uint8_t postShift;       /**< Additional shift, in bits, applied to each output sample. */
+
+  } arm_biquad_casd_df1_inst_q31;
+
+  /**
+   * @brief Instance structure for the floating-point Biquad cascade filter.
+   */
+  typedef struct
+  {
+    uint32_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
+    float32_t *pState;          /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
+    float32_t *pCoeffs;         /**< Points to the array of coefficients.  The array is of length 5*numStages. */
+
+
+  } arm_biquad_casd_df1_inst_f32;
+
+
+
+  /**
+   * @brief Processing function for the Q15 Biquad cascade filter.
+   * @param[in]  *S points to an instance of the Q15 Biquad cascade structure.
+   * @param[in]  *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in]  blockSize number of samples to process.
+   * @return     none.
+   */
+
+  void arm_biquad_cascade_df1_q15(
+  const arm_biquad_casd_df1_inst_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the Q15 Biquad cascade filter.
+   * @param[in,out] *S           points to an instance of the Q15 Biquad cascade structure.
+   * @param[in]     numStages    number of 2nd order stages in the filter.
+   * @param[in]     *pCoeffs     points to the filter coefficients.
+   * @param[in]     *pState      points to the state buffer.
+   * @param[in]     postShift    Shift to be applied to the output. Varies according to the coefficients format
+   * @return        none
+   */
+
+  void arm_biquad_cascade_df1_init_q15(
+  arm_biquad_casd_df1_inst_q15 * S,
+  uint8_t numStages,
+  q15_t * pCoeffs,
+  q15_t * pState,
+  int8_t postShift);
+
+
+  /**
+   * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
+   * @param[in]  *S points to an instance of the Q15 Biquad cascade structure.
+   * @param[in]  *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in]  blockSize number of samples to process.
+   * @return     none.
+   */
+
+  void arm_biquad_cascade_df1_fast_q15(
+  const arm_biquad_casd_df1_inst_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Processing function for the Q31 Biquad cascade filter
+   * @param[in]  *S         points to an instance of the Q31 Biquad cascade structure.
+   * @param[in]  *pSrc      points to the block of input data.
+   * @param[out] *pDst      points to the block of output data.
+   * @param[in]  blockSize  number of samples to process.
+   * @return     none.
+   */
+
+  void arm_biquad_cascade_df1_q31(
+  const arm_biquad_casd_df1_inst_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
+   * @param[in]  *S         points to an instance of the Q31 Biquad cascade structure.
+   * @param[in]  *pSrc      points to the block of input data.
+   * @param[out] *pDst      points to the block of output data.
+   * @param[in]  blockSize  number of samples to process.
+   * @return     none.
+   */
+
+  void arm_biquad_cascade_df1_fast_q31(
+  const arm_biquad_casd_df1_inst_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the Q31 Biquad cascade filter.
+   * @param[in,out] *S           points to an instance of the Q31 Biquad cascade structure.
+   * @param[in]     numStages      number of 2nd order stages in the filter.
+   * @param[in]     *pCoeffs     points to the filter coefficients.
+   * @param[in]     *pState      points to the state buffer.
+   * @param[in]     postShift    Shift to be applied to the output. Varies according to the coefficients format
+   * @return        none
+   */
+
+  void arm_biquad_cascade_df1_init_q31(
+  arm_biquad_casd_df1_inst_q31 * S,
+  uint8_t numStages,
+  q31_t * pCoeffs,
+  q31_t * pState,
+  int8_t postShift);
+
+  /**
+   * @brief Processing function for the floating-point Biquad cascade filter.
+   * @param[in]  *S         points to an instance of the floating-point Biquad cascade structure.
+   * @param[in]  *pSrc      points to the block of input data.
+   * @param[out] *pDst      points to the block of output data.
+   * @param[in]  blockSize  number of samples to process.
+   * @return     none.
+   */
+
+  void arm_biquad_cascade_df1_f32(
+  const arm_biquad_casd_df1_inst_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the floating-point Biquad cascade filter.
+   * @param[in,out] *S           points to an instance of the floating-point Biquad cascade structure.
+   * @param[in]     numStages    number of 2nd order stages in the filter.
+   * @param[in]     *pCoeffs     points to the filter coefficients.
+   * @param[in]     *pState      points to the state buffer.
+   * @return        none
+   */
+
+  void arm_biquad_cascade_df1_init_f32(
+  arm_biquad_casd_df1_inst_f32 * S,
+  uint8_t numStages,
+  float32_t * pCoeffs,
+  float32_t * pState);
+
+
+  /**
+   * @brief Instance structure for the floating-point matrix structure.
+   */
+
+  typedef struct
+  {
+    uint16_t numRows;     /**< number of rows of the matrix.     */
+    uint16_t numCols;     /**< number of columns of the matrix.  */
+    float32_t *pData;     /**< points to the data of the matrix. */
+  } arm_matrix_instance_f32;
+
+  /**
+   * @brief Instance structure for the Q15 matrix structure.
+   */
+
+  typedef struct
+  {
+    uint16_t numRows;     /**< number of rows of the matrix.     */
+    uint16_t numCols;     /**< number of columns of the matrix.  */
+    q15_t *pData;         /**< points to the data of the matrix. */
+
+  } arm_matrix_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q31 matrix structure.
+   */
+
+  typedef struct
+  {
+    uint16_t numRows;     /**< number of rows of the matrix.     */
+    uint16_t numCols;     /**< number of columns of the matrix.  */
+    q31_t *pData;         /**< points to the data of the matrix. */
+
+  } arm_matrix_instance_q31;
+
+
+
+  /**
+   * @brief Floating-point matrix addition.
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_add_f32(
+  const arm_matrix_instance_f32 * pSrcA,
+  const arm_matrix_instance_f32 * pSrcB,
+  arm_matrix_instance_f32 * pDst);
+
+  /**
+   * @brief Q15 matrix addition.
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_add_q15(
+  const arm_matrix_instance_q15 * pSrcA,
+  const arm_matrix_instance_q15 * pSrcB,
+  arm_matrix_instance_q15 * pDst);
+
+  /**
+   * @brief Q31 matrix addition.
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_add_q31(
+  const arm_matrix_instance_q31 * pSrcA,
+  const arm_matrix_instance_q31 * pSrcB,
+  arm_matrix_instance_q31 * pDst);
+
+
+  /**
+   * @brief Floating-point matrix transpose.
+   * @param[in]  *pSrc points to the input matrix
+   * @param[out] *pDst points to the output matrix
+   * @return 	The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
+   * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_trans_f32(
+  const arm_matrix_instance_f32 * pSrc,
+  arm_matrix_instance_f32 * pDst);
+
+
+  /**
+   * @brief Q15 matrix transpose.
+   * @param[in]  *pSrc points to the input matrix
+   * @param[out] *pDst points to the output matrix
+   * @return 	The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
+   * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_trans_q15(
+  const arm_matrix_instance_q15 * pSrc,
+  arm_matrix_instance_q15 * pDst);
+
+  /**
+   * @brief Q31 matrix transpose.
+   * @param[in]  *pSrc points to the input matrix
+   * @param[out] *pDst points to the output matrix
+   * @return 	The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
+   * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_trans_q31(
+  const arm_matrix_instance_q31 * pSrc,
+  arm_matrix_instance_q31 * pDst);
+
+
+  /**
+   * @brief Floating-point matrix multiplication
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_mult_f32(
+  const arm_matrix_instance_f32 * pSrcA,
+  const arm_matrix_instance_f32 * pSrcB,
+  arm_matrix_instance_f32 * pDst);
+
+  /**
+   * @brief Q15 matrix multiplication
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @param[in]		  *pState points to the array for storing intermediate results
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_mult_q15(
+  const arm_matrix_instance_q15 * pSrcA,
+  const arm_matrix_instance_q15 * pSrcB,
+  arm_matrix_instance_q15 * pDst,
+  q15_t * pState);
+
+  /**
+   * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
+   * @param[in]       *pSrcA  points to the first input matrix structure
+   * @param[in]       *pSrcB  points to the second input matrix structure
+   * @param[out]      *pDst   points to output matrix structure
+   * @param[in]		  *pState points to the array for storing intermediate results
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_mult_fast_q15(
+  const arm_matrix_instance_q15 * pSrcA,
+  const arm_matrix_instance_q15 * pSrcB,
+  arm_matrix_instance_q15 * pDst,
+  q15_t * pState);
+
+  /**
+   * @brief Q31 matrix multiplication
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_mult_q31(
+  const arm_matrix_instance_q31 * pSrcA,
+  const arm_matrix_instance_q31 * pSrcB,
+  arm_matrix_instance_q31 * pDst);
+
+  /**
+   * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_mult_fast_q31(
+  const arm_matrix_instance_q31 * pSrcA,
+  const arm_matrix_instance_q31 * pSrcB,
+  arm_matrix_instance_q31 * pDst);
+
+
+  /**
+   * @brief Floating-point matrix subtraction
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_sub_f32(
+  const arm_matrix_instance_f32 * pSrcA,
+  const arm_matrix_instance_f32 * pSrcB,
+  arm_matrix_instance_f32 * pDst);
+
+  /**
+   * @brief Q15 matrix subtraction
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_sub_q15(
+  const arm_matrix_instance_q15 * pSrcA,
+  const arm_matrix_instance_q15 * pSrcB,
+  arm_matrix_instance_q15 * pDst);
+
+  /**
+   * @brief Q31 matrix subtraction
+   * @param[in]       *pSrcA points to the first input matrix structure
+   * @param[in]       *pSrcB points to the second input matrix structure
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_sub_q31(
+  const arm_matrix_instance_q31 * pSrcA,
+  const arm_matrix_instance_q31 * pSrcB,
+  arm_matrix_instance_q31 * pDst);
+
+  /**
+   * @brief Floating-point matrix scaling.
+   * @param[in]  *pSrc points to the input matrix
+   * @param[in]  scale scale factor
+   * @param[out] *pDst points to the output matrix
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_scale_f32(
+  const arm_matrix_instance_f32 * pSrc,
+  float32_t scale,
+  arm_matrix_instance_f32 * pDst);
+
+  /**
+   * @brief Q15 matrix scaling.
+   * @param[in]       *pSrc points to input matrix
+   * @param[in]       scaleFract fractional portion of the scale factor
+   * @param[in]       shift number of bits to shift the result by
+   * @param[out]      *pDst points to output matrix
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_scale_q15(
+  const arm_matrix_instance_q15 * pSrc,
+  q15_t scaleFract,
+  int32_t shift,
+  arm_matrix_instance_q15 * pDst);
+
+  /**
+   * @brief Q31 matrix scaling.
+   * @param[in]       *pSrc points to input matrix
+   * @param[in]       scaleFract fractional portion of the scale factor
+   * @param[in]       shift number of bits to shift the result by
+   * @param[out]      *pDst points to output matrix structure
+   * @return     The function returns either
+   * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
+   */
+
+  arm_status arm_mat_scale_q31(
+  const arm_matrix_instance_q31 * pSrc,
+  q31_t scaleFract,
+  int32_t shift,
+  arm_matrix_instance_q31 * pDst);
+
+
+  /**
+   * @brief  Q31 matrix initialization.
+   * @param[in,out] *S             points to an instance of the floating-point matrix structure.
+   * @param[in]     nRows          number of rows in the matrix.
+   * @param[in]     nColumns       number of columns in the matrix.
+   * @param[in]     *pData	       points to the matrix data array.
+   * @return        none
+   */
+
+  void arm_mat_init_q31(
+  arm_matrix_instance_q31 * S,
+  uint16_t nRows,
+  uint16_t nColumns,
+  q31_t * pData);
+
+  /**
+   * @brief  Q15 matrix initialization.
+   * @param[in,out] *S             points to an instance of the floating-point matrix structure.
+   * @param[in]     nRows          number of rows in the matrix.
+   * @param[in]     nColumns       number of columns in the matrix.
+   * @param[in]     *pData	       points to the matrix data array.
+   * @return        none
+   */
+
+  void arm_mat_init_q15(
+  arm_matrix_instance_q15 * S,
+  uint16_t nRows,
+  uint16_t nColumns,
+  q15_t * pData);
+
+  /**
+   * @brief  Floating-point matrix initialization.
+   * @param[in,out] *S             points to an instance of the floating-point matrix structure.
+   * @param[in]     nRows          number of rows in the matrix.
+   * @param[in]     nColumns       number of columns in the matrix.
+   * @param[in]     *pData	       points to the matrix data array.
+   * @return        none
+   */
+
+  void arm_mat_init_f32(
+  arm_matrix_instance_f32 * S,
+  uint16_t nRows,
+  uint16_t nColumns,
+  float32_t * pData);
+
+
+
+  /**
+   * @brief Instance structure for the Q15 PID Control.
+   */
+  typedef struct
+  {
+    q15_t A0;    /**< The derived gain, A0 = Kp + Ki + Kd . */
+#ifdef ARM_MATH_CM0_FAMILY
+    q15_t A1;
+    q15_t A2;
+#else
+    q31_t A1;           /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
+#endif
+    q15_t state[3];       /**< The state array of length 3. */
+    q15_t Kp;           /**< The proportional gain. */
+    q15_t Ki;           /**< The integral gain. */
+    q15_t Kd;           /**< The derivative gain. */
+  } arm_pid_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q31 PID Control.
+   */
+  typedef struct
+  {
+    q31_t A0;            /**< The derived gain, A0 = Kp + Ki + Kd . */
+    q31_t A1;            /**< The derived gain, A1 = -Kp - 2Kd. */
+    q31_t A2;            /**< The derived gain, A2 = Kd . */
+    q31_t state[3];      /**< The state array of length 3. */
+    q31_t Kp;            /**< The proportional gain. */
+    q31_t Ki;            /**< The integral gain. */
+    q31_t Kd;            /**< The derivative gain. */
+
+  } arm_pid_instance_q31;
+
+  /**
+   * @brief Instance structure for the floating-point PID Control.
+   */
+  typedef struct
+  {
+    float32_t A0;          /**< The derived gain, A0 = Kp + Ki + Kd . */
+    float32_t A1;          /**< The derived gain, A1 = -Kp - 2Kd. */
+    float32_t A2;          /**< The derived gain, A2 = Kd . */
+    float32_t state[3];    /**< The state array of length 3. */
+    float32_t Kp;               /**< The proportional gain. */
+    float32_t Ki;               /**< The integral gain. */
+    float32_t Kd;               /**< The derivative gain. */
+  } arm_pid_instance_f32;
+
+
+
+  /**
+   * @brief  Initialization function for the floating-point PID Control.
+   * @param[in,out] *S      points to an instance of the PID structure.
+   * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
+   * @return none.
+   */
+  void arm_pid_init_f32(
+  arm_pid_instance_f32 * S,
+  int32_t resetStateFlag);
+
+  /**
+   * @brief  Reset function for the floating-point PID Control.
+   * @param[in,out] *S is an instance of the floating-point PID Control structure
+   * @return none
+   */
+  void arm_pid_reset_f32(
+  arm_pid_instance_f32 * S);
+
+
+  /**
+   * @brief  Initialization function for the Q31 PID Control.
+   * @param[in,out] *S points to an instance of the Q15 PID structure.
+   * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
+   * @return none.
+   */
+  void arm_pid_init_q31(
+  arm_pid_instance_q31 * S,
+  int32_t resetStateFlag);
+
+
+  /**
+   * @brief  Reset function for the Q31 PID Control.
+   * @param[in,out] *S points to an instance of the Q31 PID Control structure
+   * @return none
+   */
+
+  void arm_pid_reset_q31(
+  arm_pid_instance_q31 * S);
+
+  /**
+   * @brief  Initialization function for the Q15 PID Control.
+   * @param[in,out] *S points to an instance of the Q15 PID structure.
+   * @param[in] resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
+   * @return none.
+   */
+  void arm_pid_init_q15(
+  arm_pid_instance_q15 * S,
+  int32_t resetStateFlag);
+
+  /**
+   * @brief  Reset function for the Q15 PID Control.
+   * @param[in,out] *S points to an instance of the q15 PID Control structure
+   * @return none
+   */
+  void arm_pid_reset_q15(
+  arm_pid_instance_q15 * S);
+
+
+  /**
+   * @brief Instance structure for the floating-point Linear Interpolate function.
+   */
+  typedef struct
+  {
+    uint32_t nValues;           /**< nValues */
+    float32_t x1;               /**< x1 */
+    float32_t xSpacing;         /**< xSpacing */
+    float32_t *pYData;          /**< pointer to the table of Y values */
+  } arm_linear_interp_instance_f32;
+
+  /**
+   * @brief Instance structure for the floating-point bilinear interpolation function.
+   */
+
+  typedef struct
+  {
+    uint16_t numRows;   /**< number of rows in the data table. */
+    uint16_t numCols;   /**< number of columns in the data table. */
+    float32_t *pData;   /**< points to the data table. */
+  } arm_bilinear_interp_instance_f32;
+
+   /**
+   * @brief Instance structure for the Q31 bilinear interpolation function.
+   */
+
+  typedef struct
+  {
+    uint16_t numRows;   /**< number of rows in the data table. */
+    uint16_t numCols;   /**< number of columns in the data table. */
+    q31_t *pData;       /**< points to the data table. */
+  } arm_bilinear_interp_instance_q31;
+
+   /**
+   * @brief Instance structure for the Q15 bilinear interpolation function.
+   */
+
+  typedef struct
+  {
+    uint16_t numRows;   /**< number of rows in the data table. */
+    uint16_t numCols;   /**< number of columns in the data table. */
+    q15_t *pData;       /**< points to the data table. */
+  } arm_bilinear_interp_instance_q15;
+
+   /**
+   * @brief Instance structure for the Q15 bilinear interpolation function.
+   */
+
+  typedef struct
+  {
+    uint16_t numRows;   /**< number of rows in the data table. */
+    uint16_t numCols;   /**< number of columns in the data table. */
+    q7_t *pData;                /**< points to the data table. */
+  } arm_bilinear_interp_instance_q7;
+
+
+  /**
+   * @brief Q7 vector multiplication.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst  points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_mult_q7(
+  q7_t * pSrcA,
+  q7_t * pSrcB,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q15 vector multiplication.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst  points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_mult_q15(
+  q15_t * pSrcA,
+  q15_t * pSrcB,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q31 vector multiplication.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_mult_q31(
+  q31_t * pSrcA,
+  q31_t * pSrcB,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Floating-point vector multiplication.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_mult_f32(
+  float32_t * pSrcA,
+  float32_t * pSrcB,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+
+
+
+
+
+  /**
+   * @brief Instance structure for the Q15 CFFT/CIFFT function.
+   */
+
+  typedef struct
+  {
+    uint16_t fftLen;                 /**< length of the FFT. */
+    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+    q15_t *pTwiddle;                     /**< points to the Sin twiddle factor table. */
+    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
+    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+  } arm_cfft_radix2_instance_q15;
+
+  arm_status arm_cfft_radix2_init_q15(
+  arm_cfft_radix2_instance_q15 * S,
+  uint16_t fftLen,
+  uint8_t ifftFlag,
+  uint8_t bitReverseFlag);
+
+  void arm_cfft_radix2_q15(
+  const arm_cfft_radix2_instance_q15 * S,
+  q15_t * pSrc);
+
+
+
+  /**
+   * @brief Instance structure for the Q15 CFFT/CIFFT function.
+   */
+
+  typedef struct
+  {
+    uint16_t fftLen;                 /**< length of the FFT. */
+    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+    q15_t *pTwiddle;                 /**< points to the twiddle factor table. */
+    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
+    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+  } arm_cfft_radix4_instance_q15;
+
+  arm_status arm_cfft_radix4_init_q15(
+  arm_cfft_radix4_instance_q15 * S,
+  uint16_t fftLen,
+  uint8_t ifftFlag,
+  uint8_t bitReverseFlag);
+
+  void arm_cfft_radix4_q15(
+  const arm_cfft_radix4_instance_q15 * S,
+  q15_t * pSrc);
+
+  /**
+   * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
+   */
+
+  typedef struct
+  {
+    uint16_t fftLen;                 /**< length of the FFT. */
+    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+    q31_t *pTwiddle;                     /**< points to the Twiddle factor table. */
+    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
+    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+  } arm_cfft_radix2_instance_q31;
+
+  arm_status arm_cfft_radix2_init_q31(
+  arm_cfft_radix2_instance_q31 * S,
+  uint16_t fftLen,
+  uint8_t ifftFlag,
+  uint8_t bitReverseFlag);
+
+  void arm_cfft_radix2_q31(
+  const arm_cfft_radix2_instance_q31 * S,
+  q31_t * pSrc);
+
+  /**
+   * @brief Instance structure for the Q31 CFFT/CIFFT function.
+   */
+
+  typedef struct
+  {
+    uint16_t fftLen;                 /**< length of the FFT. */
+    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+    q31_t *pTwiddle;                 /**< points to the twiddle factor table. */
+    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
+    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+  } arm_cfft_radix4_instance_q31;
+
+
+  void arm_cfft_radix4_q31(
+  const arm_cfft_radix4_instance_q31 * S,
+  q31_t * pSrc);
+
+  arm_status arm_cfft_radix4_init_q31(
+  arm_cfft_radix4_instance_q31 * S,
+  uint16_t fftLen,
+  uint8_t ifftFlag,
+  uint8_t bitReverseFlag);
+
+  /**
+   * @brief Instance structure for the floating-point CFFT/CIFFT function.
+   */
+
+  typedef struct
+  {
+    uint16_t fftLen;                   /**< length of the FFT. */
+    uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+    uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+    float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
+    uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
+    uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+    float32_t onebyfftLen;                 /**< value of 1/fftLen. */
+  } arm_cfft_radix2_instance_f32;
+
+/* Deprecated */
+  arm_status arm_cfft_radix2_init_f32(
+  arm_cfft_radix2_instance_f32 * S,
+  uint16_t fftLen,
+  uint8_t ifftFlag,
+  uint8_t bitReverseFlag);
+
+/* Deprecated */
+  void arm_cfft_radix2_f32(
+  const arm_cfft_radix2_instance_f32 * S,
+  float32_t * pSrc);
+
+  /**
+   * @brief Instance structure for the floating-point CFFT/CIFFT function.
+   */
+
+  typedef struct
+  {
+    uint16_t fftLen;                   /**< length of the FFT. */
+    uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+    uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+    float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
+    uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
+    uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+    float32_t onebyfftLen;                 /**< value of 1/fftLen. */
+  } arm_cfft_radix4_instance_f32;
+
+/* Deprecated */
+  arm_status arm_cfft_radix4_init_f32(
+  arm_cfft_radix4_instance_f32 * S,
+  uint16_t fftLen,
+  uint8_t ifftFlag,
+  uint8_t bitReverseFlag);
+
+/* Deprecated */
+  void arm_cfft_radix4_f32(
+  const arm_cfft_radix4_instance_f32 * S,
+  float32_t * pSrc);
+
+  /**
+   * @brief Instance structure for the floating-point CFFT/CIFFT function.
+   */
+
+  typedef struct
+  {
+    uint16_t fftLen;                   /**< length of the FFT. */
+    const float32_t *pTwiddle;         /**< points to the Twiddle factor table. */
+    const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
+    uint16_t bitRevLength;             /**< bit reversal table length. */
+  } arm_cfft_instance_f32;
+
+  void arm_cfft_f32(
+  const arm_cfft_instance_f32 * S,
+  float32_t * p1,
+  uint8_t ifftFlag,
+  uint8_t bitReverseFlag);
+
+  /**
+   * @brief Instance structure for the Q15 RFFT/RIFFT function.
+   */
+
+  typedef struct
+  {
+    uint32_t fftLenReal;                      /**< length of the real FFT. */
+    uint32_t fftLenBy2;                       /**< length of the complex FFT. */
+    uint8_t ifftFlagR;                        /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
+    uint8_t bitReverseFlagR;                      /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
+    uint32_t twidCoefRModifier;               /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    q15_t *pTwiddleAReal;                     /**< points to the real twiddle factor table. */
+    q15_t *pTwiddleBReal;                     /**< points to the imag twiddle factor table. */
+    arm_cfft_radix4_instance_q15 *pCfft;          /**< points to the complex FFT instance. */
+  } arm_rfft_instance_q15;
+
+  arm_status arm_rfft_init_q15(
+  arm_rfft_instance_q15 * S,
+  arm_cfft_radix4_instance_q15 * S_CFFT,
+  uint32_t fftLenReal,
+  uint32_t ifftFlagR,
+  uint32_t bitReverseFlag);
+
+  void arm_rfft_q15(
+  const arm_rfft_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst);
+
+  /**
+   * @brief Instance structure for the Q31 RFFT/RIFFT function.
+   */
+
+  typedef struct
+  {
+    uint32_t fftLenReal;                        /**< length of the real FFT. */
+    uint32_t fftLenBy2;                         /**< length of the complex FFT. */
+    uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
+    uint8_t bitReverseFlagR;                        /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
+    uint32_t twidCoefRModifier;                 /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    q31_t *pTwiddleAReal;                       /**< points to the real twiddle factor table. */
+    q31_t *pTwiddleBReal;                       /**< points to the imag twiddle factor table. */
+    arm_cfft_radix4_instance_q31 *pCfft;        /**< points to the complex FFT instance. */
+  } arm_rfft_instance_q31;
+
+  arm_status arm_rfft_init_q31(
+  arm_rfft_instance_q31 * S,
+  arm_cfft_radix4_instance_q31 * S_CFFT,
+  uint32_t fftLenReal,
+  uint32_t ifftFlagR,
+  uint32_t bitReverseFlag);
+
+  void arm_rfft_q31(
+  const arm_rfft_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst);
+
+  /**
+   * @brief Instance structure for the floating-point RFFT/RIFFT function.
+   */
+
+  typedef struct
+  {
+    uint32_t fftLenReal;                        /**< length of the real FFT. */
+    uint16_t fftLenBy2;                         /**< length of the complex FFT. */
+    uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
+    uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
+    uint32_t twidCoefRModifier;                     /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+    float32_t *pTwiddleAReal;                   /**< points to the real twiddle factor table. */
+    float32_t *pTwiddleBReal;                   /**< points to the imag twiddle factor table. */
+    arm_cfft_radix4_instance_f32 *pCfft;        /**< points to the complex FFT instance. */
+  } arm_rfft_instance_f32;
+
+  arm_status arm_rfft_init_f32(
+  arm_rfft_instance_f32 * S,
+  arm_cfft_radix4_instance_f32 * S_CFFT,
+  uint32_t fftLenReal,
+  uint32_t ifftFlagR,
+  uint32_t bitReverseFlag);
+
+  void arm_rfft_f32(
+  const arm_rfft_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst);
+
+  /**
+   * @brief Instance structure for the floating-point RFFT/RIFFT function.
+   */
+
+typedef struct
+  {
+    arm_cfft_instance_f32 Sint;      /**< Internal CFFT structure. */
+    uint16_t fftLenRFFT;                        /**< length of the real sequence */
+	float32_t * pTwiddleRFFT;					/**< Twiddle factors real stage  */
+  } arm_rfft_fast_instance_f32 ;
+
+arm_status arm_rfft_fast_init_f32 (
+	arm_rfft_fast_instance_f32 * S,
+	uint16_t fftLen);
+
+void arm_rfft_fast_f32(
+  arm_rfft_fast_instance_f32 * S,
+  float32_t * p, float32_t * pOut,
+  uint8_t ifftFlag);
+
+  /**
+   * @brief Instance structure for the floating-point DCT4/IDCT4 function.
+   */
+
+  typedef struct
+  {
+    uint16_t N;                         /**< length of the DCT4. */
+    uint16_t Nby2;                      /**< half of the length of the DCT4. */
+    float32_t normalize;                /**< normalizing factor. */
+    float32_t *pTwiddle;                /**< points to the twiddle factor table. */
+    float32_t *pCosFactor;              /**< points to the cosFactor table. */
+    arm_rfft_instance_f32 *pRfft;        /**< points to the real FFT instance. */
+    arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
+  } arm_dct4_instance_f32;
+
+  /**
+   * @brief  Initialization function for the floating-point DCT4/IDCT4.
+   * @param[in,out] *S         points to an instance of floating-point DCT4/IDCT4 structure.
+   * @param[in]     *S_RFFT    points to an instance of floating-point RFFT/RIFFT structure.
+   * @param[in]     *S_CFFT    points to an instance of floating-point CFFT/CIFFT structure.
+   * @param[in]     N          length of the DCT4.
+   * @param[in]     Nby2       half of the length of the DCT4.
+   * @param[in]     normalize  normalizing factor.
+   * @return		arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.
+   */
+
+  arm_status arm_dct4_init_f32(
+  arm_dct4_instance_f32 * S,
+  arm_rfft_instance_f32 * S_RFFT,
+  arm_cfft_radix4_instance_f32 * S_CFFT,
+  uint16_t N,
+  uint16_t Nby2,
+  float32_t normalize);
+
+  /**
+   * @brief Processing function for the floating-point DCT4/IDCT4.
+   * @param[in]       *S             points to an instance of the floating-point DCT4/IDCT4 structure.
+   * @param[in]       *pState        points to state buffer.
+   * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.
+   * @return none.
+   */
+
+  void arm_dct4_f32(
+  const arm_dct4_instance_f32 * S,
+  float32_t * pState,
+  float32_t * pInlineBuffer);
+
+  /**
+   * @brief Instance structure for the Q31 DCT4/IDCT4 function.
+   */
+
+  typedef struct
+  {
+    uint16_t N;                         /**< length of the DCT4. */
+    uint16_t Nby2;                      /**< half of the length of the DCT4. */
+    q31_t normalize;                    /**< normalizing factor. */
+    q31_t *pTwiddle;                    /**< points to the twiddle factor table. */
+    q31_t *pCosFactor;                  /**< points to the cosFactor table. */
+    arm_rfft_instance_q31 *pRfft;        /**< points to the real FFT instance. */
+    arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
+  } arm_dct4_instance_q31;
+
+  /**
+   * @brief  Initialization function for the Q31 DCT4/IDCT4.
+   * @param[in,out] *S         points to an instance of Q31 DCT4/IDCT4 structure.
+   * @param[in]     *S_RFFT    points to an instance of Q31 RFFT/RIFFT structure
+   * @param[in]     *S_CFFT    points to an instance of Q31 CFFT/CIFFT structure
+   * @param[in]     N          length of the DCT4.
+   * @param[in]     Nby2       half of the length of the DCT4.
+   * @param[in]     normalize  normalizing factor.
+   * @return		arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
+   */
+
+  arm_status arm_dct4_init_q31(
+  arm_dct4_instance_q31 * S,
+  arm_rfft_instance_q31 * S_RFFT,
+  arm_cfft_radix4_instance_q31 * S_CFFT,
+  uint16_t N,
+  uint16_t Nby2,
+  q31_t normalize);
+
+  /**
+   * @brief Processing function for the Q31 DCT4/IDCT4.
+   * @param[in]       *S             points to an instance of the Q31 DCT4 structure.
+   * @param[in]       *pState        points to state buffer.
+   * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.
+   * @return none.
+   */
+
+  void arm_dct4_q31(
+  const arm_dct4_instance_q31 * S,
+  q31_t * pState,
+  q31_t * pInlineBuffer);
+
+  /**
+   * @brief Instance structure for the Q15 DCT4/IDCT4 function.
+   */
+
+  typedef struct
+  {
+    uint16_t N;                         /**< length of the DCT4. */
+    uint16_t Nby2;                      /**< half of the length of the DCT4. */
+    q15_t normalize;                    /**< normalizing factor. */
+    q15_t *pTwiddle;                    /**< points to the twiddle factor table. */
+    q15_t *pCosFactor;                  /**< points to the cosFactor table. */
+    arm_rfft_instance_q15 *pRfft;        /**< points to the real FFT instance. */
+    arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
+  } arm_dct4_instance_q15;
+
+  /**
+   * @brief  Initialization function for the Q15 DCT4/IDCT4.
+   * @param[in,out] *S         points to an instance of Q15 DCT4/IDCT4 structure.
+   * @param[in]     *S_RFFT    points to an instance of Q15 RFFT/RIFFT structure.
+   * @param[in]     *S_CFFT    points to an instance of Q15 CFFT/CIFFT structure.
+   * @param[in]     N          length of the DCT4.
+   * @param[in]     Nby2       half of the length of the DCT4.
+   * @param[in]     normalize  normalizing factor.
+   * @return		arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
+   */
+
+  arm_status arm_dct4_init_q15(
+  arm_dct4_instance_q15 * S,
+  arm_rfft_instance_q15 * S_RFFT,
+  arm_cfft_radix4_instance_q15 * S_CFFT,
+  uint16_t N,
+  uint16_t Nby2,
+  q15_t normalize);
+
+  /**
+   * @brief Processing function for the Q15 DCT4/IDCT4.
+   * @param[in]       *S             points to an instance of the Q15 DCT4 structure.
+   * @param[in]       *pState        points to state buffer.
+   * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.
+   * @return none.
+   */
+
+  void arm_dct4_q15(
+  const arm_dct4_instance_q15 * S,
+  q15_t * pState,
+  q15_t * pInlineBuffer);
+
+  /**
+   * @brief Floating-point vector addition.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_add_f32(
+  float32_t * pSrcA,
+  float32_t * pSrcB,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q7 vector addition.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_add_q7(
+  q7_t * pSrcA,
+  q7_t * pSrcB,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q15 vector addition.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_add_q15(
+  q15_t * pSrcA,
+  q15_t * pSrcB,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q31 vector addition.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_add_q31(
+  q31_t * pSrcA,
+  q31_t * pSrcB,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Floating-point vector subtraction.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_sub_f32(
+  float32_t * pSrcA,
+  float32_t * pSrcB,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q7 vector subtraction.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_sub_q7(
+  q7_t * pSrcA,
+  q7_t * pSrcB,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q15 vector subtraction.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_sub_q15(
+  q15_t * pSrcA,
+  q15_t * pSrcB,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q31 vector subtraction.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_sub_q31(
+  q31_t * pSrcA,
+  q31_t * pSrcB,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Multiplies a floating-point vector by a scalar.
+   * @param[in]       *pSrc points to the input vector
+   * @param[in]       scale scale factor to be applied
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_scale_f32(
+  float32_t * pSrc,
+  float32_t scale,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Multiplies a Q7 vector by a scalar.
+   * @param[in]       *pSrc points to the input vector
+   * @param[in]       scaleFract fractional portion of the scale value
+   * @param[in]       shift number of bits to shift the result by
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_scale_q7(
+  q7_t * pSrc,
+  q7_t scaleFract,
+  int8_t shift,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Multiplies a Q15 vector by a scalar.
+   * @param[in]       *pSrc points to the input vector
+   * @param[in]       scaleFract fractional portion of the scale value
+   * @param[in]       shift number of bits to shift the result by
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_scale_q15(
+  q15_t * pSrc,
+  q15_t scaleFract,
+  int8_t shift,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Multiplies a Q31 vector by a scalar.
+   * @param[in]       *pSrc points to the input vector
+   * @param[in]       scaleFract fractional portion of the scale value
+   * @param[in]       shift number of bits to shift the result by
+   * @param[out]      *pDst points to the output vector
+   * @param[in]       blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_scale_q31(
+  q31_t * pSrc,
+  q31_t scaleFract,
+  int8_t shift,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q7 vector absolute value.
+   * @param[in]       *pSrc points to the input buffer
+   * @param[out]      *pDst points to the output buffer
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_abs_q7(
+  q7_t * pSrc,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Floating-point vector absolute value.
+   * @param[in]       *pSrc points to the input buffer
+   * @param[out]      *pDst points to the output buffer
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_abs_f32(
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q15 vector absolute value.
+   * @param[in]       *pSrc points to the input buffer
+   * @param[out]      *pDst points to the output buffer
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_abs_q15(
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Q31 vector absolute value.
+   * @param[in]       *pSrc points to the input buffer
+   * @param[out]      *pDst points to the output buffer
+   * @param[in]       blockSize number of samples in each vector
+   * @return none.
+   */
+
+  void arm_abs_q31(
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Dot product of floating-point vectors.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[in]       blockSize number of samples in each vector
+   * @param[out]      *result output result returned here
+   * @return none.
+   */
+
+  void arm_dot_prod_f32(
+  float32_t * pSrcA,
+  float32_t * pSrcB,
+  uint32_t blockSize,
+  float32_t * result);
+
+  /**
+   * @brief Dot product of Q7 vectors.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[in]       blockSize number of samples in each vector
+   * @param[out]      *result output result returned here
+   * @return none.
+   */
+
+  void arm_dot_prod_q7(
+  q7_t * pSrcA,
+  q7_t * pSrcB,
+  uint32_t blockSize,
+  q31_t * result);
+
+  /**
+   * @brief Dot product of Q15 vectors.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[in]       blockSize number of samples in each vector
+   * @param[out]      *result output result returned here
+   * @return none.
+   */
+
+  void arm_dot_prod_q15(
+  q15_t * pSrcA,
+  q15_t * pSrcB,
+  uint32_t blockSize,
+  q63_t * result);
+
+  /**
+   * @brief Dot product of Q31 vectors.
+   * @param[in]       *pSrcA points to the first input vector
+   * @param[in]       *pSrcB points to the second input vector
+   * @param[in]       blockSize number of samples in each vector
+   * @param[out]      *result output result returned here
+   * @return none.
+   */
+
+  void arm_dot_prod_q31(
+  q31_t * pSrcA,
+  q31_t * pSrcB,
+  uint32_t blockSize,
+  q63_t * result);
+
+  /**
+   * @brief  Shifts the elements of a Q7 vector a specified number of bits.
+   * @param[in]  *pSrc points to the input vector
+   * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_shift_q7(
+  q7_t * pSrc,
+  int8_t shiftBits,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Shifts the elements of a Q15 vector a specified number of bits.
+   * @param[in]  *pSrc points to the input vector
+   * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_shift_q15(
+  q15_t * pSrc,
+  int8_t shiftBits,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Shifts the elements of a Q31 vector a specified number of bits.
+   * @param[in]  *pSrc points to the input vector
+   * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_shift_q31(
+  q31_t * pSrc,
+  int8_t shiftBits,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Adds a constant offset to a floating-point vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[in]  offset is the offset to be added
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_offset_f32(
+  float32_t * pSrc,
+  float32_t offset,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Adds a constant offset to a Q7 vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[in]  offset is the offset to be added
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_offset_q7(
+  q7_t * pSrc,
+  q7_t offset,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Adds a constant offset to a Q15 vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[in]  offset is the offset to be added
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_offset_q15(
+  q15_t * pSrc,
+  q15_t offset,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Adds a constant offset to a Q31 vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[in]  offset is the offset to be added
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_offset_q31(
+  q31_t * pSrc,
+  q31_t offset,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Negates the elements of a floating-point vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_negate_f32(
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Negates the elements of a Q7 vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_negate_q7(
+  q7_t * pSrc,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Negates the elements of a Q15 vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_negate_q15(
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Negates the elements of a Q31 vector.
+   * @param[in]  *pSrc points to the input vector
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  blockSize number of samples in the vector
+   * @return none.
+   */
+
+  void arm_negate_q31(
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+  /**
+   * @brief  Copies the elements of a floating-point vector.
+   * @param[in]  *pSrc input pointer
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_copy_f32(
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Copies the elements of a Q7 vector.
+   * @param[in]  *pSrc input pointer
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_copy_q7(
+  q7_t * pSrc,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Copies the elements of a Q15 vector.
+   * @param[in]  *pSrc input pointer
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_copy_q15(
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Copies the elements of a Q31 vector.
+   * @param[in]  *pSrc input pointer
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_copy_q31(
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+  /**
+   * @brief  Fills a constant value into a floating-point vector.
+   * @param[in]  value input value to be filled
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_fill_f32(
+  float32_t value,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Fills a constant value into a Q7 vector.
+   * @param[in]  value input value to be filled
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_fill_q7(
+  q7_t value,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Fills a constant value into a Q15 vector.
+   * @param[in]  value input value to be filled
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_fill_q15(
+  q15_t value,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Fills a constant value into a Q31 vector.
+   * @param[in]  value input value to be filled
+   * @param[out]  *pDst output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_fill_q31(
+  q31_t value,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+/**
+ * @brief Convolution of floating-point sequences.
+ * @param[in] *pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] *pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] *pDst points to the location where the output result is written.  Length srcALen+srcBLen-1.
+ * @return none.
+ */
+
+  void arm_conv_f32(
+  float32_t * pSrcA,
+  uint32_t srcALen,
+  float32_t * pSrcB,
+  uint32_t srcBLen,
+  float32_t * pDst);
+
+
+  /**
+   * @brief Convolution of Q15 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
+   * @param[in]  *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @param[in]  *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+   * @return none.
+   */
+
+
+  void arm_conv_opt_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst,
+  q15_t * pScratch1,
+  q15_t * pScratch2);
+
+
+/**
+ * @brief Convolution of Q15 sequences.
+ * @param[in] *pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] *pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] *pDst points to the location where the output result is written.  Length srcALen+srcBLen-1.
+ * @return none.
+ */
+
+  void arm_conv_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst);
+
+  /**
+   * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
+   * @return none.
+   */
+
+  void arm_conv_fast_q15(
+			  q15_t * pSrcA,
+			 uint32_t srcALen,
+			  q15_t * pSrcB,
+			 uint32_t srcBLen,
+			 q15_t * pDst);
+
+  /**
+   * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
+   * @param[in]  *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @param[in]  *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+   * @return none.
+   */
+
+  void arm_conv_fast_opt_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst,
+  q15_t * pScratch1,
+  q15_t * pScratch2);
+
+
+
+  /**
+   * @brief Convolution of Q31 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
+   * @return none.
+   */
+
+  void arm_conv_q31(
+  q31_t * pSrcA,
+  uint32_t srcALen,
+  q31_t * pSrcB,
+  uint32_t srcBLen,
+  q31_t * pDst);
+
+  /**
+   * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
+   * @return none.
+   */
+
+  void arm_conv_fast_q31(
+  q31_t * pSrcA,
+  uint32_t srcALen,
+  q31_t * pSrcB,
+  uint32_t srcBLen,
+  q31_t * pDst);
+
+
+    /**
+   * @brief Convolution of Q7 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
+   * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
+   * @return none.
+   */
+
+  void arm_conv_opt_q7(
+  q7_t * pSrcA,
+  uint32_t srcALen,
+  q7_t * pSrcB,
+  uint32_t srcBLen,
+  q7_t * pDst,
+  q15_t * pScratch1,
+  q15_t * pScratch2);
+
+
+
+  /**
+   * @brief Convolution of Q7 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
+   * @return none.
+   */
+
+  void arm_conv_q7(
+  q7_t * pSrcA,
+  uint32_t srcALen,
+  q7_t * pSrcB,
+  uint32_t srcBLen,
+  q7_t * pDst);
+
+
+  /**
+   * @brief Partial convolution of floating-point sequences.
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_f32(
+  float32_t * pSrcA,
+  uint32_t srcALen,
+  float32_t * pSrcB,
+  uint32_t srcBLen,
+  float32_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints);
+
+    /**
+   * @brief Partial convolution of Q15 sequences.
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @param[in]       * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @param[in]       * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_opt_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints,
+  q15_t * pScratch1,
+  q15_t * pScratch2);
+
+
+/**
+   * @brief Partial convolution of Q15 sequences.
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints);
+
+  /**
+   * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_fast_q15(
+				        q15_t * pSrcA,
+				       uint32_t srcALen,
+				        q15_t * pSrcB,
+				       uint32_t srcBLen,
+				       q15_t * pDst,
+				       uint32_t firstIndex,
+				       uint32_t numPoints);
+
+
+  /**
+   * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @param[in]       * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @param[in]       * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_fast_opt_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints,
+  q15_t * pScratch1,
+  q15_t * pScratch2);
+
+
+  /**
+   * @brief Partial convolution of Q31 sequences.
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_q31(
+  q31_t * pSrcA,
+  uint32_t srcALen,
+  q31_t * pSrcB,
+  uint32_t srcBLen,
+  q31_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints);
+
+
+  /**
+   * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_fast_q31(
+  q31_t * pSrcA,
+  uint32_t srcALen,
+  q31_t * pSrcB,
+  uint32_t srcBLen,
+  q31_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints);
+
+
+  /**
+   * @brief Partial convolution of Q7 sequences
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_opt_q7(
+  q7_t * pSrcA,
+  uint32_t srcALen,
+  q7_t * pSrcB,
+  uint32_t srcBLen,
+  q7_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints,
+  q15_t * pScratch1,
+  q15_t * pScratch2);
+
+
+/**
+   * @brief Partial convolution of Q7 sequences.
+   * @param[in]       *pSrcA points to the first input sequence.
+   * @param[in]       srcALen length of the first input sequence.
+   * @param[in]       *pSrcB points to the second input sequence.
+   * @param[in]       srcBLen length of the second input sequence.
+   * @param[out]      *pDst points to the block of output data
+   * @param[in]       firstIndex is the first output sample to start with.
+   * @param[in]       numPoints is the number of output points to be computed.
+   * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+   */
+
+  arm_status arm_conv_partial_q7(
+  q7_t * pSrcA,
+  uint32_t srcALen,
+  q7_t * pSrcB,
+  uint32_t srcBLen,
+  q7_t * pDst,
+  uint32_t firstIndex,
+  uint32_t numPoints);
+
+
+
+  /**
+   * @brief Instance structure for the Q15 FIR decimator.
+   */
+
+  typedef struct
+  {
+    uint8_t M;                      /**< decimation factor. */
+    uint16_t numTaps;               /**< number of coefficients in the filter. */
+    q15_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numTaps.*/
+    q15_t *pState;                   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+  } arm_fir_decimate_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q31 FIR decimator.
+   */
+
+  typedef struct
+  {
+    uint8_t M;                  /**< decimation factor. */
+    uint16_t numTaps;           /**< number of coefficients in the filter. */
+    q31_t *pCoeffs;              /**< points to the coefficient array. The array is of length numTaps.*/
+    q31_t *pState;               /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+
+  } arm_fir_decimate_instance_q31;
+
+  /**
+   * @brief Instance structure for the floating-point FIR decimator.
+   */
+
+  typedef struct
+  {
+    uint8_t M;                          /**< decimation factor. */
+    uint16_t numTaps;                   /**< number of coefficients in the filter. */
+    float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numTaps.*/
+    float32_t *pState;                   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+
+  } arm_fir_decimate_instance_f32;
+
+
+
+  /**
+   * @brief Processing function for the floating-point FIR decimator.
+   * @param[in] *S points to an instance of the floating-point FIR decimator structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none
+   */
+
+  void arm_fir_decimate_f32(
+  const arm_fir_decimate_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Initialization function for the floating-point FIR decimator.
+   * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
+   * @param[in] numTaps  number of coefficients in the filter.
+   * @param[in] M  decimation factor.
+   * @param[in] *pCoeffs points to the filter coefficients.
+   * @param[in] *pState points to the state buffer.
+   * @param[in] blockSize number of input samples to process per call.
+   * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+   * <code>blockSize</code> is not a multiple of <code>M</code>.
+   */
+
+  arm_status arm_fir_decimate_init_f32(
+  arm_fir_decimate_instance_f32 * S,
+  uint16_t numTaps,
+  uint8_t M,
+  float32_t * pCoeffs,
+  float32_t * pState,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q15 FIR decimator.
+   * @param[in] *S points to an instance of the Q15 FIR decimator structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none
+   */
+
+  void arm_fir_decimate_q15(
+  const arm_fir_decimate_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
+   * @param[in] *S points to an instance of the Q15 FIR decimator structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none
+   */
+
+  void arm_fir_decimate_fast_q15(
+  const arm_fir_decimate_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+
+
+  /**
+   * @brief  Initialization function for the Q15 FIR decimator.
+   * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
+   * @param[in] numTaps  number of coefficients in the filter.
+   * @param[in] M  decimation factor.
+   * @param[in] *pCoeffs points to the filter coefficients.
+   * @param[in] *pState points to the state buffer.
+   * @param[in] blockSize number of input samples to process per call.
+   * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+   * <code>blockSize</code> is not a multiple of <code>M</code>.
+   */
+
+  arm_status arm_fir_decimate_init_q15(
+  arm_fir_decimate_instance_q15 * S,
+  uint16_t numTaps,
+  uint8_t M,
+  q15_t * pCoeffs,
+  q15_t * pState,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q31 FIR decimator.
+   * @param[in] *S points to an instance of the Q31 FIR decimator structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none
+   */
+
+  void arm_fir_decimate_q31(
+  const arm_fir_decimate_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
+   * @param[in] *S points to an instance of the Q31 FIR decimator structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none
+   */
+
+  void arm_fir_decimate_fast_q31(
+  arm_fir_decimate_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Initialization function for the Q31 FIR decimator.
+   * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
+   * @param[in] numTaps  number of coefficients in the filter.
+   * @param[in] M  decimation factor.
+   * @param[in] *pCoeffs points to the filter coefficients.
+   * @param[in] *pState points to the state buffer.
+   * @param[in] blockSize number of input samples to process per call.
+   * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+   * <code>blockSize</code> is not a multiple of <code>M</code>.
+   */
+
+  arm_status arm_fir_decimate_init_q31(
+  arm_fir_decimate_instance_q31 * S,
+  uint16_t numTaps,
+  uint8_t M,
+  q31_t * pCoeffs,
+  q31_t * pState,
+  uint32_t blockSize);
+
+
+
+  /**
+   * @brief Instance structure for the Q15 FIR interpolator.
+   */
+
+  typedef struct
+  {
+    uint8_t L;                      /**< upsample factor. */
+    uint16_t phaseLength;           /**< length of each polyphase filter component. */
+    q15_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */
+    q15_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
+  } arm_fir_interpolate_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q31 FIR interpolator.
+   */
+
+  typedef struct
+  {
+    uint8_t L;                      /**< upsample factor. */
+    uint16_t phaseLength;           /**< length of each polyphase filter component. */
+    q31_t *pCoeffs;                  /**< points to the coefficient array. The array is of length L*phaseLength. */
+    q31_t *pState;                   /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
+  } arm_fir_interpolate_instance_q31;
+
+  /**
+   * @brief Instance structure for the floating-point FIR interpolator.
+   */
+
+  typedef struct
+  {
+    uint8_t L;                     /**< upsample factor. */
+    uint16_t phaseLength;          /**< length of each polyphase filter component. */
+    float32_t *pCoeffs;             /**< points to the coefficient array. The array is of length L*phaseLength. */
+    float32_t *pState;              /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
+  } arm_fir_interpolate_instance_f32;
+
+
+  /**
+   * @brief Processing function for the Q15 FIR interpolator.
+   * @param[in] *S        points to an instance of the Q15 FIR interpolator structure.
+   * @param[in] *pSrc     points to the block of input data.
+   * @param[out] *pDst    points to the block of output data.
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none.
+   */
+
+  void arm_fir_interpolate_q15(
+  const arm_fir_interpolate_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Initialization function for the Q15 FIR interpolator.
+   * @param[in,out] *S        points to an instance of the Q15 FIR interpolator structure.
+   * @param[in]     L         upsample factor.
+   * @param[in]     numTaps   number of filter coefficients in the filter.
+   * @param[in]     *pCoeffs  points to the filter coefficient buffer.
+   * @param[in]     *pState   points to the state buffer.
+   * @param[in]     blockSize number of input samples to process per call.
+   * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+   * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
+   */
+
+  arm_status arm_fir_interpolate_init_q15(
+  arm_fir_interpolate_instance_q15 * S,
+  uint8_t L,
+  uint16_t numTaps,
+  q15_t * pCoeffs,
+  q15_t * pState,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q31 FIR interpolator.
+   * @param[in] *S        points to an instance of the Q15 FIR interpolator structure.
+   * @param[in] *pSrc     points to the block of input data.
+   * @param[out] *pDst    points to the block of output data.
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none.
+   */
+
+  void arm_fir_interpolate_q31(
+  const arm_fir_interpolate_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the Q31 FIR interpolator.
+   * @param[in,out] *S        points to an instance of the Q31 FIR interpolator structure.
+   * @param[in]     L         upsample factor.
+   * @param[in]     numTaps   number of filter coefficients in the filter.
+   * @param[in]     *pCoeffs  points to the filter coefficient buffer.
+   * @param[in]     *pState   points to the state buffer.
+   * @param[in]     blockSize number of input samples to process per call.
+   * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+   * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
+   */
+
+  arm_status arm_fir_interpolate_init_q31(
+  arm_fir_interpolate_instance_q31 * S,
+  uint8_t L,
+  uint16_t numTaps,
+  q31_t * pCoeffs,
+  q31_t * pState,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Processing function for the floating-point FIR interpolator.
+   * @param[in] *S        points to an instance of the floating-point FIR interpolator structure.
+   * @param[in] *pSrc     points to the block of input data.
+   * @param[out] *pDst    points to the block of output data.
+   * @param[in] blockSize number of input samples to process per call.
+   * @return none.
+   */
+
+  void arm_fir_interpolate_f32(
+  const arm_fir_interpolate_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the floating-point FIR interpolator.
+   * @param[in,out] *S        points to an instance of the floating-point FIR interpolator structure.
+   * @param[in]     L         upsample factor.
+   * @param[in]     numTaps   number of filter coefficients in the filter.
+   * @param[in]     *pCoeffs  points to the filter coefficient buffer.
+   * @param[in]     *pState   points to the state buffer.
+   * @param[in]     blockSize number of input samples to process per call.
+   * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+   * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
+   */
+
+  arm_status arm_fir_interpolate_init_f32(
+  arm_fir_interpolate_instance_f32 * S,
+  uint8_t L,
+  uint16_t numTaps,
+  float32_t * pCoeffs,
+  float32_t * pState,
+  uint32_t blockSize);
+
+  /**
+   * @brief Instance structure for the high precision Q31 Biquad cascade filter.
+   */
+
+  typedef struct
+  {
+    uint8_t numStages;       /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
+    q63_t *pState;           /**< points to the array of state coefficients.  The array is of length 4*numStages. */
+    q31_t *pCoeffs;          /**< points to the array of coefficients.  The array is of length 5*numStages. */
+    uint8_t postShift;       /**< additional shift, in bits, applied to each output sample. */
+
+  } arm_biquad_cas_df1_32x64_ins_q31;
+
+
+  /**
+   * @param[in]  *S        points to an instance of the high precision Q31 Biquad cascade filter structure.
+   * @param[in]  *pSrc     points to the block of input data.
+   * @param[out] *pDst     points to the block of output data
+   * @param[in]  blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_biquad_cas_df1_32x64_q31(
+  const arm_biquad_cas_df1_32x64_ins_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @param[in,out] *S           points to an instance of the high precision Q31 Biquad cascade filter structure.
+   * @param[in]     numStages    number of 2nd order stages in the filter.
+   * @param[in]     *pCoeffs     points to the filter coefficients.
+   * @param[in]     *pState      points to the state buffer.
+   * @param[in]     postShift    shift to be applied to the output. Varies according to the coefficients format
+   * @return        none
+   */
+
+  void arm_biquad_cas_df1_32x64_init_q31(
+  arm_biquad_cas_df1_32x64_ins_q31 * S,
+  uint8_t numStages,
+  q31_t * pCoeffs,
+  q63_t * pState,
+  uint8_t postShift);
+
+
+
+  /**
+   * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
+   */
+
+  typedef struct
+  {
+    uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
+    float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */
+    float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
+  } arm_biquad_cascade_df2T_instance_f32;
+
+
+  /**
+   * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
+   * @param[in]  *S        points to an instance of the filter data structure.
+   * @param[in]  *pSrc     points to the block of input data.
+   * @param[out] *pDst     points to the block of output data
+   * @param[in]  blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_biquad_cascade_df2T_f32(
+  const arm_biquad_cascade_df2T_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.
+   * @param[in,out] *S           points to an instance of the filter data structure.
+   * @param[in]     numStages    number of 2nd order stages in the filter.
+   * @param[in]     *pCoeffs     points to the filter coefficients.
+   * @param[in]     *pState      points to the state buffer.
+   * @return        none
+   */
+
+  void arm_biquad_cascade_df2T_init_f32(
+  arm_biquad_cascade_df2T_instance_f32 * S,
+  uint8_t numStages,
+  float32_t * pCoeffs,
+  float32_t * pState);
+
+
+
+  /**
+   * @brief Instance structure for the Q15 FIR lattice filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numStages;                          /**< number of filter stages. */
+    q15_t *pState;                               /**< points to the state variable array. The array is of length numStages. */
+    q15_t *pCoeffs;                              /**< points to the coefficient array. The array is of length numStages. */
+  } arm_fir_lattice_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q31 FIR lattice filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numStages;                          /**< number of filter stages. */
+    q31_t *pState;                               /**< points to the state variable array. The array is of length numStages. */
+    q31_t *pCoeffs;                              /**< points to the coefficient array. The array is of length numStages. */
+  } arm_fir_lattice_instance_q31;
+
+  /**
+   * @brief Instance structure for the floating-point FIR lattice filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numStages;                  /**< number of filter stages. */
+    float32_t *pState;                   /**< points to the state variable array. The array is of length numStages. */
+    float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numStages. */
+  } arm_fir_lattice_instance_f32;
+
+  /**
+   * @brief Initialization function for the Q15 FIR lattice filter.
+   * @param[in] *S points to an instance of the Q15 FIR lattice structure.
+   * @param[in] numStages  number of filter stages.
+   * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.
+   * @param[in] *pState points to the state buffer.  The array is of length numStages.
+   * @return none.
+   */
+
+  void arm_fir_lattice_init_q15(
+  arm_fir_lattice_instance_q15 * S,
+  uint16_t numStages,
+  q15_t * pCoeffs,
+  q15_t * pState);
+
+
+  /**
+   * @brief Processing function for the Q15 FIR lattice filter.
+   * @param[in] *S points to an instance of the Q15 FIR lattice structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+  void arm_fir_lattice_q15(
+  const arm_fir_lattice_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Initialization function for the Q31 FIR lattice filter.
+   * @param[in] *S points to an instance of the Q31 FIR lattice structure.
+   * @param[in] numStages  number of filter stages.
+   * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.
+   * @param[in] *pState points to the state buffer.   The array is of length numStages.
+   * @return none.
+   */
+
+  void arm_fir_lattice_init_q31(
+  arm_fir_lattice_instance_q31 * S,
+  uint16_t numStages,
+  q31_t * pCoeffs,
+  q31_t * pState);
+
+
+  /**
+   * @brief Processing function for the Q31 FIR lattice filter.
+   * @param[in]  *S        points to an instance of the Q31 FIR lattice structure.
+   * @param[in]  *pSrc     points to the block of input data.
+   * @param[out] *pDst     points to the block of output data
+   * @param[in]  blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_fir_lattice_q31(
+  const arm_fir_lattice_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+/**
+ * @brief Initialization function for the floating-point FIR lattice filter.
+ * @param[in] *S points to an instance of the floating-point FIR lattice structure.
+ * @param[in] numStages  number of filter stages.
+ * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.
+ * @param[in] *pState points to the state buffer.  The array is of length numStages.
+ * @return none.
+ */
+
+  void arm_fir_lattice_init_f32(
+  arm_fir_lattice_instance_f32 * S,
+  uint16_t numStages,
+  float32_t * pCoeffs,
+  float32_t * pState);
+
+  /**
+   * @brief Processing function for the floating-point FIR lattice filter.
+   * @param[in]  *S        points to an instance of the floating-point FIR lattice structure.
+   * @param[in]  *pSrc     points to the block of input data.
+   * @param[out] *pDst     points to the block of output data
+   * @param[in]  blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_fir_lattice_f32(
+  const arm_fir_lattice_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Instance structure for the Q15 IIR lattice filter.
+   */
+  typedef struct
+  {
+    uint16_t numStages;                         /**< number of stages in the filter. */
+    q15_t *pState;                              /**< points to the state variable array. The array is of length numStages+blockSize. */
+    q15_t *pkCoeffs;                            /**< points to the reflection coefficient array. The array is of length numStages. */
+    q15_t *pvCoeffs;                            /**< points to the ladder coefficient array. The array is of length numStages+1. */
+  } arm_iir_lattice_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q31 IIR lattice filter.
+   */
+  typedef struct
+  {
+    uint16_t numStages;                         /**< number of stages in the filter. */
+    q31_t *pState;                              /**< points to the state variable array. The array is of length numStages+blockSize. */
+    q31_t *pkCoeffs;                            /**< points to the reflection coefficient array. The array is of length numStages. */
+    q31_t *pvCoeffs;                            /**< points to the ladder coefficient array. The array is of length numStages+1. */
+  } arm_iir_lattice_instance_q31;
+
+  /**
+   * @brief Instance structure for the floating-point IIR lattice filter.
+   */
+  typedef struct
+  {
+    uint16_t numStages;                         /**< number of stages in the filter. */
+    float32_t *pState;                          /**< points to the state variable array. The array is of length numStages+blockSize. */
+    float32_t *pkCoeffs;                        /**< points to the reflection coefficient array. The array is of length numStages. */
+    float32_t *pvCoeffs;                        /**< points to the ladder coefficient array. The array is of length numStages+1. */
+  } arm_iir_lattice_instance_f32;
+
+  /**
+   * @brief Processing function for the floating-point IIR lattice filter.
+   * @param[in] *S points to an instance of the floating-point IIR lattice structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_iir_lattice_f32(
+  const arm_iir_lattice_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Initialization function for the floating-point IIR lattice filter.
+   * @param[in] *S points to an instance of the floating-point IIR lattice structure.
+   * @param[in] numStages number of stages in the filter.
+   * @param[in] *pkCoeffs points to the reflection coefficient buffer.  The array is of length numStages.
+   * @param[in] *pvCoeffs points to the ladder coefficient buffer.  The array is of length numStages+1.
+   * @param[in] *pState points to the state buffer.  The array is of length numStages+blockSize-1.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_iir_lattice_init_f32(
+  arm_iir_lattice_instance_f32 * S,
+  uint16_t numStages,
+  float32_t * pkCoeffs,
+  float32_t * pvCoeffs,
+  float32_t * pState,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Processing function for the Q31 IIR lattice filter.
+   * @param[in] *S points to an instance of the Q31 IIR lattice structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_iir_lattice_q31(
+  const arm_iir_lattice_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Initialization function for the Q31 IIR lattice filter.
+   * @param[in] *S points to an instance of the Q31 IIR lattice structure.
+   * @param[in] numStages number of stages in the filter.
+   * @param[in] *pkCoeffs points to the reflection coefficient buffer.  The array is of length numStages.
+   * @param[in] *pvCoeffs points to the ladder coefficient buffer.  The array is of length numStages+1.
+   * @param[in] *pState points to the state buffer.  The array is of length numStages+blockSize.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_iir_lattice_init_q31(
+  arm_iir_lattice_instance_q31 * S,
+  uint16_t numStages,
+  q31_t * pkCoeffs,
+  q31_t * pvCoeffs,
+  q31_t * pState,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Processing function for the Q15 IIR lattice filter.
+   * @param[in] *S points to an instance of the Q15 IIR lattice structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[out] *pDst points to the block of output data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_iir_lattice_q15(
+  const arm_iir_lattice_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+
+/**
+ * @brief Initialization function for the Q15 IIR lattice filter.
+ * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
+ * @param[in] numStages  number of stages in the filter.
+ * @param[in] *pkCoeffs points to reflection coefficient buffer.  The array is of length numStages.
+ * @param[in] *pvCoeffs points to ladder coefficient buffer.  The array is of length numStages+1.
+ * @param[in] *pState points to state buffer.  The array is of length numStages+blockSize.
+ * @param[in] blockSize number of samples to process per call.
+ * @return none.
+ */
+
+  void arm_iir_lattice_init_q15(
+  arm_iir_lattice_instance_q15 * S,
+  uint16_t numStages,
+  q15_t * pkCoeffs,
+  q15_t * pvCoeffs,
+  q15_t * pState,
+  uint32_t blockSize);
+
+  /**
+   * @brief Instance structure for the floating-point LMS filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;    /**< number of coefficients in the filter. */
+    float32_t *pState;   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    float32_t *pCoeffs;  /**< points to the coefficient array. The array is of length numTaps. */
+    float32_t mu;        /**< step size that controls filter coefficient updates. */
+  } arm_lms_instance_f32;
+
+  /**
+   * @brief Processing function for floating-point LMS filter.
+   * @param[in]  *S points to an instance of the floating-point LMS filter structure.
+   * @param[in]  *pSrc points to the block of input data.
+   * @param[in]  *pRef points to the block of reference data.
+   * @param[out] *pOut points to the block of output data.
+   * @param[out] *pErr points to the block of error data.
+   * @param[in]  blockSize number of samples to process.
+   * @return     none.
+   */
+
+  void arm_lms_f32(
+  const arm_lms_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pRef,
+  float32_t * pOut,
+  float32_t * pErr,
+  uint32_t blockSize);
+
+  /**
+   * @brief Initialization function for floating-point LMS filter.
+   * @param[in] *S points to an instance of the floating-point LMS filter structure.
+   * @param[in] numTaps  number of filter coefficients.
+   * @param[in] *pCoeffs points to the coefficient buffer.
+   * @param[in] *pState points to state buffer.
+   * @param[in] mu step size that controls filter coefficient updates.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_lms_init_f32(
+  arm_lms_instance_f32 * S,
+  uint16_t numTaps,
+  float32_t * pCoeffs,
+  float32_t * pState,
+  float32_t mu,
+  uint32_t blockSize);
+
+  /**
+   * @brief Instance structure for the Q15 LMS filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;    /**< number of coefficients in the filter. */
+    q15_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    q15_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
+    q15_t mu;            /**< step size that controls filter coefficient updates. */
+    uint32_t postShift;  /**< bit shift applied to coefficients. */
+  } arm_lms_instance_q15;
+
+
+  /**
+   * @brief Initialization function for the Q15 LMS filter.
+   * @param[in] *S points to an instance of the Q15 LMS filter structure.
+   * @param[in] numTaps  number of filter coefficients.
+   * @param[in] *pCoeffs points to the coefficient buffer.
+   * @param[in] *pState points to the state buffer.
+   * @param[in] mu step size that controls filter coefficient updates.
+   * @param[in] blockSize number of samples to process.
+   * @param[in] postShift bit shift applied to coefficients.
+   * @return    none.
+   */
+
+  void arm_lms_init_q15(
+  arm_lms_instance_q15 * S,
+  uint16_t numTaps,
+  q15_t * pCoeffs,
+  q15_t * pState,
+  q15_t mu,
+  uint32_t blockSize,
+  uint32_t postShift);
+
+  /**
+   * @brief Processing function for Q15 LMS filter.
+   * @param[in] *S points to an instance of the Q15 LMS filter structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[in] *pRef points to the block of reference data.
+   * @param[out] *pOut points to the block of output data.
+   * @param[out] *pErr points to the block of error data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_lms_q15(
+  const arm_lms_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pRef,
+  q15_t * pOut,
+  q15_t * pErr,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Instance structure for the Q31 LMS filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;    /**< number of coefficients in the filter. */
+    q31_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    q31_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
+    q31_t mu;            /**< step size that controls filter coefficient updates. */
+    uint32_t postShift;  /**< bit shift applied to coefficients. */
+
+  } arm_lms_instance_q31;
+
+  /**
+   * @brief Processing function for Q31 LMS filter.
+   * @param[in]  *S points to an instance of the Q15 LMS filter structure.
+   * @param[in]  *pSrc points to the block of input data.
+   * @param[in]  *pRef points to the block of reference data.
+   * @param[out] *pOut points to the block of output data.
+   * @param[out] *pErr points to the block of error data.
+   * @param[in]  blockSize number of samples to process.
+   * @return     none.
+   */
+
+  void arm_lms_q31(
+  const arm_lms_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pRef,
+  q31_t * pOut,
+  q31_t * pErr,
+  uint32_t blockSize);
+
+  /**
+   * @brief Initialization function for Q31 LMS filter.
+   * @param[in] *S points to an instance of the Q31 LMS filter structure.
+   * @param[in] numTaps  number of filter coefficients.
+   * @param[in] *pCoeffs points to coefficient buffer.
+   * @param[in] *pState points to state buffer.
+   * @param[in] mu step size that controls filter coefficient updates.
+   * @param[in] blockSize number of samples to process.
+   * @param[in] postShift bit shift applied to coefficients.
+   * @return none.
+   */
+
+  void arm_lms_init_q31(
+  arm_lms_instance_q31 * S,
+  uint16_t numTaps,
+  q31_t * pCoeffs,
+  q31_t * pState,
+  q31_t mu,
+  uint32_t blockSize,
+  uint32_t postShift);
+
+  /**
+   * @brief Instance structure for the floating-point normalized LMS filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;     /**< number of coefficients in the filter. */
+    float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
+    float32_t mu;        /**< step size that control filter coefficient updates. */
+    float32_t energy;    /**< saves previous frame energy. */
+    float32_t x0;        /**< saves previous input sample. */
+  } arm_lms_norm_instance_f32;
+
+  /**
+   * @brief Processing function for floating-point normalized LMS filter.
+   * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[in] *pRef points to the block of reference data.
+   * @param[out] *pOut points to the block of output data.
+   * @param[out] *pErr points to the block of error data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_lms_norm_f32(
+  arm_lms_norm_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pRef,
+  float32_t * pOut,
+  float32_t * pErr,
+  uint32_t blockSize);
+
+  /**
+   * @brief Initialization function for floating-point normalized LMS filter.
+   * @param[in] *S points to an instance of the floating-point LMS filter structure.
+   * @param[in] numTaps  number of filter coefficients.
+   * @param[in] *pCoeffs points to coefficient buffer.
+   * @param[in] *pState points to state buffer.
+   * @param[in] mu step size that controls filter coefficient updates.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_lms_norm_init_f32(
+  arm_lms_norm_instance_f32 * S,
+  uint16_t numTaps,
+  float32_t * pCoeffs,
+  float32_t * pState,
+  float32_t mu,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Instance structure for the Q31 normalized LMS filter.
+   */
+  typedef struct
+  {
+    uint16_t numTaps;     /**< number of coefficients in the filter. */
+    q31_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    q31_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
+    q31_t mu;             /**< step size that controls filter coefficient updates. */
+    uint8_t postShift;    /**< bit shift applied to coefficients. */
+    q31_t *recipTable;    /**< points to the reciprocal initial value table. */
+    q31_t energy;         /**< saves previous frame energy. */
+    q31_t x0;             /**< saves previous input sample. */
+  } arm_lms_norm_instance_q31;
+
+  /**
+   * @brief Processing function for Q31 normalized LMS filter.
+   * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[in] *pRef points to the block of reference data.
+   * @param[out] *pOut points to the block of output data.
+   * @param[out] *pErr points to the block of error data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_lms_norm_q31(
+  arm_lms_norm_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pRef,
+  q31_t * pOut,
+  q31_t * pErr,
+  uint32_t blockSize);
+
+  /**
+   * @brief Initialization function for Q31 normalized LMS filter.
+   * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
+   * @param[in] numTaps  number of filter coefficients.
+   * @param[in] *pCoeffs points to coefficient buffer.
+   * @param[in] *pState points to state buffer.
+   * @param[in] mu step size that controls filter coefficient updates.
+   * @param[in] blockSize number of samples to process.
+   * @param[in] postShift bit shift applied to coefficients.
+   * @return none.
+   */
+
+  void arm_lms_norm_init_q31(
+  arm_lms_norm_instance_q31 * S,
+  uint16_t numTaps,
+  q31_t * pCoeffs,
+  q31_t * pState,
+  q31_t mu,
+  uint32_t blockSize,
+  uint8_t postShift);
+
+  /**
+   * @brief Instance structure for the Q15 normalized LMS filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;    /**< Number of coefficients in the filter. */
+    q15_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+    q15_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
+    q15_t mu;            /**< step size that controls filter coefficient updates. */
+    uint8_t postShift;   /**< bit shift applied to coefficients. */
+    q15_t *recipTable;   /**< Points to the reciprocal initial value table. */
+    q15_t energy;        /**< saves previous frame energy. */
+    q15_t x0;            /**< saves previous input sample. */
+  } arm_lms_norm_instance_q15;
+
+  /**
+   * @brief Processing function for Q15 normalized LMS filter.
+   * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
+   * @param[in] *pSrc points to the block of input data.
+   * @param[in] *pRef points to the block of reference data.
+   * @param[out] *pOut points to the block of output data.
+   * @param[out] *pErr points to the block of error data.
+   * @param[in] blockSize number of samples to process.
+   * @return none.
+   */
+
+  void arm_lms_norm_q15(
+  arm_lms_norm_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pRef,
+  q15_t * pOut,
+  q15_t * pErr,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief Initialization function for Q15 normalized LMS filter.
+   * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
+   * @param[in] numTaps  number of filter coefficients.
+   * @param[in] *pCoeffs points to coefficient buffer.
+   * @param[in] *pState points to state buffer.
+   * @param[in] mu step size that controls filter coefficient updates.
+   * @param[in] blockSize number of samples to process.
+   * @param[in] postShift bit shift applied to coefficients.
+   * @return none.
+   */
+
+  void arm_lms_norm_init_q15(
+  arm_lms_norm_instance_q15 * S,
+  uint16_t numTaps,
+  q15_t * pCoeffs,
+  q15_t * pState,
+  q15_t mu,
+  uint32_t blockSize,
+  uint8_t postShift);
+
+  /**
+   * @brief Correlation of floating-point sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @return none.
+   */
+
+  void arm_correlate_f32(
+  float32_t * pSrcA,
+  uint32_t srcALen,
+  float32_t * pSrcB,
+  uint32_t srcBLen,
+  float32_t * pDst);
+
+
+   /**
+   * @brief Correlation of Q15 sequences
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @param[in]  *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @return none.
+   */
+  void arm_correlate_opt_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst,
+  q15_t * pScratch);
+
+
+  /**
+   * @brief Correlation of Q15 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @return none.
+   */
+
+  void arm_correlate_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst);
+
+  /**
+   * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @return none.
+   */
+
+  void arm_correlate_fast_q15(
+			       q15_t * pSrcA,
+			      uint32_t srcALen,
+			       q15_t * pSrcB,
+			      uint32_t srcBLen,
+			      q15_t * pDst);
+
+
+
+  /**
+   * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @param[in]  *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @return none.
+   */
+
+  void arm_correlate_fast_opt_q15(
+  q15_t * pSrcA,
+  uint32_t srcALen,
+  q15_t * pSrcB,
+  uint32_t srcBLen,
+  q15_t * pDst,
+  q15_t * pScratch);
+
+  /**
+   * @brief Correlation of Q31 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @return none.
+   */
+
+  void arm_correlate_q31(
+  q31_t * pSrcA,
+  uint32_t srcALen,
+  q31_t * pSrcB,
+  uint32_t srcBLen,
+  q31_t * pDst);
+
+  /**
+   * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @return none.
+   */
+
+  void arm_correlate_fast_q31(
+  q31_t * pSrcA,
+  uint32_t srcALen,
+  q31_t * pSrcB,
+  uint32_t srcBLen,
+  q31_t * pDst);
+
+
+
+ /**
+   * @brief Correlation of Q7 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+   * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
+   * @return none.
+   */
+
+  void arm_correlate_opt_q7(
+  q7_t * pSrcA,
+  uint32_t srcALen,
+  q7_t * pSrcB,
+  uint32_t srcBLen,
+  q7_t * pDst,
+  q15_t * pScratch1,
+  q15_t * pScratch2);
+
+
+  /**
+   * @brief Correlation of Q7 sequences.
+   * @param[in] *pSrcA points to the first input sequence.
+   * @param[in] srcALen length of the first input sequence.
+   * @param[in] *pSrcB points to the second input sequence.
+   * @param[in] srcBLen length of the second input sequence.
+   * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
+   * @return none.
+   */
+
+  void arm_correlate_q7(
+  q7_t * pSrcA,
+  uint32_t srcALen,
+  q7_t * pSrcB,
+  uint32_t srcBLen,
+  q7_t * pDst);
+
+
+  /**
+   * @brief Instance structure for the floating-point sparse FIR filter.
+   */
+  typedef struct
+  {
+    uint16_t numTaps;             /**< number of coefficients in the filter. */
+    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
+    float32_t *pState;            /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+    float32_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
+    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
+    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
+  } arm_fir_sparse_instance_f32;
+
+  /**
+   * @brief Instance structure for the Q31 sparse FIR filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;             /**< number of coefficients in the filter. */
+    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
+    q31_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+    q31_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
+    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
+    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
+  } arm_fir_sparse_instance_q31;
+
+  /**
+   * @brief Instance structure for the Q15 sparse FIR filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;             /**< number of coefficients in the filter. */
+    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
+    q15_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+    q15_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
+    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
+    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
+  } arm_fir_sparse_instance_q15;
+
+  /**
+   * @brief Instance structure for the Q7 sparse FIR filter.
+   */
+
+  typedef struct
+  {
+    uint16_t numTaps;             /**< number of coefficients in the filter. */
+    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
+    q7_t *pState;                 /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+    q7_t *pCoeffs;                /**< points to the coefficient array. The array is of length numTaps.*/
+    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
+    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
+  } arm_fir_sparse_instance_q7;
+
+  /**
+   * @brief Processing function for the floating-point sparse FIR filter.
+   * @param[in]  *S          points to an instance of the floating-point sparse FIR structure.
+   * @param[in]  *pSrc       points to the block of input data.
+   * @param[out] *pDst       points to the block of output data
+   * @param[in]  *pScratchIn points to a temporary buffer of size blockSize.
+   * @param[in]  blockSize   number of input samples to process per call.
+   * @return none.
+   */
+
+  void arm_fir_sparse_f32(
+  arm_fir_sparse_instance_f32 * S,
+  float32_t * pSrc,
+  float32_t * pDst,
+  float32_t * pScratchIn,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the floating-point sparse FIR filter.
+   * @param[in,out] *S         points to an instance of the floating-point sparse FIR structure.
+   * @param[in]     numTaps    number of nonzero coefficients in the filter.
+   * @param[in]     *pCoeffs   points to the array of filter coefficients.
+   * @param[in]     *pState    points to the state buffer.
+   * @param[in]     *pTapDelay points to the array of offset times.
+   * @param[in]     maxDelay   maximum offset time supported.
+   * @param[in]     blockSize  number of samples that will be processed per block.
+   * @return none
+   */
+
+  void arm_fir_sparse_init_f32(
+  arm_fir_sparse_instance_f32 * S,
+  uint16_t numTaps,
+  float32_t * pCoeffs,
+  float32_t * pState,
+  int32_t * pTapDelay,
+  uint16_t maxDelay,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q31 sparse FIR filter.
+   * @param[in]  *S          points to an instance of the Q31 sparse FIR structure.
+   * @param[in]  *pSrc       points to the block of input data.
+   * @param[out] *pDst       points to the block of output data
+   * @param[in]  *pScratchIn points to a temporary buffer of size blockSize.
+   * @param[in]  blockSize   number of input samples to process per call.
+   * @return none.
+   */
+
+  void arm_fir_sparse_q31(
+  arm_fir_sparse_instance_q31 * S,
+  q31_t * pSrc,
+  q31_t * pDst,
+  q31_t * pScratchIn,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the Q31 sparse FIR filter.
+   * @param[in,out] *S         points to an instance of the Q31 sparse FIR structure.
+   * @param[in]     numTaps    number of nonzero coefficients in the filter.
+   * @param[in]     *pCoeffs   points to the array of filter coefficients.
+   * @param[in]     *pState    points to the state buffer.
+   * @param[in]     *pTapDelay points to the array of offset times.
+   * @param[in]     maxDelay   maximum offset time supported.
+   * @param[in]     blockSize  number of samples that will be processed per block.
+   * @return none
+   */
+
+  void arm_fir_sparse_init_q31(
+  arm_fir_sparse_instance_q31 * S,
+  uint16_t numTaps,
+  q31_t * pCoeffs,
+  q31_t * pState,
+  int32_t * pTapDelay,
+  uint16_t maxDelay,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q15 sparse FIR filter.
+   * @param[in]  *S           points to an instance of the Q15 sparse FIR structure.
+   * @param[in]  *pSrc        points to the block of input data.
+   * @param[out] *pDst        points to the block of output data
+   * @param[in]  *pScratchIn  points to a temporary buffer of size blockSize.
+   * @param[in]  *pScratchOut points to a temporary buffer of size blockSize.
+   * @param[in]  blockSize    number of input samples to process per call.
+   * @return none.
+   */
+
+  void arm_fir_sparse_q15(
+  arm_fir_sparse_instance_q15 * S,
+  q15_t * pSrc,
+  q15_t * pDst,
+  q15_t * pScratchIn,
+  q31_t * pScratchOut,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Initialization function for the Q15 sparse FIR filter.
+   * @param[in,out] *S         points to an instance of the Q15 sparse FIR structure.
+   * @param[in]     numTaps    number of nonzero coefficients in the filter.
+   * @param[in]     *pCoeffs   points to the array of filter coefficients.
+   * @param[in]     *pState    points to the state buffer.
+   * @param[in]     *pTapDelay points to the array of offset times.
+   * @param[in]     maxDelay   maximum offset time supported.
+   * @param[in]     blockSize  number of samples that will be processed per block.
+   * @return none
+   */
+
+  void arm_fir_sparse_init_q15(
+  arm_fir_sparse_instance_q15 * S,
+  uint16_t numTaps,
+  q15_t * pCoeffs,
+  q15_t * pState,
+  int32_t * pTapDelay,
+  uint16_t maxDelay,
+  uint32_t blockSize);
+
+  /**
+   * @brief Processing function for the Q7 sparse FIR filter.
+   * @param[in]  *S           points to an instance of the Q7 sparse FIR structure.
+   * @param[in]  *pSrc        points to the block of input data.
+   * @param[out] *pDst        points to the block of output data
+   * @param[in]  *pScratchIn  points to a temporary buffer of size blockSize.
+   * @param[in]  *pScratchOut points to a temporary buffer of size blockSize.
+   * @param[in]  blockSize    number of input samples to process per call.
+   * @return none.
+   */
+
+  void arm_fir_sparse_q7(
+  arm_fir_sparse_instance_q7 * S,
+  q7_t * pSrc,
+  q7_t * pDst,
+  q7_t * pScratchIn,
+  q31_t * pScratchOut,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Initialization function for the Q7 sparse FIR filter.
+   * @param[in,out] *S         points to an instance of the Q7 sparse FIR structure.
+   * @param[in]     numTaps    number of nonzero coefficients in the filter.
+   * @param[in]     *pCoeffs   points to the array of filter coefficients.
+   * @param[in]     *pState    points to the state buffer.
+   * @param[in]     *pTapDelay points to the array of offset times.
+   * @param[in]     maxDelay   maximum offset time supported.
+   * @param[in]     blockSize  number of samples that will be processed per block.
+   * @return none
+   */
+
+  void arm_fir_sparse_init_q7(
+  arm_fir_sparse_instance_q7 * S,
+  uint16_t numTaps,
+  q7_t * pCoeffs,
+  q7_t * pState,
+  int32_t * pTapDelay,
+  uint16_t maxDelay,
+  uint32_t blockSize);
+
+
+  /*
+   * @brief  Floating-point sin_cos function.
+   * @param[in]  theta    input value in degrees
+   * @param[out] *pSinVal points to the processed sine output.
+   * @param[out] *pCosVal points to the processed cos output.
+   * @return none.
+   */
+
+  void arm_sin_cos_f32(
+  float32_t theta,
+  float32_t * pSinVal,
+  float32_t * pCcosVal);
+
+  /*
+   * @brief  Q31 sin_cos function.
+   * @param[in]  theta    scaled input value in degrees
+   * @param[out] *pSinVal points to the processed sine output.
+   * @param[out] *pCosVal points to the processed cosine output.
+   * @return none.
+   */
+
+  void arm_sin_cos_q31(
+  q31_t theta,
+  q31_t * pSinVal,
+  q31_t * pCosVal);
+
+
+  /**
+   * @brief  Floating-point complex conjugate.
+   * @param[in]  *pSrc points to the input vector
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_conj_f32(
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q31 complex conjugate.
+   * @param[in]  *pSrc points to the input vector
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_conj_q31(
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q15 complex conjugate.
+   * @param[in]  *pSrc points to the input vector
+   * @param[out]  *pDst points to the output vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_conj_q15(
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t numSamples);
+
+
+
+  /**
+   * @brief  Floating-point complex magnitude squared
+   * @param[in]  *pSrc points to the complex input vector
+   * @param[out]  *pDst points to the real output vector
+   * @param[in]  numSamples number of complex samples in the input vector
+   * @return none.
+   */
+
+  void arm_cmplx_mag_squared_f32(
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q31 complex magnitude squared
+   * @param[in]  *pSrc points to the complex input vector
+   * @param[out]  *pDst points to the real output vector
+   * @param[in]  numSamples number of complex samples in the input vector
+   * @return none.
+   */
+
+  void arm_cmplx_mag_squared_q31(
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q15 complex magnitude squared
+   * @param[in]  *pSrc points to the complex input vector
+   * @param[out]  *pDst points to the real output vector
+   * @param[in]  numSamples number of complex samples in the input vector
+   * @return none.
+   */
+
+  void arm_cmplx_mag_squared_q15(
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t numSamples);
+
+
+ /**
+   * @ingroup groupController
+   */
+
+  /**
+   * @defgroup PID PID Motor Control
+   *
+   * A Proportional Integral Derivative (PID) controller is a generic feedback control
+   * loop mechanism widely used in industrial control systems.
+   * A PID controller is the most commonly used type of feedback controller.
+   *
+   * This set of functions implements (PID) controllers
+   * for Q15, Q31, and floating-point data types.  The functions operate on a single sample
+   * of data and each call to the function returns a single processed value.
+   * <code>S</code> points to an instance of the PID control data structure.  <code>in</code>
+   * is the input sample value. The functions return the output value.
+   *
+   * \par Algorithm:
+   * <pre>
+   *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
+   *    A0 = Kp + Ki + Kd
+   *    A1 = (-Kp ) - (2 * Kd )
+   *    A2 = Kd  </pre>
+   *
+   * \par
+   * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
+   *
+   * \par
+   * \image html PID.gif "Proportional Integral Derivative Controller"
+   *
+   * \par
+   * The PID controller calculates an "error" value as the difference between
+   * the measured output and the reference input.
+   * The controller attempts to minimize the error by adjusting the process control inputs.
+   * The proportional value determines the reaction to the current error,
+   * the integral value determines the reaction based on the sum of recent errors,
+   * and the derivative value determines the reaction based on the rate at which the error has been changing.
+   *
+   * \par Instance Structure
+   * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
+   * A separate instance structure must be defined for each PID Controller.
+   * There are separate instance structure declarations for each of the 3 supported data types.
+   *
+   * \par Reset Functions
+   * There is also an associated reset function for each data type which clears the state array.
+   *
+   * \par Initialization Functions
+   * There is also an associated initialization function for each data type.
+   * The initialization function performs the following operations:
+   * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
+   * - Zeros out the values in the state buffer.
+   *
+   * \par
+   * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
+   *
+   * \par Fixed-Point Behavior
+   * Care must be taken when using the fixed-point versions of the PID Controller functions.
+   * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
+   * Refer to the function specific documentation below for usage guidelines.
+   */
+
+  /**
+   * @addtogroup PID
+   * @{
+   */
+
+  /**
+   * @brief  Process function for the floating-point PID Control.
+   * @param[in,out] *S is an instance of the floating-point PID Control structure
+   * @param[in] in input sample to process
+   * @return out processed output sample.
+   */
+
+
+  static __INLINE float32_t arm_pid_f32(
+  arm_pid_instance_f32 * S,
+  float32_t in)
+  {
+    float32_t out;
+
+    /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]  */
+    out = (S->A0 * in) +
+      (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
+
+    /* Update state */
+    S->state[1] = S->state[0];
+    S->state[0] = in;
+    S->state[2] = out;
+
+    /* return to application */
+    return (out);
+
+  }
+
+  /**
+   * @brief  Process function for the Q31 PID Control.
+   * @param[in,out] *S points to an instance of the Q31 PID Control structure
+   * @param[in] in input sample to process
+   * @return out processed output sample.
+   *
+   * <b>Scaling and Overflow Behavior:</b>
+   * \par
+   * The function is implemented using an internal 64-bit accumulator.
+   * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
+   * Thus, if the accumulator result overflows it wraps around rather than clip.
+   * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
+   * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
+   */
+
+  static __INLINE q31_t arm_pid_q31(
+  arm_pid_instance_q31 * S,
+  q31_t in)
+  {
+    q63_t acc;
+    q31_t out;
+
+    /* acc = A0 * x[n]  */
+    acc = (q63_t) S->A0 * in;
+
+    /* acc += A1 * x[n-1] */
+    acc += (q63_t) S->A1 * S->state[0];
+
+    /* acc += A2 * x[n-2]  */
+    acc += (q63_t) S->A2 * S->state[1];
+
+    /* convert output to 1.31 format to add y[n-1] */
+    out = (q31_t) (acc >> 31u);
+
+    /* out += y[n-1] */
+    out += S->state[2];
+
+    /* Update state */
+    S->state[1] = S->state[0];
+    S->state[0] = in;
+    S->state[2] = out;
+
+    /* return to application */
+    return (out);
+
+  }
+
+  /**
+   * @brief  Process function for the Q15 PID Control.
+   * @param[in,out] *S points to an instance of the Q15 PID Control structure
+   * @param[in] in input sample to process
+   * @return out processed output sample.
+   *
+   * <b>Scaling and Overflow Behavior:</b>
+   * \par
+   * The function is implemented using a 64-bit internal accumulator.
+   * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
+   * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
+   * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
+   * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
+   * Lastly, the accumulator is saturated to yield a result in 1.15 format.
+   */
+
+  static __INLINE q15_t arm_pid_q15(
+  arm_pid_instance_q15 * S,
+  q15_t in)
+  {
+    q63_t acc;
+    q15_t out;
+
+#ifndef ARM_MATH_CM0_FAMILY
+    __SIMD32_TYPE *vstate;
+
+    /* Implementation of PID controller */
+
+    /* acc = A0 * x[n]  */
+    acc = (q31_t) __SMUAD(S->A0, in);
+
+    /* acc += A1 * x[n-1] + A2 * x[n-2]  */
+    vstate = __SIMD32_CONST(S->state);
+    acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
+
+#else
+    /* acc = A0 * x[n]  */
+    acc = ((q31_t) S->A0) * in;
+
+    /* acc += A1 * x[n-1] + A2 * x[n-2]  */
+    acc += (q31_t) S->A1 * S->state[0];
+    acc += (q31_t) S->A2 * S->state[1];
+
+#endif
+
+    /* acc += y[n-1] */
+    acc += (q31_t) S->state[2] << 15;
+
+    /* saturate the output */
+    out = (q15_t) (__SSAT((acc >> 15), 16));
+
+    /* Update state */
+    S->state[1] = S->state[0];
+    S->state[0] = in;
+    S->state[2] = out;
+
+    /* return to application */
+    return (out);
+
+  }
+
+  /**
+   * @} end of PID group
+   */
+
+
+  /**
+   * @brief Floating-point matrix inverse.
+   * @param[in]  *src points to the instance of the input floating-point matrix structure.
+   * @param[out] *dst points to the instance of the output floating-point matrix structure.
+   * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
+   * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
+   */
+
+  arm_status arm_mat_inverse_f32(
+  const arm_matrix_instance_f32 * src,
+  arm_matrix_instance_f32 * dst);
+
+
+
+  /**
+   * @ingroup groupController
+   */
+
+
+  /**
+   * @defgroup clarke Vector Clarke Transform
+   * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
+   * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
+   * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
+   * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
+   * \image html clarke.gif Stator current space vector and its components in (a,b).
+   * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
+   * can be calculated using only <code>Ia</code> and <code>Ib</code>.
+   *
+   * The function operates on a single sample of data and each call to the function returns the processed output.
+   * The library provides separate functions for Q31 and floating-point data types.
+   * \par Algorithm
+   * \image html clarkeFormula.gif
+   * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
+   * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
+   * \par Fixed-Point Behavior
+   * Care must be taken when using the Q31 version of the Clarke transform.
+   * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+   * Refer to the function specific documentation below for usage guidelines.
+   */
+
+  /**
+   * @addtogroup clarke
+   * @{
+   */
+
+  /**
+   *
+   * @brief  Floating-point Clarke transform
+   * @param[in]       Ia       input three-phase coordinate <code>a</code>
+   * @param[in]       Ib       input three-phase coordinate <code>b</code>
+   * @param[out]      *pIalpha points to output two-phase orthogonal vector axis alpha
+   * @param[out]      *pIbeta  points to output two-phase orthogonal vector axis beta
+   * @return none.
+   */
+
+  static __INLINE void arm_clarke_f32(
+  float32_t Ia,
+  float32_t Ib,
+  float32_t * pIalpha,
+  float32_t * pIbeta)
+  {
+    /* Calculate pIalpha using the equation, pIalpha = Ia */
+    *pIalpha = Ia;
+
+    /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
+    *pIbeta =
+      ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
+
+  }
+
+  /**
+   * @brief  Clarke transform for Q31 version
+   * @param[in]       Ia       input three-phase coordinate <code>a</code>
+   * @param[in]       Ib       input three-phase coordinate <code>b</code>
+   * @param[out]      *pIalpha points to output two-phase orthogonal vector axis alpha
+   * @param[out]      *pIbeta  points to output two-phase orthogonal vector axis beta
+   * @return none.
+   *
+   * <b>Scaling and Overflow Behavior:</b>
+   * \par
+   * The function is implemented using an internal 32-bit accumulator.
+   * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+   * There is saturation on the addition, hence there is no risk of overflow.
+   */
+
+  static __INLINE void arm_clarke_q31(
+  q31_t Ia,
+  q31_t Ib,
+  q31_t * pIalpha,
+  q31_t * pIbeta)
+  {
+    q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
+
+    /* Calculating pIalpha from Ia by equation pIalpha = Ia */
+    *pIalpha = Ia;
+
+    /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
+    product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
+
+    /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
+    product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
+
+    /* pIbeta is calculated by adding the intermediate products */
+    *pIbeta = __QADD(product1, product2);
+  }
+
+  /**
+   * @} end of clarke group
+   */
+
+  /**
+   * @brief  Converts the elements of the Q7 vector to Q31 vector.
+   * @param[in]  *pSrc     input pointer
+   * @param[out]  *pDst    output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_q7_to_q31(
+  q7_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+
+
+
+  /**
+   * @ingroup groupController
+   */
+
+  /**
+   * @defgroup inv_clarke Vector Inverse Clarke Transform
+   * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
+   *
+   * The function operates on a single sample of data and each call to the function returns the processed output.
+   * The library provides separate functions for Q31 and floating-point data types.
+   * \par Algorithm
+   * \image html clarkeInvFormula.gif
+   * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
+   * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
+   * \par Fixed-Point Behavior
+   * Care must be taken when using the Q31 version of the Clarke transform.
+   * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+   * Refer to the function specific documentation below for usage guidelines.
+   */
+
+  /**
+   * @addtogroup inv_clarke
+   * @{
+   */
+
+   /**
+   * @brief  Floating-point Inverse Clarke transform
+   * @param[in]       Ialpha  input two-phase orthogonal vector axis alpha
+   * @param[in]       Ibeta   input two-phase orthogonal vector axis beta
+   * @param[out]      *pIa    points to output three-phase coordinate <code>a</code>
+   * @param[out]      *pIb    points to output three-phase coordinate <code>b</code>
+   * @return none.
+   */
+
+
+  static __INLINE void arm_inv_clarke_f32(
+  float32_t Ialpha,
+  float32_t Ibeta,
+  float32_t * pIa,
+  float32_t * pIb)
+  {
+    /* Calculating pIa from Ialpha by equation pIa = Ialpha */
+    *pIa = Ialpha;
+
+    /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
+    *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
+
+  }
+
+  /**
+   * @brief  Inverse Clarke transform for Q31 version
+   * @param[in]       Ialpha  input two-phase orthogonal vector axis alpha
+   * @param[in]       Ibeta   input two-phase orthogonal vector axis beta
+   * @param[out]      *pIa    points to output three-phase coordinate <code>a</code>
+   * @param[out]      *pIb    points to output three-phase coordinate <code>b</code>
+   * @return none.
+   *
+   * <b>Scaling and Overflow Behavior:</b>
+   * \par
+   * The function is implemented using an internal 32-bit accumulator.
+   * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+   * There is saturation on the subtraction, hence there is no risk of overflow.
+   */
+
+  static __INLINE void arm_inv_clarke_q31(
+  q31_t Ialpha,
+  q31_t Ibeta,
+  q31_t * pIa,
+  q31_t * pIb)
+  {
+    q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
+
+    /* Calculating pIa from Ialpha by equation pIa = Ialpha */
+    *pIa = Ialpha;
+
+    /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
+    product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
+
+    /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
+    product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
+
+    /* pIb is calculated by subtracting the products */
+    *pIb = __QSUB(product2, product1);
+
+  }
+
+  /**
+   * @} end of inv_clarke group
+   */
+
+  /**
+   * @brief  Converts the elements of the Q7 vector to Q15 vector.
+   * @param[in]  *pSrc     input pointer
+   * @param[out] *pDst     output pointer
+   * @param[in]  blockSize number of samples to process
+   * @return none.
+   */
+  void arm_q7_to_q15(
+  q7_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+
+
+  /**
+   * @ingroup groupController
+   */
+
+  /**
+   * @defgroup park Vector Park Transform
+   *
+   * Forward Park transform converts the input two-coordinate vector to flux and torque components.
+   * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
+   * from the stationary to the moving reference frame and control the spatial relationship between
+   * the stator vector current and rotor flux vector.
+   * If we consider the d axis aligned with the rotor flux, the diagram below shows the
+   * current vector and the relationship from the two reference frames:
+   * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
+   *
+   * The function operates on a single sample of data and each call to the function returns the processed output.
+   * The library provides separate functions for Q31 and floating-point data types.
+   * \par Algorithm
+   * \image html parkFormula.gif
+   * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
+   * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
+   * cosine and sine values of theta (rotor flux position).
+   * \par Fixed-Point Behavior
+   * Care must be taken when using the Q31 version of the Park transform.
+   * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+   * Refer to the function specific documentation below for usage guidelines.
+   */
+
+  /**
+   * @addtogroup park
+   * @{
+   */
+
+  /**
+   * @brief Floating-point Park transform
+   * @param[in]       Ialpha input two-phase vector coordinate alpha
+   * @param[in]       Ibeta  input two-phase vector coordinate beta
+   * @param[out]      *pId   points to output	rotor reference frame d
+   * @param[out]      *pIq   points to output	rotor reference frame q
+   * @param[in]       sinVal sine value of rotation angle theta
+   * @param[in]       cosVal cosine value of rotation angle theta
+   * @return none.
+   *
+   * The function implements the forward Park transform.
+   *
+   */
+
+  static __INLINE void arm_park_f32(
+  float32_t Ialpha,
+  float32_t Ibeta,
+  float32_t * pId,
+  float32_t * pIq,
+  float32_t sinVal,
+  float32_t cosVal)
+  {
+    /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
+    *pId = Ialpha * cosVal + Ibeta * sinVal;
+
+    /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
+    *pIq = -Ialpha * sinVal + Ibeta * cosVal;
+
+  }
+
+  /**
+   * @brief  Park transform for Q31 version
+   * @param[in]       Ialpha input two-phase vector coordinate alpha
+   * @param[in]       Ibeta  input two-phase vector coordinate beta
+   * @param[out]      *pId   points to output rotor reference frame d
+   * @param[out]      *pIq   points to output rotor reference frame q
+   * @param[in]       sinVal sine value of rotation angle theta
+   * @param[in]       cosVal cosine value of rotation angle theta
+   * @return none.
+   *
+   * <b>Scaling and Overflow Behavior:</b>
+   * \par
+   * The function is implemented using an internal 32-bit accumulator.
+   * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+   * There is saturation on the addition and subtraction, hence there is no risk of overflow.
+   */
+
+
+  static __INLINE void arm_park_q31(
+  q31_t Ialpha,
+  q31_t Ibeta,
+  q31_t * pId,
+  q31_t * pIq,
+  q31_t sinVal,
+  q31_t cosVal)
+  {
+    q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
+    q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
+
+    /* Intermediate product is calculated by (Ialpha * cosVal) */
+    product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
+
+    /* Intermediate product is calculated by (Ibeta * sinVal) */
+    product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
+
+
+    /* Intermediate product is calculated by (Ialpha * sinVal) */
+    product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
+
+    /* Intermediate product is calculated by (Ibeta * cosVal) */
+    product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
+
+    /* Calculate pId by adding the two intermediate products 1 and 2 */
+    *pId = __QADD(product1, product2);
+
+    /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
+    *pIq = __QSUB(product4, product3);
+  }
+
+  /**
+   * @} end of park group
+   */
+
+  /**
+   * @brief  Converts the elements of the Q7 vector to floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[out]  *pDst is output pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @return none.
+   */
+  void arm_q7_to_float(
+  q7_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @ingroup groupController
+   */
+
+  /**
+   * @defgroup inv_park Vector Inverse Park transform
+   * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
+   *
+   * The function operates on a single sample of data and each call to the function returns the processed output.
+   * The library provides separate functions for Q31 and floating-point data types.
+   * \par Algorithm
+   * \image html parkInvFormula.gif
+   * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
+   * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
+   * cosine and sine values of theta (rotor flux position).
+   * \par Fixed-Point Behavior
+   * Care must be taken when using the Q31 version of the Park transform.
+   * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+   * Refer to the function specific documentation below for usage guidelines.
+   */
+
+  /**
+   * @addtogroup inv_park
+   * @{
+   */
+
+   /**
+   * @brief  Floating-point Inverse Park transform
+   * @param[in]       Id        input coordinate of rotor reference frame d
+   * @param[in]       Iq        input coordinate of rotor reference frame q
+   * @param[out]      *pIalpha  points to output two-phase orthogonal vector axis alpha
+   * @param[out]      *pIbeta   points to output two-phase orthogonal vector axis beta
+   * @param[in]       sinVal    sine value of rotation angle theta
+   * @param[in]       cosVal    cosine value of rotation angle theta
+   * @return none.
+   */
+
+  static __INLINE void arm_inv_park_f32(
+  float32_t Id,
+  float32_t Iq,
+  float32_t * pIalpha,
+  float32_t * pIbeta,
+  float32_t sinVal,
+  float32_t cosVal)
+  {
+    /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
+    *pIalpha = Id * cosVal - Iq * sinVal;
+
+    /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
+    *pIbeta = Id * sinVal + Iq * cosVal;
+
+  }
+
+
+  /**
+   * @brief  Inverse Park transform for	Q31 version
+   * @param[in]       Id        input coordinate of rotor reference frame d
+   * @param[in]       Iq        input coordinate of rotor reference frame q
+   * @param[out]      *pIalpha  points to output two-phase orthogonal vector axis alpha
+   * @param[out]      *pIbeta   points to output two-phase orthogonal vector axis beta
+   * @param[in]       sinVal    sine value of rotation angle theta
+   * @param[in]       cosVal    cosine value of rotation angle theta
+   * @return none.
+   *
+   * <b>Scaling and Overflow Behavior:</b>
+   * \par
+   * The function is implemented using an internal 32-bit accumulator.
+   * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+   * There is saturation on the addition, hence there is no risk of overflow.
+   */
+
+
+  static __INLINE void arm_inv_park_q31(
+  q31_t Id,
+  q31_t Iq,
+  q31_t * pIalpha,
+  q31_t * pIbeta,
+  q31_t sinVal,
+  q31_t cosVal)
+  {
+    q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
+    q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
+
+    /* Intermediate product is calculated by (Id * cosVal) */
+    product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
+
+    /* Intermediate product is calculated by (Iq * sinVal) */
+    product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
+
+
+    /* Intermediate product is calculated by (Id * sinVal) */
+    product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
+
+    /* Intermediate product is calculated by (Iq * cosVal) */
+    product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
+
+    /* Calculate pIalpha by using the two intermediate products 1 and 2 */
+    *pIalpha = __QSUB(product1, product2);
+
+    /* Calculate pIbeta by using the two intermediate products 3 and 4 */
+    *pIbeta = __QADD(product4, product3);
+
+  }
+
+  /**
+   * @} end of Inverse park group
+   */
+
+
+  /**
+   * @brief  Converts the elements of the Q31 vector to floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[out]  *pDst is output pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @return none.
+   */
+  void arm_q31_to_float(
+  q31_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @ingroup groupInterpolation
+   */
+
+  /**
+   * @defgroup LinearInterpolate Linear Interpolation
+   *
+   * Linear interpolation is a method of curve fitting using linear polynomials.
+   * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
+   *
+   * \par
+   * \image html LinearInterp.gif "Linear interpolation"
+   *
+   * \par
+   * A  Linear Interpolate function calculates an output value(y), for the input(x)
+   * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
+   *
+   * \par Algorithm:
+   * <pre>
+   *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
+   *       where x0, x1 are nearest values of input x
+   *             y0, y1 are nearest values to output y
+   * </pre>
+   *
+   * \par
+   * This set of functions implements Linear interpolation process
+   * for Q7, Q15, Q31, and floating-point data types.  The functions operate on a single
+   * sample of data and each call to the function returns a single processed value.
+   * <code>S</code> points to an instance of the Linear Interpolate function data structure.
+   * <code>x</code> is the input sample value. The functions returns the output value.
+   *
+   * \par
+   * if x is outside of the table boundary, Linear interpolation returns first value of the table
+   * if x is below input range and returns last value of table if x is above range.
+   */
+
+  /**
+   * @addtogroup LinearInterpolate
+   * @{
+   */
+
+  /**
+   * @brief  Process function for the floating-point Linear Interpolation Function.
+   * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
+   * @param[in] x input sample to process
+   * @return y processed output sample.
+   *
+   */
+
+  static __INLINE float32_t arm_linear_interp_f32(
+  arm_linear_interp_instance_f32 * S,
+  float32_t x)
+  {
+
+    float32_t y;
+    float32_t x0, x1;                            /* Nearest input values */
+    float32_t y0, y1;                            /* Nearest output values */
+    float32_t xSpacing = S->xSpacing;            /* spacing between input values */
+    int32_t i;                                   /* Index variable */
+    float32_t *pYData = S->pYData;               /* pointer to output table */
+
+    /* Calculation of index */
+    i = (int32_t) ((x - S->x1) / xSpacing);
+
+    if(i < 0)
+    {
+      /* Iniatilize output for below specified range as least output value of table */
+      y = pYData[0];
+    }
+    else if((uint32_t)i >= S->nValues)
+    {
+      /* Iniatilize output for above specified range as last output value of table */
+      y = pYData[S->nValues - 1];
+    }
+    else
+    {
+      /* Calculation of nearest input values */
+      x0 = S->x1 + i * xSpacing;
+      x1 = S->x1 + (i + 1) * xSpacing;
+
+      /* Read of nearest output values */
+      y0 = pYData[i];
+      y1 = pYData[i + 1];
+
+      /* Calculation of output */
+      y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
+
+    }
+
+    /* returns output value */
+    return (y);
+  }
+
+   /**
+   *
+   * @brief  Process function for the Q31 Linear Interpolation Function.
+   * @param[in] *pYData  pointer to Q31 Linear Interpolation table
+   * @param[in] x input sample to process
+   * @param[in] nValues number of table values
+   * @return y processed output sample.
+   *
+   * \par
+   * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
+   * This function can support maximum of table size 2^12.
+   *
+   */
+
+
+  static __INLINE q31_t arm_linear_interp_q31(
+  q31_t * pYData,
+  q31_t x,
+  uint32_t nValues)
+  {
+    q31_t y;                                     /* output */
+    q31_t y0, y1;                                /* Nearest output values */
+    q31_t fract;                                 /* fractional part */
+    int32_t index;                               /* Index to read nearest output values */
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    index = ((x & 0xFFF00000) >> 20);
+
+    if(index >= (int32_t)(nValues - 1))
+    {
+      return (pYData[nValues - 1]);
+    }
+    else if(index < 0)
+    {
+      return (pYData[0]);
+    }
+    else
+    {
+
+      /* 20 bits for the fractional part */
+      /* shift left by 11 to keep fract in 1.31 format */
+      fract = (x & 0x000FFFFF) << 11;
+
+      /* Read two nearest output values from the index in 1.31(q31) format */
+      y0 = pYData[index];
+      y1 = pYData[index + 1u];
+
+      /* Calculation of y0 * (1-fract) and y is in 2.30 format */
+      y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
+
+      /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
+      y += ((q31_t) (((q63_t) y1 * fract) >> 32));
+
+      /* Convert y to 1.31 format */
+      return (y << 1u);
+
+    }
+
+  }
+
+  /**
+   *
+   * @brief  Process function for the Q15 Linear Interpolation Function.
+   * @param[in] *pYData  pointer to Q15 Linear Interpolation table
+   * @param[in] x input sample to process
+   * @param[in] nValues number of table values
+   * @return y processed output sample.
+   *
+   * \par
+   * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
+   * This function can support maximum of table size 2^12.
+   *
+   */
+
+
+  static __INLINE q15_t arm_linear_interp_q15(
+  q15_t * pYData,
+  q31_t x,
+  uint32_t nValues)
+  {
+    q63_t y;                                     /* output */
+    q15_t y0, y1;                                /* Nearest output values */
+    q31_t fract;                                 /* fractional part */
+    int32_t index;                               /* Index to read nearest output values */
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    index = ((x & 0xFFF00000) >> 20u);
+
+    if(index >= (int32_t)(nValues - 1))
+    {
+      return (pYData[nValues - 1]);
+    }
+    else if(index < 0)
+    {
+      return (pYData[0]);
+    }
+    else
+    {
+      /* 20 bits for the fractional part */
+      /* fract is in 12.20 format */
+      fract = (x & 0x000FFFFF);
+
+      /* Read two nearest output values from the index */
+      y0 = pYData[index];
+      y1 = pYData[index + 1u];
+
+      /* Calculation of y0 * (1-fract) and y is in 13.35 format */
+      y = ((q63_t) y0 * (0xFFFFF - fract));
+
+      /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
+      y += ((q63_t) y1 * (fract));
+
+      /* convert y to 1.15 format */
+      return (y >> 20);
+    }
+
+
+  }
+
+  /**
+   *
+   * @brief  Process function for the Q7 Linear Interpolation Function.
+   * @param[in] *pYData  pointer to Q7 Linear Interpolation table
+   * @param[in] x input sample to process
+   * @param[in] nValues number of table values
+   * @return y processed output sample.
+   *
+   * \par
+   * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
+   * This function can support maximum of table size 2^12.
+   */
+
+
+  static __INLINE q7_t arm_linear_interp_q7(
+  q7_t * pYData,
+  q31_t x,
+  uint32_t nValues)
+  {
+    q31_t y;                                     /* output */
+    q7_t y0, y1;                                 /* Nearest output values */
+    q31_t fract;                                 /* fractional part */
+    uint32_t index;                              /* Index to read nearest output values */
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    if (x < 0)
+    {
+      return (pYData[0]);
+    }
+    index = (x >> 20) & 0xfff;
+
+
+    if(index >= (nValues - 1))
+    {
+      return (pYData[nValues - 1]);
+    }
+    else
+    {
+
+      /* 20 bits for the fractional part */
+      /* fract is in 12.20 format */
+      fract = (x & 0x000FFFFF);
+
+      /* Read two nearest output values from the index and are in 1.7(q7) format */
+      y0 = pYData[index];
+      y1 = pYData[index + 1u];
+
+      /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
+      y = ((y0 * (0xFFFFF - fract)));
+
+      /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
+      y += (y1 * fract);
+
+      /* convert y to 1.7(q7) format */
+      return (y >> 20u);
+
+    }
+
+  }
+  /**
+   * @} end of LinearInterpolate group
+   */
+
+  /**
+   * @brief  Fast approximation to the trigonometric sine function for floating-point data.
+   * @param[in] x input value in radians.
+   * @return  sin(x).
+   */
+
+  float32_t arm_sin_f32(
+  float32_t x);
+
+  /**
+   * @brief  Fast approximation to the trigonometric sine function for Q31 data.
+   * @param[in] x Scaled input value in radians.
+   * @return  sin(x).
+   */
+
+  q31_t arm_sin_q31(
+  q31_t x);
+
+  /**
+   * @brief  Fast approximation to the trigonometric sine function for Q15 data.
+   * @param[in] x Scaled input value in radians.
+   * @return  sin(x).
+   */
+
+  q15_t arm_sin_q15(
+  q15_t x);
+
+  /**
+   * @brief  Fast approximation to the trigonometric cosine function for floating-point data.
+   * @param[in] x input value in radians.
+   * @return  cos(x).
+   */
+
+  float32_t arm_cos_f32(
+  float32_t x);
+
+  /**
+   * @brief Fast approximation to the trigonometric cosine function for Q31 data.
+   * @param[in] x Scaled input value in radians.
+   * @return  cos(x).
+   */
+
+  q31_t arm_cos_q31(
+  q31_t x);
+
+  /**
+   * @brief  Fast approximation to the trigonometric cosine function for Q15 data.
+   * @param[in] x Scaled input value in radians.
+   * @return  cos(x).
+   */
+
+  q15_t arm_cos_q15(
+  q15_t x);
+
+
+  /**
+   * @ingroup groupFastMath
+   */
+
+
+  /**
+   * @defgroup SQRT Square Root
+   *
+   * Computes the square root of a number.
+   * There are separate functions for Q15, Q31, and floating-point data types.
+   * The square root function is computed using the Newton-Raphson algorithm.
+   * This is an iterative algorithm of the form:
+   * <pre>
+   *      x1 = x0 - f(x0)/f'(x0)
+   * </pre>
+   * where <code>x1</code> is the current estimate,
+   * <code>x0</code> is the previous estimate, and
+   * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
+   * For the square root function, the algorithm reduces to:
+   * <pre>
+   *     x0 = in/2                         [initial guess]
+   *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]
+   * </pre>
+   */
+
+
+  /**
+   * @addtogroup SQRT
+   * @{
+   */
+
+  /**
+   * @brief  Floating-point square root function.
+   * @param[in]  in     input value.
+   * @param[out] *pOut  square root of input value.
+   * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
+   * <code>in</code> is negative value and returns zero output for negative values.
+   */
+
+  static __INLINE arm_status arm_sqrt_f32(
+  float32_t in,
+  float32_t * pOut)
+  {
+    if(in > 0)
+    {
+
+//      #if __FPU_USED
+#if (__FPU_USED == 1) && defined ( __CC_ARM   )
+      *pOut = __sqrtf(in);
+#else
+      *pOut = sqrtf(in);
+#endif
+
+      return (ARM_MATH_SUCCESS);
+    }
+    else
+    {
+      *pOut = 0.0f;
+      return (ARM_MATH_ARGUMENT_ERROR);
+    }
+
+  }
+
+
+  /**
+   * @brief Q31 square root function.
+   * @param[in]   in    input value.  The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
+   * @param[out]  *pOut square root of input value.
+   * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
+   * <code>in</code> is negative value and returns zero output for negative values.
+   */
+  arm_status arm_sqrt_q31(
+  q31_t in,
+  q31_t * pOut);
+
+  /**
+   * @brief  Q15 square root function.
+   * @param[in]   in     input value.  The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
+   * @param[out]  *pOut  square root of input value.
+   * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
+   * <code>in</code> is negative value and returns zero output for negative values.
+   */
+  arm_status arm_sqrt_q15(
+  q15_t in,
+  q15_t * pOut);
+
+  /**
+   * @} end of SQRT group
+   */
+
+
+
+
+
+
+  /**
+   * @brief floating-point Circular write function.
+   */
+
+  static __INLINE void arm_circularWrite_f32(
+  int32_t * circBuffer,
+  int32_t L,
+  uint16_t * writeOffset,
+  int32_t bufferInc,
+  const int32_t * src,
+  int32_t srcInc,
+  uint32_t blockSize)
+  {
+    uint32_t i = 0u;
+    int32_t wOffset;
+
+    /* Copy the value of Index pointer that points
+     * to the current location where the input samples to be copied */
+    wOffset = *writeOffset;
+
+    /* Loop over the blockSize */
+    i = blockSize;
+
+    while(i > 0u)
+    {
+      /* copy the input sample to the circular buffer */
+      circBuffer[wOffset] = *src;
+
+      /* Update the input pointer */
+      src += srcInc;
+
+      /* Circularly update wOffset.  Watch out for positive and negative value */
+      wOffset += bufferInc;
+      if(wOffset >= L)
+        wOffset -= L;
+
+      /* Decrement the loop counter */
+      i--;
+    }
+
+    /* Update the index pointer */
+    *writeOffset = wOffset;
+  }
+
+
+
+  /**
+   * @brief floating-point Circular Read function.
+   */
+  static __INLINE void arm_circularRead_f32(
+  int32_t * circBuffer,
+  int32_t L,
+  int32_t * readOffset,
+  int32_t bufferInc,
+  int32_t * dst,
+  int32_t * dst_base,
+  int32_t dst_length,
+  int32_t dstInc,
+  uint32_t blockSize)
+  {
+    uint32_t i = 0u;
+    int32_t rOffset, dst_end;
+
+    /* Copy the value of Index pointer that points
+     * to the current location from where the input samples to be read */
+    rOffset = *readOffset;
+    dst_end = (int32_t) (dst_base + dst_length);
+
+    /* Loop over the blockSize */
+    i = blockSize;
+
+    while(i > 0u)
+    {
+      /* copy the sample from the circular buffer to the destination buffer */
+      *dst = circBuffer[rOffset];
+
+      /* Update the input pointer */
+      dst += dstInc;
+
+      if(dst == (int32_t *) dst_end)
+      {
+        dst = dst_base;
+      }
+
+      /* Circularly update rOffset.  Watch out for positive and negative value  */
+      rOffset += bufferInc;
+
+      if(rOffset >= L)
+      {
+        rOffset -= L;
+      }
+
+      /* Decrement the loop counter */
+      i--;
+    }
+
+    /* Update the index pointer */
+    *readOffset = rOffset;
+  }
+
+  /**
+   * @brief Q15 Circular write function.
+   */
+
+  static __INLINE void arm_circularWrite_q15(
+  q15_t * circBuffer,
+  int32_t L,
+  uint16_t * writeOffset,
+  int32_t bufferInc,
+  const q15_t * src,
+  int32_t srcInc,
+  uint32_t blockSize)
+  {
+    uint32_t i = 0u;
+    int32_t wOffset;
+
+    /* Copy the value of Index pointer that points
+     * to the current location where the input samples to be copied */
+    wOffset = *writeOffset;
+
+    /* Loop over the blockSize */
+    i = blockSize;
+
+    while(i > 0u)
+    {
+      /* copy the input sample to the circular buffer */
+      circBuffer[wOffset] = *src;
+
+      /* Update the input pointer */
+      src += srcInc;
+
+      /* Circularly update wOffset.  Watch out for positive and negative value */
+      wOffset += bufferInc;
+      if(wOffset >= L)
+        wOffset -= L;
+
+      /* Decrement the loop counter */
+      i--;
+    }
+
+    /* Update the index pointer */
+    *writeOffset = wOffset;
+  }
+
+
+
+  /**
+   * @brief Q15 Circular Read function.
+   */
+  static __INLINE void arm_circularRead_q15(
+  q15_t * circBuffer,
+  int32_t L,
+  int32_t * readOffset,
+  int32_t bufferInc,
+  q15_t * dst,
+  q15_t * dst_base,
+  int32_t dst_length,
+  int32_t dstInc,
+  uint32_t blockSize)
+  {
+    uint32_t i = 0;
+    int32_t rOffset, dst_end;
+
+    /* Copy the value of Index pointer that points
+     * to the current location from where the input samples to be read */
+    rOffset = *readOffset;
+
+    dst_end = (int32_t) (dst_base + dst_length);
+
+    /* Loop over the blockSize */
+    i = blockSize;
+
+    while(i > 0u)
+    {
+      /* copy the sample from the circular buffer to the destination buffer */
+      *dst = circBuffer[rOffset];
+
+      /* Update the input pointer */
+      dst += dstInc;
+
+      if(dst == (q15_t *) dst_end)
+      {
+        dst = dst_base;
+      }
+
+      /* Circularly update wOffset.  Watch out for positive and negative value */
+      rOffset += bufferInc;
+
+      if(rOffset >= L)
+      {
+        rOffset -= L;
+      }
+
+      /* Decrement the loop counter */
+      i--;
+    }
+
+    /* Update the index pointer */
+    *readOffset = rOffset;
+  }
+
+
+  /**
+   * @brief Q7 Circular write function.
+   */
+
+  static __INLINE void arm_circularWrite_q7(
+  q7_t * circBuffer,
+  int32_t L,
+  uint16_t * writeOffset,
+  int32_t bufferInc,
+  const q7_t * src,
+  int32_t srcInc,
+  uint32_t blockSize)
+  {
+    uint32_t i = 0u;
+    int32_t wOffset;
+
+    /* Copy the value of Index pointer that points
+     * to the current location where the input samples to be copied */
+    wOffset = *writeOffset;
+
+    /* Loop over the blockSize */
+    i = blockSize;
+
+    while(i > 0u)
+    {
+      /* copy the input sample to the circular buffer */
+      circBuffer[wOffset] = *src;
+
+      /* Update the input pointer */
+      src += srcInc;
+
+      /* Circularly update wOffset.  Watch out for positive and negative value */
+      wOffset += bufferInc;
+      if(wOffset >= L)
+        wOffset -= L;
+
+      /* Decrement the loop counter */
+      i--;
+    }
+
+    /* Update the index pointer */
+    *writeOffset = wOffset;
+  }
+
+
+
+  /**
+   * @brief Q7 Circular Read function.
+   */
+  static __INLINE void arm_circularRead_q7(
+  q7_t * circBuffer,
+  int32_t L,
+  int32_t * readOffset,
+  int32_t bufferInc,
+  q7_t * dst,
+  q7_t * dst_base,
+  int32_t dst_length,
+  int32_t dstInc,
+  uint32_t blockSize)
+  {
+    uint32_t i = 0;
+    int32_t rOffset, dst_end;
+
+    /* Copy the value of Index pointer that points
+     * to the current location from where the input samples to be read */
+    rOffset = *readOffset;
+
+    dst_end = (int32_t) (dst_base + dst_length);
+
+    /* Loop over the blockSize */
+    i = blockSize;
+
+    while(i > 0u)
+    {
+      /* copy the sample from the circular buffer to the destination buffer */
+      *dst = circBuffer[rOffset];
+
+      /* Update the input pointer */
+      dst += dstInc;
+
+      if(dst == (q7_t *) dst_end)
+      {
+        dst = dst_base;
+      }
+
+      /* Circularly update rOffset.  Watch out for positive and negative value */
+      rOffset += bufferInc;
+
+      if(rOffset >= L)
+      {
+        rOffset -= L;
+      }
+
+      /* Decrement the loop counter */
+      i--;
+    }
+
+    /* Update the index pointer */
+    *readOffset = rOffset;
+  }
+
+
+  /**
+   * @brief  Sum of the squares of the elements of a Q31 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_power_q31(
+  q31_t * pSrc,
+  uint32_t blockSize,
+  q63_t * pResult);
+
+  /**
+   * @brief  Sum of the squares of the elements of a floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_power_f32(
+  float32_t * pSrc,
+  uint32_t blockSize,
+  float32_t * pResult);
+
+  /**
+   * @brief  Sum of the squares of the elements of a Q15 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_power_q15(
+  q15_t * pSrc,
+  uint32_t blockSize,
+  q63_t * pResult);
+
+  /**
+   * @brief  Sum of the squares of the elements of a Q7 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_power_q7(
+  q7_t * pSrc,
+  uint32_t blockSize,
+  q31_t * pResult);
+
+  /**
+   * @brief  Mean value of a Q7 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_mean_q7(
+  q7_t * pSrc,
+  uint32_t blockSize,
+  q7_t * pResult);
+
+  /**
+   * @brief  Mean value of a Q15 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+  void arm_mean_q15(
+  q15_t * pSrc,
+  uint32_t blockSize,
+  q15_t * pResult);
+
+  /**
+   * @brief  Mean value of a Q31 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+  void arm_mean_q31(
+  q31_t * pSrc,
+  uint32_t blockSize,
+  q31_t * pResult);
+
+  /**
+   * @brief  Mean value of a floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+  void arm_mean_f32(
+  float32_t * pSrc,
+  uint32_t blockSize,
+  float32_t * pResult);
+
+  /**
+   * @brief  Variance of the elements of a floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_var_f32(
+  float32_t * pSrc,
+  uint32_t blockSize,
+  float32_t * pResult);
+
+  /**
+   * @brief  Variance of the elements of a Q31 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_var_q31(
+  q31_t * pSrc,
+  uint32_t blockSize,
+  q63_t * pResult);
+
+  /**
+   * @brief  Variance of the elements of a Q15 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_var_q15(
+  q15_t * pSrc,
+  uint32_t blockSize,
+  q31_t * pResult);
+
+  /**
+   * @brief  Root Mean Square of the elements of a floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_rms_f32(
+  float32_t * pSrc,
+  uint32_t blockSize,
+  float32_t * pResult);
+
+  /**
+   * @brief  Root Mean Square of the elements of a Q31 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_rms_q31(
+  q31_t * pSrc,
+  uint32_t blockSize,
+  q31_t * pResult);
+
+  /**
+   * @brief  Root Mean Square of the elements of a Q15 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_rms_q15(
+  q15_t * pSrc,
+  uint32_t blockSize,
+  q15_t * pResult);
+
+  /**
+   * @brief  Standard deviation of the elements of a floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_std_f32(
+  float32_t * pSrc,
+  uint32_t blockSize,
+  float32_t * pResult);
+
+  /**
+   * @brief  Standard deviation of the elements of a Q31 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_std_q31(
+  q31_t * pSrc,
+  uint32_t blockSize,
+  q31_t * pResult);
+
+  /**
+   * @brief  Standard deviation of the elements of a Q15 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output value.
+   * @return none.
+   */
+
+  void arm_std_q15(
+  q15_t * pSrc,
+  uint32_t blockSize,
+  q15_t * pResult);
+
+  /**
+   * @brief  Floating-point complex magnitude
+   * @param[in]  *pSrc points to the complex input vector
+   * @param[out]  *pDst points to the real output vector
+   * @param[in]  numSamples number of complex samples in the input vector
+   * @return none.
+   */
+
+  void arm_cmplx_mag_f32(
+  float32_t * pSrc,
+  float32_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q31 complex magnitude
+   * @param[in]  *pSrc points to the complex input vector
+   * @param[out]  *pDst points to the real output vector
+   * @param[in]  numSamples number of complex samples in the input vector
+   * @return none.
+   */
+
+  void arm_cmplx_mag_q31(
+  q31_t * pSrc,
+  q31_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q15 complex magnitude
+   * @param[in]  *pSrc points to the complex input vector
+   * @param[out]  *pDst points to the real output vector
+   * @param[in]  numSamples number of complex samples in the input vector
+   * @return none.
+   */
+
+  void arm_cmplx_mag_q15(
+  q15_t * pSrc,
+  q15_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q15 complex dot product
+   * @param[in]  *pSrcA points to the first input vector
+   * @param[in]  *pSrcB points to the second input vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @param[out]  *realResult real part of the result returned here
+   * @param[out]  *imagResult imaginary part of the result returned here
+   * @return none.
+   */
+
+  void arm_cmplx_dot_prod_q15(
+  q15_t * pSrcA,
+  q15_t * pSrcB,
+  uint32_t numSamples,
+  q31_t * realResult,
+  q31_t * imagResult);
+
+  /**
+   * @brief  Q31 complex dot product
+   * @param[in]  *pSrcA points to the first input vector
+   * @param[in]  *pSrcB points to the second input vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @param[out]  *realResult real part of the result returned here
+   * @param[out]  *imagResult imaginary part of the result returned here
+   * @return none.
+   */
+
+  void arm_cmplx_dot_prod_q31(
+  q31_t * pSrcA,
+  q31_t * pSrcB,
+  uint32_t numSamples,
+  q63_t * realResult,
+  q63_t * imagResult);
+
+  /**
+   * @brief  Floating-point complex dot product
+   * @param[in]  *pSrcA points to the first input vector
+   * @param[in]  *pSrcB points to the second input vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @param[out]  *realResult real part of the result returned here
+   * @param[out]  *imagResult imaginary part of the result returned here
+   * @return none.
+   */
+
+  void arm_cmplx_dot_prod_f32(
+  float32_t * pSrcA,
+  float32_t * pSrcB,
+  uint32_t numSamples,
+  float32_t * realResult,
+  float32_t * imagResult);
+
+  /**
+   * @brief  Q15 complex-by-real multiplication
+   * @param[in]  *pSrcCmplx points to the complex input vector
+   * @param[in]  *pSrcReal points to the real input vector
+   * @param[out]  *pCmplxDst points to the complex output vector
+   * @param[in]  numSamples number of samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_mult_real_q15(
+  q15_t * pSrcCmplx,
+  q15_t * pSrcReal,
+  q15_t * pCmplxDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q31 complex-by-real multiplication
+   * @param[in]  *pSrcCmplx points to the complex input vector
+   * @param[in]  *pSrcReal points to the real input vector
+   * @param[out]  *pCmplxDst points to the complex output vector
+   * @param[in]  numSamples number of samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_mult_real_q31(
+  q31_t * pSrcCmplx,
+  q31_t * pSrcReal,
+  q31_t * pCmplxDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Floating-point complex-by-real multiplication
+   * @param[in]  *pSrcCmplx points to the complex input vector
+   * @param[in]  *pSrcReal points to the real input vector
+   * @param[out]  *pCmplxDst points to the complex output vector
+   * @param[in]  numSamples number of samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_mult_real_f32(
+  float32_t * pSrcCmplx,
+  float32_t * pSrcReal,
+  float32_t * pCmplxDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Minimum value of a Q7 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *result is output pointer
+   * @param[in]  index is the array index of the minimum value in the input buffer.
+   * @return none.
+   */
+
+  void arm_min_q7(
+  q7_t * pSrc,
+  uint32_t blockSize,
+  q7_t * result,
+  uint32_t * index);
+
+  /**
+   * @brief  Minimum value of a Q15 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output pointer
+   * @param[in]  *pIndex is the array index of the minimum value in the input buffer.
+   * @return none.
+   */
+
+  void arm_min_q15(
+  q15_t * pSrc,
+  uint32_t blockSize,
+  q15_t * pResult,
+  uint32_t * pIndex);
+
+  /**
+   * @brief  Minimum value of a Q31 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output pointer
+   * @param[out]  *pIndex is the array index of the minimum value in the input buffer.
+   * @return none.
+   */
+  void arm_min_q31(
+  q31_t * pSrc,
+  uint32_t blockSize,
+  q31_t * pResult,
+  uint32_t * pIndex);
+
+  /**
+   * @brief  Minimum value of a floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @param[out]  *pResult is output pointer
+   * @param[out]  *pIndex is the array index of the minimum value in the input buffer.
+   * @return none.
+   */
+
+  void arm_min_f32(
+  float32_t * pSrc,
+  uint32_t blockSize,
+  float32_t * pResult,
+  uint32_t * pIndex);
+
+/**
+ * @brief Maximum value of a Q7 vector.
+ * @param[in]       *pSrc points to the input buffer
+ * @param[in]       blockSize length of the input vector
+ * @param[out]      *pResult maximum value returned here
+ * @param[out]      *pIndex index of maximum value returned here
+ * @return none.
+ */
+
+  void arm_max_q7(
+  q7_t * pSrc,
+  uint32_t blockSize,
+  q7_t * pResult,
+  uint32_t * pIndex);
+
+/**
+ * @brief Maximum value of a Q15 vector.
+ * @param[in]       *pSrc points to the input buffer
+ * @param[in]       blockSize length of the input vector
+ * @param[out]      *pResult maximum value returned here
+ * @param[out]      *pIndex index of maximum value returned here
+ * @return none.
+ */
+
+  void arm_max_q15(
+  q15_t * pSrc,
+  uint32_t blockSize,
+  q15_t * pResult,
+  uint32_t * pIndex);
+
+/**
+ * @brief Maximum value of a Q31 vector.
+ * @param[in]       *pSrc points to the input buffer
+ * @param[in]       blockSize length of the input vector
+ * @param[out]      *pResult maximum value returned here
+ * @param[out]      *pIndex index of maximum value returned here
+ * @return none.
+ */
+
+  void arm_max_q31(
+  q31_t * pSrc,
+  uint32_t blockSize,
+  q31_t * pResult,
+  uint32_t * pIndex);
+
+/**
+ * @brief Maximum value of a floating-point vector.
+ * @param[in]       *pSrc points to the input buffer
+ * @param[in]       blockSize length of the input vector
+ * @param[out]      *pResult maximum value returned here
+ * @param[out]      *pIndex index of maximum value returned here
+ * @return none.
+ */
+
+  void arm_max_f32(
+  float32_t * pSrc,
+  uint32_t blockSize,
+  float32_t * pResult,
+  uint32_t * pIndex);
+
+  /**
+   * @brief  Q15 complex-by-complex multiplication
+   * @param[in]  *pSrcA points to the first input vector
+   * @param[in]  *pSrcB points to the second input vector
+   * @param[out]  *pDst  points to the output vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_mult_cmplx_q15(
+  q15_t * pSrcA,
+  q15_t * pSrcB,
+  q15_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Q31 complex-by-complex multiplication
+   * @param[in]  *pSrcA points to the first input vector
+   * @param[in]  *pSrcB points to the second input vector
+   * @param[out]  *pDst  points to the output vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_mult_cmplx_q31(
+  q31_t * pSrcA,
+  q31_t * pSrcB,
+  q31_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief  Floating-point complex-by-complex multiplication
+   * @param[in]  *pSrcA points to the first input vector
+   * @param[in]  *pSrcB points to the second input vector
+   * @param[out]  *pDst  points to the output vector
+   * @param[in]  numSamples number of complex samples in each vector
+   * @return none.
+   */
+
+  void arm_cmplx_mult_cmplx_f32(
+  float32_t * pSrcA,
+  float32_t * pSrcB,
+  float32_t * pDst,
+  uint32_t numSamples);
+
+  /**
+   * @brief Converts the elements of the floating-point vector to Q31 vector.
+   * @param[in]       *pSrc points to the floating-point input vector
+   * @param[out]      *pDst points to the Q31 output vector
+   * @param[in]       blockSize length of the input vector
+   * @return none.
+   */
+  void arm_float_to_q31(
+  float32_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Converts the elements of the floating-point vector to Q15 vector.
+   * @param[in]       *pSrc points to the floating-point input vector
+   * @param[out]      *pDst points to the Q15 output vector
+   * @param[in]       blockSize length of the input vector
+   * @return          none
+   */
+  void arm_float_to_q15(
+  float32_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief Converts the elements of the floating-point vector to Q7 vector.
+   * @param[in]       *pSrc points to the floating-point input vector
+   * @param[out]      *pDst points to the Q7 output vector
+   * @param[in]       blockSize length of the input vector
+   * @return          none
+   */
+  void arm_float_to_q7(
+  float32_t * pSrc,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Converts the elements of the Q31 vector to Q15 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[out]  *pDst is output pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @return none.
+   */
+  void arm_q31_to_q15(
+  q31_t * pSrc,
+  q15_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Converts the elements of the Q31 vector to Q7 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[out]  *pDst is output pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @return none.
+   */
+  void arm_q31_to_q7(
+  q31_t * pSrc,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+  /**
+   * @brief  Converts the elements of the Q15 vector to floating-point vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[out]  *pDst is output pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @return none.
+   */
+  void arm_q15_to_float(
+  q15_t * pSrc,
+  float32_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Converts the elements of the Q15 vector to Q31 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[out]  *pDst is output pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @return none.
+   */
+  void arm_q15_to_q31(
+  q15_t * pSrc,
+  q31_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @brief  Converts the elements of the Q15 vector to Q7 vector.
+   * @param[in]  *pSrc is input pointer
+   * @param[out]  *pDst is output pointer
+   * @param[in]  blockSize is the number of samples to process
+   * @return none.
+   */
+  void arm_q15_to_q7(
+  q15_t * pSrc,
+  q7_t * pDst,
+  uint32_t blockSize);
+
+
+  /**
+   * @ingroup groupInterpolation
+   */
+
+  /**
+   * @defgroup BilinearInterpolate Bilinear Interpolation
+   *
+   * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
+   * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
+   * determines values between the grid points.
+   * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
+   * Bilinear interpolation is often used in image processing to rescale images.
+   * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
+   *
+   * <b>Algorithm</b>
+   * \par
+   * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
+   * For floating-point, the instance structure is defined as:
+   * <pre>
+   *   typedef struct
+   *   {
+   *     uint16_t numRows;
+   *     uint16_t numCols;
+   *     float32_t *pData;
+   * } arm_bilinear_interp_instance_f32;
+   * </pre>
+   *
+   * \par
+   * where <code>numRows</code> specifies the number of rows in the table;
+   * <code>numCols</code> specifies the number of columns in the table;
+   * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
+   * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
+   * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
+   *
+   * \par
+   * Let <code>(x, y)</code> specify the desired interpolation point.  Then define:
+   * <pre>
+   *     XF = floor(x)
+   *     YF = floor(y)
+   * </pre>
+   * \par
+   * The interpolated output point is computed as:
+   * <pre>
+   *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
+   *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))
+   *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)
+   *           + f(XF+1, YF+1) * (x-XF)*(y-YF)
+   * </pre>
+   * Note that the coordinates (x, y) contain integer and fractional components.
+   * The integer components specify which portion of the table to use while the
+   * fractional components control the interpolation processor.
+   *
+   * \par
+   * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
+   */
+
+  /**
+   * @addtogroup BilinearInterpolate
+   * @{
+   */
+
+  /**
+  *
+  * @brief  Floating-point bilinear interpolation.
+  * @param[in,out] *S points to an instance of the interpolation structure.
+  * @param[in] X interpolation coordinate.
+  * @param[in] Y interpolation coordinate.
+  * @return out interpolated value.
+  */
+
+
+  static __INLINE float32_t arm_bilinear_interp_f32(
+  const arm_bilinear_interp_instance_f32 * S,
+  float32_t X,
+  float32_t Y)
+  {
+    float32_t out;
+    float32_t f00, f01, f10, f11;
+    float32_t *pData = S->pData;
+    int32_t xIndex, yIndex, index;
+    float32_t xdiff, ydiff;
+    float32_t b1, b2, b3, b4;
+
+    xIndex = (int32_t) X;
+    yIndex = (int32_t) Y;
+
+    /* Care taken for table outside boundary */
+    /* Returns zero output when values are outside table boundary */
+    if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
+       || yIndex > (S->numCols - 1))
+    {
+      return (0);
+    }
+
+    /* Calculation of index for two nearest points in X-direction */
+    index = (xIndex - 1) + (yIndex - 1) * S->numCols;
+
+
+    /* Read two nearest points in X-direction */
+    f00 = pData[index];
+    f01 = pData[index + 1];
+
+    /* Calculation of index for two nearest points in Y-direction */
+    index = (xIndex - 1) + (yIndex) * S->numCols;
+
+
+    /* Read two nearest points in Y-direction */
+    f10 = pData[index];
+    f11 = pData[index + 1];
+
+    /* Calculation of intermediate values */
+    b1 = f00;
+    b2 = f01 - f00;
+    b3 = f10 - f00;
+    b4 = f00 - f01 - f10 + f11;
+
+    /* Calculation of fractional part in X */
+    xdiff = X - xIndex;
+
+    /* Calculation of fractional part in Y */
+    ydiff = Y - yIndex;
+
+    /* Calculation of bi-linear interpolated output */
+    out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
+
+    /* return to application */
+    return (out);
+
+  }
+
+  /**
+  *
+  * @brief  Q31 bilinear interpolation.
+  * @param[in,out] *S points to an instance of the interpolation structure.
+  * @param[in] X interpolation coordinate in 12.20 format.
+  * @param[in] Y interpolation coordinate in 12.20 format.
+  * @return out interpolated value.
+  */
+
+  static __INLINE q31_t arm_bilinear_interp_q31(
+  arm_bilinear_interp_instance_q31 * S,
+  q31_t X,
+  q31_t Y)
+  {
+    q31_t out;                                   /* Temporary output */
+    q31_t acc = 0;                               /* output */
+    q31_t xfract, yfract;                        /* X, Y fractional parts */
+    q31_t x1, x2, y1, y2;                        /* Nearest output values */
+    int32_t rI, cI;                              /* Row and column indices */
+    q31_t *pYData = S->pData;                    /* pointer to output table values */
+    uint32_t nCols = S->numCols;                 /* num of rows */
+
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    rI = ((X & 0xFFF00000) >> 20u);
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    cI = ((Y & 0xFFF00000) >> 20u);
+
+    /* Care taken for table outside boundary */
+    /* Returns zero output when values are outside table boundary */
+    if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
+    {
+      return (0);
+    }
+
+    /* 20 bits for the fractional part */
+    /* shift left xfract by 11 to keep 1.31 format */
+    xfract = (X & 0x000FFFFF) << 11u;
+
+    /* Read two nearest output values from the index */
+    x1 = pYData[(rI) + nCols * (cI)];
+    x2 = pYData[(rI) + nCols * (cI) + 1u];
+
+    /* 20 bits for the fractional part */
+    /* shift left yfract by 11 to keep 1.31 format */
+    yfract = (Y & 0x000FFFFF) << 11u;
+
+    /* Read two nearest output values from the index */
+    y1 = pYData[(rI) + nCols * (cI + 1)];
+    y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
+
+    /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
+    out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
+    acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
+
+    /* x2 * (xfract) * (1-yfract)  in 3.29(q29) and adding to acc */
+    out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
+    acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
+
+    /* y1 * (1 - xfract) * (yfract)  in 3.29(q29) and adding to acc */
+    out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
+    acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
+
+    /* y2 * (xfract) * (yfract)  in 3.29(q29) and adding to acc */
+    out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
+    acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
+
+    /* Convert acc to 1.31(q31) format */
+    return (acc << 2u);
+
+  }
+
+  /**
+  * @brief  Q15 bilinear interpolation.
+  * @param[in,out] *S points to an instance of the interpolation structure.
+  * @param[in] X interpolation coordinate in 12.20 format.
+  * @param[in] Y interpolation coordinate in 12.20 format.
+  * @return out interpolated value.
+  */
+
+  static __INLINE q15_t arm_bilinear_interp_q15(
+  arm_bilinear_interp_instance_q15 * S,
+  q31_t X,
+  q31_t Y)
+  {
+    q63_t acc = 0;                               /* output */
+    q31_t out;                                   /* Temporary output */
+    q15_t x1, x2, y1, y2;                        /* Nearest output values */
+    q31_t xfract, yfract;                        /* X, Y fractional parts */
+    int32_t rI, cI;                              /* Row and column indices */
+    q15_t *pYData = S->pData;                    /* pointer to output table values */
+    uint32_t nCols = S->numCols;                 /* num of rows */
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    rI = ((X & 0xFFF00000) >> 20);
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    cI = ((Y & 0xFFF00000) >> 20);
+
+    /* Care taken for table outside boundary */
+    /* Returns zero output when values are outside table boundary */
+    if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
+    {
+      return (0);
+    }
+
+    /* 20 bits for the fractional part */
+    /* xfract should be in 12.20 format */
+    xfract = (X & 0x000FFFFF);
+
+    /* Read two nearest output values from the index */
+    x1 = pYData[(rI) + nCols * (cI)];
+    x2 = pYData[(rI) + nCols * (cI) + 1u];
+
+
+    /* 20 bits for the fractional part */
+    /* yfract should be in 12.20 format */
+    yfract = (Y & 0x000FFFFF);
+
+    /* Read two nearest output values from the index */
+    y1 = pYData[(rI) + nCols * (cI + 1)];
+    y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
+
+    /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
+
+    /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
+    /* convert 13.35 to 13.31 by right shifting  and out is in 1.31 */
+    out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
+    acc = ((q63_t) out * (0xFFFFF - yfract));
+
+    /* x2 * (xfract) * (1-yfract)  in 1.51 and adding to acc */
+    out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
+    acc += ((q63_t) out * (xfract));
+
+    /* y1 * (1 - xfract) * (yfract)  in 1.51 and adding to acc */
+    out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
+    acc += ((q63_t) out * (yfract));
+
+    /* y2 * (xfract) * (yfract)  in 1.51 and adding to acc */
+    out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
+    acc += ((q63_t) out * (yfract));
+
+    /* acc is in 13.51 format and down shift acc by 36 times */
+    /* Convert out to 1.15 format */
+    return (acc >> 36);
+
+  }
+
+  /**
+  * @brief  Q7 bilinear interpolation.
+  * @param[in,out] *S points to an instance of the interpolation structure.
+  * @param[in] X interpolation coordinate in 12.20 format.
+  * @param[in] Y interpolation coordinate in 12.20 format.
+  * @return out interpolated value.
+  */
+
+  static __INLINE q7_t arm_bilinear_interp_q7(
+  arm_bilinear_interp_instance_q7 * S,
+  q31_t X,
+  q31_t Y)
+  {
+    q63_t acc = 0;                               /* output */
+    q31_t out;                                   /* Temporary output */
+    q31_t xfract, yfract;                        /* X, Y fractional parts */
+    q7_t x1, x2, y1, y2;                         /* Nearest output values */
+    int32_t rI, cI;                              /* Row and column indices */
+    q7_t *pYData = S->pData;                     /* pointer to output table values */
+    uint32_t nCols = S->numCols;                 /* num of rows */
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    rI = ((X & 0xFFF00000) >> 20);
+
+    /* Input is in 12.20 format */
+    /* 12 bits for the table index */
+    /* Index value calculation */
+    cI = ((Y & 0xFFF00000) >> 20);
+
+    /* Care taken for table outside boundary */
+    /* Returns zero output when values are outside table boundary */
+    if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
+    {
+      return (0);
+    }
+
+    /* 20 bits for the fractional part */
+    /* xfract should be in 12.20 format */
+    xfract = (X & 0x000FFFFF);
+
+    /* Read two nearest output values from the index */
+    x1 = pYData[(rI) + nCols * (cI)];
+    x2 = pYData[(rI) + nCols * (cI) + 1u];
+
+
+    /* 20 bits for the fractional part */
+    /* yfract should be in 12.20 format */
+    yfract = (Y & 0x000FFFFF);
+
+    /* Read two nearest output values from the index */
+    y1 = pYData[(rI) + nCols * (cI + 1)];
+    y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
+
+    /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
+    out = ((x1 * (0xFFFFF - xfract)));
+    acc = (((q63_t) out * (0xFFFFF - yfract)));
+
+    /* x2 * (xfract) * (1-yfract)  in 2.22 and adding to acc */
+    out = ((x2 * (0xFFFFF - yfract)));
+    acc += (((q63_t) out * (xfract)));
+
+    /* y1 * (1 - xfract) * (yfract)  in 2.22 and adding to acc */
+    out = ((y1 * (0xFFFFF - xfract)));
+    acc += (((q63_t) out * (yfract)));
+
+    /* y2 * (xfract) * (yfract)  in 2.22 and adding to acc */
+    out = ((y2 * (yfract)));
+    acc += (((q63_t) out * (xfract)));
+
+    /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
+    return (acc >> 40);
+
+  }
+
+  /**
+   * @} end of BilinearInterpolate group
+   */
+
+
+#if   defined ( __CC_ARM ) //Keil
+//SMMLAR
+  #define multAcc_32x32_keep32_R(a, x, y) \
+  a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
+
+//SMMLSR
+  #define multSub_32x32_keep32_R(a, x, y) \
+  a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
+
+//SMMULR
+  #define mult_32x32_keep32_R(a, x, y) \
+  a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
+
+//Enter low optimization region - place directly above function definition
+  #define LOW_OPTIMIZATION_ENTER \
+     _Pragma ("push")         \
+     _Pragma ("O1")
+
+//Exit low optimization region - place directly after end of function definition
+  #define LOW_OPTIMIZATION_EXIT \
+     _Pragma ("pop")
+
+//Enter low optimization region - place directly above function definition
+  #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+
+//Exit low optimization region - place directly after end of function definition
+  #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined(__ICCARM__) //IAR
+ //SMMLA
+  #define multAcc_32x32_keep32_R(a, x, y) \
+  a += (q31_t) (((q63_t) x * y) >> 32)
+
+ //SMMLS
+  #define multSub_32x32_keep32_R(a, x, y) \
+  a -= (q31_t) (((q63_t) x * y) >> 32)
+
+//SMMUL
+  #define mult_32x32_keep32_R(a, x, y) \
+  a = (q31_t) (((q63_t) x * y ) >> 32)
+
+//Enter low optimization region - place directly above function definition
+  #define LOW_OPTIMIZATION_ENTER \
+     _Pragma ("optimize=low")
+
+//Exit low optimization region - place directly after end of function definition
+  #define LOW_OPTIMIZATION_EXIT
+
+//Enter low optimization region - place directly above function definition
+  #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
+     _Pragma ("optimize=low")
+
+//Exit low optimization region - place directly after end of function definition
+  #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined(__GNUC__)
+ //SMMLA
+  #define multAcc_32x32_keep32_R(a, x, y) \
+  a += (q31_t) (((q63_t) x * y) >> 32)
+
+ //SMMLS
+  #define multSub_32x32_keep32_R(a, x, y) \
+  a -= (q31_t) (((q63_t) x * y) >> 32)
+
+//SMMUL
+  #define mult_32x32_keep32_R(a, x, y) \
+  a = (q31_t) (((q63_t) x * y ) >> 32)
+
+  #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
+
+  #define LOW_OPTIMIZATION_EXIT
+
+  #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+
+  #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#endif
+
+
+
+
+
+#ifdef	__cplusplus
+}
+#endif
+
+
+#endif /* _ARM_MATH_H */
+
+
+/**
+ *
+ * End of file.
+ */

+ 682 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_cm0.h

@@ -0,0 +1,682 @@
+/**************************************************************************//**
+ * @file     core_cm0.h
+ * @brief    CMSIS Cortex-M0 Core Peripheral Access Layer Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include  /* treat file as system include file for MISRA check */
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifndef __CORE_CM0_H_GENERIC
+#define __CORE_CM0_H_GENERIC
+
+/** \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
+  CMSIS violates the following MISRA-C:2004 rules:
+
+   \li Required Rule 8.5, object/function definition in header file.<br>
+     Function definitions in header files are used to allow 'inlining'.
+
+   \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+     Unions are used for effective representation of core registers.
+
+   \li Advisory Rule 19.7, Function-like macro defined.<br>
+     Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ *                 CMSIS definitions
+ ******************************************************************************/
+/** \ingroup Cortex_M0
+  @{
+ */
+
+/*  CMSIS CM0 definitions */
+#define __CM0_CMSIS_VERSION_MAIN  (0x03)                                   /*!< [31:16] CMSIS HAL main version   */
+#define __CM0_CMSIS_VERSION_SUB   (0x20)                                   /*!< [15:0]  CMSIS HAL sub version    */
+#define __CM0_CMSIS_VERSION       ((__CM0_CMSIS_VERSION_MAIN << 16) | \
+                                    __CM0_CMSIS_VERSION_SUB          )     /*!< CMSIS HAL version number         */
+
+#define __CORTEX_M                (0x00)                                   /*!< Cortex-M Core                    */
+
+
+#if   defined ( __CC_ARM )
+  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
+  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
+  #define __STATIC_INLINE  static __inline
+
+#elif defined ( __ICCARM__ )
+  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __GNUC__ )
+  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TASKING__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
+  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
+  #define __STATIC_INLINE  static inline
+
+#endif
+
+/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all
+*/
+#define __FPU_USED       0
+
+#if defined ( __CC_ARM )
+  #if defined __TARGET_FPU_VFP
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __ICCARM__ )
+  #if defined __ARMVFP__
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __GNUC__ )
+  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __TASKING__ )
+  #if defined __FPU_VFP__
+    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+#endif
+
+#include <stdint.h>                      /* standard types definitions                      */
+#include <core_cmInstr.h>                /* Core Instruction Access                         */
+#include <core_cmFunc.h>                 /* Core Function Access                            */
+
+#endif /* __CORE_CM0_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM0_H_DEPENDANT
+#define __CORE_CM0_H_DEPENDANT
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+  #ifndef __CM0_REV
+    #define __CM0_REV               0x0000
+    #warning "__CM0_REV not defined in device header file; using default!"
+  #endif
+
+  #ifndef __NVIC_PRIO_BITS
+    #define __NVIC_PRIO_BITS          2
+    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+  #endif
+
+  #ifndef __Vendor_SysTickConfig
+    #define __Vendor_SysTickConfig    0
+    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+  #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+    \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+    <strong>IO Type Qualifiers</strong> are used
+    \li to specify the access to peripheral variables.
+    \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
+#else
+  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
+#endif
+#define     __O     volatile             /*!< Defines 'write only' permissions                */
+#define     __IO    volatile             /*!< Defines 'read / write' permissions              */
+
+/*@} end of group Cortex_M0 */
+
+
+
+/*******************************************************************************
+ *                 Register Abstraction
+  Core Register contain:
+  - Core Register
+  - Core NVIC Register
+  - Core SCB Register
+  - Core SysTick Register
+ ******************************************************************************/
+/** \defgroup CMSIS_core_register Defines and Type Definitions
+    \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_CORE  Status and Control Registers
+    \brief  Core Register type definitions.
+  @{
+ */
+
+/** \brief  Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+  struct
+  {
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:27;              /*!< bit:  0..26  Reserved                           */
+#else
+    uint32_t _reserved0:16;              /*!< bit:  0..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:7;               /*!< bit: 20..26  Reserved                           */
+#endif
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} APSR_Type;
+
+
+/** \brief  Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} IPSR_Type;
+
+
+/** \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved                           */
+#else
+    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved                           */
+#endif
+    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0)          */
+    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0)          */
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} xPSR_Type;
+
+
+/** \brief  Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t nPRIV:1;                    /*!< bit:      0  Execution privilege in Thread mode */
+    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used                   */
+    uint32_t FPCA:1;                     /*!< bit:      2  FP extension active flag           */
+    uint32_t _reserved0:29;              /*!< bit:  3..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} CONTROL_Type;
+
+/*@} end of group CMSIS_CORE */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
+    \brief      Type definitions for the NVIC Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+  __IO uint32_t ISER[1];                 /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register           */
+       uint32_t RESERVED0[31];
+  __IO uint32_t ICER[1];                 /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register          */
+       uint32_t RSERVED1[31];
+  __IO uint32_t ISPR[1];                 /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register           */
+       uint32_t RESERVED2[31];
+  __IO uint32_t ICPR[1];                 /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register         */
+       uint32_t RESERVED3[31];
+       uint32_t RESERVED4[64];
+  __IO uint32_t IP[8];                   /*!< Offset: 0x300 (R/W)  Interrupt Priority Register              */
+}  NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCB     System Control Block (SCB)
+    \brief      Type definitions for the System Control Block Registers
+  @{
+ */
+
+/** \brief  Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
+  __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
+       uint32_t RESERVED0;
+  __IO uint32_t AIRCR;                   /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register      */
+  __IO uint32_t SCR;                     /*!< Offset: 0x010 (R/W)  System Control Register                               */
+  __IO uint32_t CCR;                     /*!< Offset: 0x014 (R/W)  Configuration Control Register                        */
+       uint32_t RESERVED1;
+  __IO uint32_t SHP[2];                  /*!< Offset: 0x01C (R/W)  System Handlers Priority Registers. [0] is RESERVED   */
+  __IO uint32_t SHCSR;                   /*!< Offset: 0x024 (R/W)  System Handler Control and State Register             */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos          24                                             /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos              20                                             /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos         16                                             /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos                4                                             /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos              0                                             /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk             (0xFUL << SCB_CPUID_REVISION_Pos)              /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos            31                                             /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos             28                                             /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos             27                                             /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos             26                                             /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos             25                                             /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos            23                                             /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos            22                                             /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos           12                                             /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos             0                                             /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos)           /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos              16                                             /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos          16                                             /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos            15                                             /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos           2                                             /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos         1                                             /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos               4                                             /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos               2                                             /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos             1                                             /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos                9                                             /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos             3                                             /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos         15                                             /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
+    \brief      Type definitions for the System Timer Registers.
+  @{
+ */
+
+/** \brief  Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
+  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
+  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
+  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk            (1UL << SysTick_CTRL_ENABLE_Pos)               /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos)        /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
+    \brief      Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR)
+                are only accessible over DAP and not via processor. Therefore
+                they are not covered by the Cortex-M0 header file.
+  @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_core_base     Core Definitions
+    \brief      Definitions for base addresses, unions, and structures.
+  @{
+ */
+
+/* Memory mapping of Cortex-M0 Hardware */
+#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
+#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address              */
+#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address                 */
+#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address */
+
+#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct           */
+#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct       */
+#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct          */
+
+
+/*@} */
+
+
+
+/*******************************************************************************
+ *                Hardware Abstraction Layer
+  Core Function Interface contains:
+  - Core NVIC Functions
+  - Core SysTick Functions
+  - Core Register Access Functions
+ ******************************************************************************/
+/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ##########################   NVIC functions  #################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+    \brief      Functions that manage interrupts and exceptions via the NVIC.
+    @{
+ */
+
+/* Interrupt Priorities are WORD accessible only under ARMv6M                   */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn)         (  (((uint32_t)(IRQn)       )    &  0x03) * 8 )
+#define _SHP_IDX(IRQn)           ( ((((uint32_t)(IRQn) & 0x0F)-8) >>    2)     )
+#define _IP_IDX(IRQn)            (   ((uint32_t)(IRQn)            >>    2)     )
+
+
+/** \brief  Enable External Interrupt
+
+    The function enables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Disable External Interrupt
+
+    The function disables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Get Pending Interrupt
+
+    The function reads the pending register in the NVIC and returns the pending bit
+    for the specified interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not pending.
+    \return             1  Interrupt status is pending.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+  return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0));
+}
+
+
+/** \brief  Set Pending Interrupt
+
+    The function sets the pending bit of an external interrupt.
+
+    \param [in]      IRQn  Interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Clear Pending Interrupt
+
+    The function clears the pending bit of an external interrupt.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
+}
+
+
+/** \brief  Set Interrupt Priority
+
+    The function sets the priority of an interrupt.
+
+    \note The priority cannot be set for every core interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+    \param [in]  priority  Priority to set.
+ */
+__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+  if(IRQn < 0) {
+    SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
+        (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
+  else {
+    NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
+        (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
+}
+
+
+/** \brief  Get Interrupt Priority
+
+    The function reads the priority of an interrupt. The interrupt
+    number can be positive to specify an external (device specific)
+    interrupt, or negative to specify an internal (core) interrupt.
+
+
+    \param [in]   IRQn  Interrupt number.
+    \return             Interrupt Priority. Value is aligned automatically to the implemented
+                        priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+  if(IRQn < 0) {
+    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M0 system interrupts */
+  else {
+    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts  */
+}
+
+
+/** \brief  System Reset
+
+    The function initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void NVIC_SystemReset(void)
+{
+  __DSB();                                                     /* Ensure all outstanding memory accesses included
+                                                                  buffered write are completed before reset */
+  SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
+                 SCB_AIRCR_SYSRESETREQ_Msk);
+  __DSB();                                                     /* Ensure completion of memory access */
+  while(1);                                                    /* wait until reset */
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+
+/* ##################################    SysTick function  ############################################ */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+    \brief      Functions that configure the System.
+  @{
+ */
+
+#if (__Vendor_SysTickConfig == 0)
+
+/** \brief  System Tick Configuration
+
+    The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
+    Counter is in free running mode to generate periodic interrupts.
+
+    \param [in]  ticks  Number of ticks between two interrupts.
+
+    \return          0  Function succeeded.
+    \return          1  Function failed.
+
+    \note     When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+    function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+    must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+  if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)  return (1);      /* Reload value impossible */
+
+  SysTick->LOAD  = ticks - 1;                                  /* set reload register */
+  NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);  /* set Priority for Systick Interrupt */
+  SysTick->VAL   = 0;                                          /* Load the SysTick Counter Value */
+  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
+                   SysTick_CTRL_TICKINT_Msk   |
+                   SysTick_CTRL_ENABLE_Msk;                    /* Enable SysTick IRQ and SysTick Timer */
+  return (0);                                                  /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#endif /* __CORE_CM0_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
+
+#ifdef __cplusplus
+}
+#endif

+ 793 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_cm0plus.h

@@ -0,0 +1,793 @@
+/**************************************************************************//**
+ * @file     core_cm0plus.h
+ * @brief    CMSIS Cortex-M0+ Core Peripheral Access Layer Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include  /* treat file as system include file for MISRA check */
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifndef __CORE_CM0PLUS_H_GENERIC
+#define __CORE_CM0PLUS_H_GENERIC
+
+/** \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
+  CMSIS violates the following MISRA-C:2004 rules:
+
+   \li Required Rule 8.5, object/function definition in header file.<br>
+     Function definitions in header files are used to allow 'inlining'.
+
+   \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+     Unions are used for effective representation of core registers.
+
+   \li Advisory Rule 19.7, Function-like macro defined.<br>
+     Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ *                 CMSIS definitions
+ ******************************************************************************/
+/** \ingroup Cortex-M0+
+  @{
+ */
+
+/*  CMSIS CM0P definitions */
+#define __CM0PLUS_CMSIS_VERSION_MAIN (0x03)                                /*!< [31:16] CMSIS HAL main version   */
+#define __CM0PLUS_CMSIS_VERSION_SUB  (0x20)                                /*!< [15:0]  CMSIS HAL sub version    */
+#define __CM0PLUS_CMSIS_VERSION      ((__CM0PLUS_CMSIS_VERSION_MAIN << 16) | \
+                                       __CM0PLUS_CMSIS_VERSION_SUB)        /*!< CMSIS HAL version number         */
+
+#define __CORTEX_M                (0x00)                                   /*!< Cortex-M Core                    */
+
+
+#if   defined ( __CC_ARM )
+  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
+  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
+  #define __STATIC_INLINE  static __inline
+
+#elif defined ( __ICCARM__ )
+  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __GNUC__ )
+  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TASKING__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
+  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
+  #define __STATIC_INLINE  static inline
+
+#endif
+
+/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all
+*/
+#define __FPU_USED       0
+
+#if defined ( __CC_ARM )
+  #if defined __TARGET_FPU_VFP
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __ICCARM__ )
+  #if defined __ARMVFP__
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __GNUC__ )
+  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __TASKING__ )
+  #if defined __FPU_VFP__
+    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+#endif
+
+#include <stdint.h>                      /* standard types definitions                      */
+#include <core_cmInstr.h>                /* Core Instruction Access                         */
+#include <core_cmFunc.h>                 /* Core Function Access                            */
+
+#endif /* __CORE_CM0PLUS_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM0PLUS_H_DEPENDANT
+#define __CORE_CM0PLUS_H_DEPENDANT
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+  #ifndef __CM0PLUS_REV
+    #define __CM0PLUS_REV             0x0000
+    #warning "__CM0PLUS_REV not defined in device header file; using default!"
+  #endif
+
+  #ifndef __MPU_PRESENT
+    #define __MPU_PRESENT             0
+    #warning "__MPU_PRESENT not defined in device header file; using default!"
+  #endif
+
+  #ifndef __VTOR_PRESENT
+    #define __VTOR_PRESENT            0
+    #warning "__VTOR_PRESENT not defined in device header file; using default!"
+  #endif
+
+  #ifndef __NVIC_PRIO_BITS
+    #define __NVIC_PRIO_BITS          2
+    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+  #endif
+
+  #ifndef __Vendor_SysTickConfig
+    #define __Vendor_SysTickConfig    0
+    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+  #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+    \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+    <strong>IO Type Qualifiers</strong> are used
+    \li to specify the access to peripheral variables.
+    \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
+#else
+  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
+#endif
+#define     __O     volatile             /*!< Defines 'write only' permissions                */
+#define     __IO    volatile             /*!< Defines 'read / write' permissions              */
+
+/*@} end of group Cortex-M0+ */
+
+
+
+/*******************************************************************************
+ *                 Register Abstraction
+  Core Register contain:
+  - Core Register
+  - Core NVIC Register
+  - Core SCB Register
+  - Core SysTick Register
+  - Core MPU Register
+ ******************************************************************************/
+/** \defgroup CMSIS_core_register Defines and Type Definitions
+    \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_CORE  Status and Control Registers
+    \brief  Core Register type definitions.
+  @{
+ */
+
+/** \brief  Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+  struct
+  {
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:27;              /*!< bit:  0..26  Reserved                           */
+#else
+    uint32_t _reserved0:16;              /*!< bit:  0..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:7;               /*!< bit: 20..26  Reserved                           */
+#endif
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} APSR_Type;
+
+
+/** \brief  Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} IPSR_Type;
+
+
+/** \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved                           */
+#else
+    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved                           */
+#endif
+    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0)          */
+    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0)          */
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} xPSR_Type;
+
+
+/** \brief  Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t nPRIV:1;                    /*!< bit:      0  Execution privilege in Thread mode */
+    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used                   */
+    uint32_t FPCA:1;                     /*!< bit:      2  FP extension active flag           */
+    uint32_t _reserved0:29;              /*!< bit:  3..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} CONTROL_Type;
+
+/*@} end of group CMSIS_CORE */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
+    \brief      Type definitions for the NVIC Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+  __IO uint32_t ISER[1];                 /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register           */
+       uint32_t RESERVED0[31];
+  __IO uint32_t ICER[1];                 /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register          */
+       uint32_t RSERVED1[31];
+  __IO uint32_t ISPR[1];                 /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register           */
+       uint32_t RESERVED2[31];
+  __IO uint32_t ICPR[1];                 /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register         */
+       uint32_t RESERVED3[31];
+       uint32_t RESERVED4[64];
+  __IO uint32_t IP[8];                   /*!< Offset: 0x300 (R/W)  Interrupt Priority Register              */
+}  NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCB     System Control Block (SCB)
+    \brief      Type definitions for the System Control Block Registers
+  @{
+ */
+
+/** \brief  Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
+  __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
+#if (__VTOR_PRESENT == 1)
+  __IO uint32_t VTOR;                    /*!< Offset: 0x008 (R/W)  Vector Table Offset Register                          */
+#else
+       uint32_t RESERVED0;
+#endif
+  __IO uint32_t AIRCR;                   /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register      */
+  __IO uint32_t SCR;                     /*!< Offset: 0x010 (R/W)  System Control Register                               */
+  __IO uint32_t CCR;                     /*!< Offset: 0x014 (R/W)  Configuration Control Register                        */
+       uint32_t RESERVED1;
+  __IO uint32_t SHP[2];                  /*!< Offset: 0x01C (R/W)  System Handlers Priority Registers. [0] is RESERVED   */
+  __IO uint32_t SHCSR;                   /*!< Offset: 0x024 (R/W)  System Handler Control and State Register             */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos          24                                             /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos              20                                             /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos         16                                             /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos                4                                             /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos              0                                             /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk             (0xFUL << SCB_CPUID_REVISION_Pos)              /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos            31                                             /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos             28                                             /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos             27                                             /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos             26                                             /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos             25                                             /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos            23                                             /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos            22                                             /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos           12                                             /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos             0                                             /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos)           /*!< SCB ICSR: VECTACTIVE Mask */
+
+#if (__VTOR_PRESENT == 1)
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos                 8                                             /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk                (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos)            /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos              16                                             /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos          16                                             /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos            15                                             /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos           2                                             /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos         1                                             /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos               4                                             /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos               2                                             /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos             1                                             /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos                9                                             /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos             3                                             /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos         15                                             /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
+    \brief      Type definitions for the System Timer Registers.
+  @{
+ */
+
+/** \brief  Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
+  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
+  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
+  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk            (1UL << SysTick_CTRL_ENABLE_Pos)               /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos)        /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+#if (__MPU_PRESENT == 1)
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
+    \brief      Type definitions for the Memory Protection Unit (MPU)
+  @{
+ */
+
+/** \brief  Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+  __I  uint32_t TYPE;                    /*!< Offset: 0x000 (R/ )  MPU Type Register                              */
+  __IO uint32_t CTRL;                    /*!< Offset: 0x004 (R/W)  MPU Control Register                           */
+  __IO uint32_t RNR;                     /*!< Offset: 0x008 (R/W)  MPU Region RNRber Register                     */
+  __IO uint32_t RBAR;                    /*!< Offset: 0x00C (R/W)  MPU Region Base Address Register               */
+  __IO uint32_t RASR;                    /*!< Offset: 0x010 (R/W)  MPU Region Attribute and Size Register         */
+} MPU_Type;
+
+/* MPU Type Register */
+#define MPU_TYPE_IREGION_Pos               16                                             /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos                8                                             /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk               (0xFFUL << MPU_TYPE_DREGION_Pos)               /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos               0                                             /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk              (1UL << MPU_TYPE_SEPARATE_Pos)                 /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register */
+#define MPU_CTRL_PRIVDEFENA_Pos             2                                             /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk            (1UL << MPU_CTRL_PRIVDEFENA_Pos)               /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos               1                                             /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk              (1UL << MPU_CTRL_HFNMIENA_Pos)                 /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos                 0                                             /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk                (1UL << MPU_CTRL_ENABLE_Pos)                   /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register */
+#define MPU_RNR_REGION_Pos                  0                                             /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk                 (0xFFUL << MPU_RNR_REGION_Pos)                 /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register */
+#define MPU_RBAR_ADDR_Pos                   8                                             /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk                  (0xFFFFFFUL << MPU_RBAR_ADDR_Pos)              /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos                  4                                             /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk                 (1UL << MPU_RBAR_VALID_Pos)                    /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos                 0                                             /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk                (0xFUL << MPU_RBAR_REGION_Pos)                 /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register */
+#define MPU_RASR_ATTRS_Pos                 16                                             /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk                 (0xFFFFUL << MPU_RASR_ATTRS_Pos)               /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos                    28                                             /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk                    (1UL << MPU_RASR_XN_Pos)                       /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos                    24                                             /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk                    (0x7UL << MPU_RASR_AP_Pos)                     /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos                   19                                             /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk                   (0x7UL << MPU_RASR_TEX_Pos)                    /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos                     18                                             /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk                     (1UL << MPU_RASR_S_Pos)                        /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos                     17                                             /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk                     (1UL << MPU_RASR_C_Pos)                        /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos                     16                                             /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk                     (1UL << MPU_RASR_B_Pos)                        /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos                    8                                             /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk                   (0xFFUL << MPU_RASR_SRD_Pos)                   /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos                   1                                             /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk                  (0x1FUL << MPU_RASR_SIZE_Pos)                  /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos                 0                                             /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk                (1UL << MPU_RASR_ENABLE_Pos)                   /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
+    \brief      Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR)
+                are only accessible over DAP and not via processor. Therefore
+                they are not covered by the Cortex-M0 header file.
+  @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_core_base     Core Definitions
+    \brief      Definitions for base addresses, unions, and structures.
+  @{
+ */
+
+/* Memory mapping of Cortex-M0+ Hardware */
+#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
+#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address              */
+#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address                 */
+#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address */
+
+#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct           */
+#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct       */
+#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct          */
+
+#if (__MPU_PRESENT == 1)
+  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit             */
+  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit             */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ *                Hardware Abstraction Layer
+  Core Function Interface contains:
+  - Core NVIC Functions
+  - Core SysTick Functions
+  - Core Register Access Functions
+ ******************************************************************************/
+/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ##########################   NVIC functions  #################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+    \brief      Functions that manage interrupts and exceptions via the NVIC.
+    @{
+ */
+
+/* Interrupt Priorities are WORD accessible only under ARMv6M                   */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn)         (  (((uint32_t)(IRQn)       )    &  0x03) * 8 )
+#define _SHP_IDX(IRQn)           ( ((((uint32_t)(IRQn) & 0x0F)-8) >>    2)     )
+#define _IP_IDX(IRQn)            (   ((uint32_t)(IRQn)            >>    2)     )
+
+
+/** \brief  Enable External Interrupt
+
+    The function enables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Disable External Interrupt
+
+    The function disables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Get Pending Interrupt
+
+    The function reads the pending register in the NVIC and returns the pending bit
+    for the specified interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not pending.
+    \return             1  Interrupt status is pending.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+  return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0));
+}
+
+
+/** \brief  Set Pending Interrupt
+
+    The function sets the pending bit of an external interrupt.
+
+    \param [in]      IRQn  Interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Clear Pending Interrupt
+
+    The function clears the pending bit of an external interrupt.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
+}
+
+
+/** \brief  Set Interrupt Priority
+
+    The function sets the priority of an interrupt.
+
+    \note The priority cannot be set for every core interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+    \param [in]  priority  Priority to set.
+ */
+__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+  if(IRQn < 0) {
+    SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
+        (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
+  else {
+    NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
+        (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
+}
+
+
+/** \brief  Get Interrupt Priority
+
+    The function reads the priority of an interrupt. The interrupt
+    number can be positive to specify an external (device specific)
+    interrupt, or negative to specify an internal (core) interrupt.
+
+
+    \param [in]   IRQn  Interrupt number.
+    \return             Interrupt Priority. Value is aligned automatically to the implemented
+                        priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+  if(IRQn < 0) {
+    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M0 system interrupts */
+  else {
+    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts  */
+}
+
+
+/** \brief  System Reset
+
+    The function initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void NVIC_SystemReset(void)
+{
+  __DSB();                                                     /* Ensure all outstanding memory accesses included
+                                                                  buffered write are completed before reset */
+  SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
+                 SCB_AIRCR_SYSRESETREQ_Msk);
+  __DSB();                                                     /* Ensure completion of memory access */
+  while(1);                                                    /* wait until reset */
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+
+/* ##################################    SysTick function  ############################################ */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+    \brief      Functions that configure the System.
+  @{
+ */
+
+#if (__Vendor_SysTickConfig == 0)
+
+/** \brief  System Tick Configuration
+
+    The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
+    Counter is in free running mode to generate periodic interrupts.
+
+    \param [in]  ticks  Number of ticks between two interrupts.
+
+    \return          0  Function succeeded.
+    \return          1  Function failed.
+
+    \note     When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+    function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+    must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+  if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)  return (1);      /* Reload value impossible */
+
+  SysTick->LOAD  = ticks - 1;                                  /* set reload register */
+  NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);  /* set Priority for Systick Interrupt */
+  SysTick->VAL   = 0;                                          /* Load the SysTick Counter Value */
+  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
+                   SysTick_CTRL_TICKINT_Msk   |
+                   SysTick_CTRL_ENABLE_Msk;                    /* Enable SysTick IRQ and SysTick Timer */
+  return (0);                                                  /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#endif /* __CORE_CM0PLUS_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
+
+#ifdef __cplusplus
+}
+#endif

+ 1627 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_cm3.h

@@ -0,0 +1,1627 @@
+/**************************************************************************//**
+ * @file     core_cm3.h
+ * @brief    CMSIS Cortex-M3 Core Peripheral Access Layer Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include  /* treat file as system include file for MISRA check */
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifndef __CORE_CM3_H_GENERIC
+#define __CORE_CM3_H_GENERIC
+
+/** \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
+  CMSIS violates the following MISRA-C:2004 rules:
+
+   \li Required Rule 8.5, object/function definition in header file.<br>
+     Function definitions in header files are used to allow 'inlining'.
+
+   \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+     Unions are used for effective representation of core registers.
+
+   \li Advisory Rule 19.7, Function-like macro defined.<br>
+     Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ *                 CMSIS definitions
+ ******************************************************************************/
+/** \ingroup Cortex_M3
+  @{
+ */
+
+/*  CMSIS CM3 definitions */
+#define __CM3_CMSIS_VERSION_MAIN  (0x03)                                   /*!< [31:16] CMSIS HAL main version   */
+#define __CM3_CMSIS_VERSION_SUB   (0x20)                                   /*!< [15:0]  CMSIS HAL sub version    */
+#define __CM3_CMSIS_VERSION       ((__CM3_CMSIS_VERSION_MAIN << 16) | \
+                                    __CM3_CMSIS_VERSION_SUB          )     /*!< CMSIS HAL version number         */
+
+#define __CORTEX_M                (0x03)                                   /*!< Cortex-M Core                    */
+
+
+#if   defined ( __CC_ARM )
+  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
+  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
+  #define __STATIC_INLINE  static __inline
+
+#elif defined ( __ICCARM__ )
+  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TMS470__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TI CCS Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __GNUC__ )
+  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TASKING__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
+  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
+  #define __STATIC_INLINE  static inline
+
+#endif
+
+/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all
+*/
+#define __FPU_USED       0
+
+#if defined ( __CC_ARM )
+  #if defined __TARGET_FPU_VFP
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __ICCARM__ )
+  #if defined __ARMVFP__
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __TMS470__ )
+  #if defined __TI__VFP_SUPPORT____
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __GNUC__ )
+  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __TASKING__ )
+  #if defined __FPU_VFP__
+    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+#endif
+
+#include <stdint.h>                      /* standard types definitions                      */
+#include <core_cmInstr.h>                /* Core Instruction Access                         */
+#include <core_cmFunc.h>                 /* Core Function Access                            */
+
+#endif /* __CORE_CM3_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM3_H_DEPENDANT
+#define __CORE_CM3_H_DEPENDANT
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+  #ifndef __CM3_REV
+    #define __CM3_REV               0x0200
+    #warning "__CM3_REV not defined in device header file; using default!"
+  #endif
+
+  #ifndef __MPU_PRESENT
+    #define __MPU_PRESENT             0
+    #warning "__MPU_PRESENT not defined in device header file; using default!"
+  #endif
+
+  #ifndef __NVIC_PRIO_BITS
+    #define __NVIC_PRIO_BITS          4
+    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+  #endif
+
+  #ifndef __Vendor_SysTickConfig
+    #define __Vendor_SysTickConfig    0
+    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+  #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+    \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+    <strong>IO Type Qualifiers</strong> are used
+    \li to specify the access to peripheral variables.
+    \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
+#else
+  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
+#endif
+#define     __O     volatile             /*!< Defines 'write only' permissions                */
+#define     __IO    volatile             /*!< Defines 'read / write' permissions              */
+
+/*@} end of group Cortex_M3 */
+
+
+
+/*******************************************************************************
+ *                 Register Abstraction
+  Core Register contain:
+  - Core Register
+  - Core NVIC Register
+  - Core SCB Register
+  - Core SysTick Register
+  - Core Debug Register
+  - Core MPU Register
+ ******************************************************************************/
+/** \defgroup CMSIS_core_register Defines and Type Definitions
+    \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_CORE  Status and Control Registers
+    \brief  Core Register type definitions.
+  @{
+ */
+
+/** \brief  Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+  struct
+  {
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:27;              /*!< bit:  0..26  Reserved                           */
+#else
+    uint32_t _reserved0:16;              /*!< bit:  0..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:7;               /*!< bit: 20..26  Reserved                           */
+#endif
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} APSR_Type;
+
+
+/** \brief  Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} IPSR_Type;
+
+
+/** \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved                           */
+#else
+    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved                           */
+#endif
+    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0)          */
+    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0)          */
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} xPSR_Type;
+
+
+/** \brief  Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t nPRIV:1;                    /*!< bit:      0  Execution privilege in Thread mode */
+    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used                   */
+    uint32_t FPCA:1;                     /*!< bit:      2  FP extension active flag           */
+    uint32_t _reserved0:29;              /*!< bit:  3..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} CONTROL_Type;
+
+/*@} end of group CMSIS_CORE */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
+    \brief      Type definitions for the NVIC Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+  __IO uint32_t ISER[8];                 /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register           */
+       uint32_t RESERVED0[24];
+  __IO uint32_t ICER[8];                 /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register         */
+       uint32_t RSERVED1[24];
+  __IO uint32_t ISPR[8];                 /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register          */
+       uint32_t RESERVED2[24];
+  __IO uint32_t ICPR[8];                 /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register        */
+       uint32_t RESERVED3[24];
+  __IO uint32_t IABR[8];                 /*!< Offset: 0x200 (R/W)  Interrupt Active bit Register           */
+       uint32_t RESERVED4[56];
+  __IO uint8_t  IP[240];                 /*!< Offset: 0x300 (R/W)  Interrupt Priority Register (8Bit wide) */
+       uint32_t RESERVED5[644];
+  __O  uint32_t STIR;                    /*!< Offset: 0xE00 ( /W)  Software Trigger Interrupt Register     */
+}  NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos                 0                                          /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk                (0x1FFUL << NVIC_STIR_INTID_Pos)            /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCB     System Control Block (SCB)
+    \brief      Type definitions for the System Control Block Registers
+  @{
+ */
+
+/** \brief  Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
+  __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
+  __IO uint32_t VTOR;                    /*!< Offset: 0x008 (R/W)  Vector Table Offset Register                          */
+  __IO uint32_t AIRCR;                   /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register      */
+  __IO uint32_t SCR;                     /*!< Offset: 0x010 (R/W)  System Control Register                               */
+  __IO uint32_t CCR;                     /*!< Offset: 0x014 (R/W)  Configuration Control Register                        */
+  __IO uint8_t  SHP[12];                 /*!< Offset: 0x018 (R/W)  System Handlers Priority Registers (4-7, 8-11, 12-15) */
+  __IO uint32_t SHCSR;                   /*!< Offset: 0x024 (R/W)  System Handler Control and State Register             */
+  __IO uint32_t CFSR;                    /*!< Offset: 0x028 (R/W)  Configurable Fault Status Register                    */
+  __IO uint32_t HFSR;                    /*!< Offset: 0x02C (R/W)  HardFault Status Register                             */
+  __IO uint32_t DFSR;                    /*!< Offset: 0x030 (R/W)  Debug Fault Status Register                           */
+  __IO uint32_t MMFAR;                   /*!< Offset: 0x034 (R/W)  MemManage Fault Address Register                      */
+  __IO uint32_t BFAR;                    /*!< Offset: 0x038 (R/W)  BusFault Address Register                             */
+  __IO uint32_t AFSR;                    /*!< Offset: 0x03C (R/W)  Auxiliary Fault Status Register                       */
+  __I  uint32_t PFR[2];                  /*!< Offset: 0x040 (R/ )  Processor Feature Register                            */
+  __I  uint32_t DFR;                     /*!< Offset: 0x048 (R/ )  Debug Feature Register                                */
+  __I  uint32_t ADR;                     /*!< Offset: 0x04C (R/ )  Auxiliary Feature Register                            */
+  __I  uint32_t MMFR[4];                 /*!< Offset: 0x050 (R/ )  Memory Model Feature Register                         */
+  __I  uint32_t ISAR[5];                 /*!< Offset: 0x060 (R/ )  Instruction Set Attributes Register                   */
+       uint32_t RESERVED0[5];
+  __IO uint32_t CPACR;                   /*!< Offset: 0x088 (R/W)  Coprocessor Access Control Register                   */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos          24                                             /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos              20                                             /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos         16                                             /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos                4                                             /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos              0                                             /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk             (0xFUL << SCB_CPUID_REVISION_Pos)              /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos            31                                             /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos             28                                             /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos             27                                             /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos             26                                             /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos             25                                             /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos            23                                             /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos            22                                             /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos           12                                             /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos             11                                             /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk             (1UL << SCB_ICSR_RETTOBASE_Pos)                /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos             0                                             /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos)           /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#if (__CM3_REV < 0x0201)                   /* core r2p1 */
+#define SCB_VTOR_TBLBASE_Pos               29                                             /*!< SCB VTOR: TBLBASE Position */
+#define SCB_VTOR_TBLBASE_Msk               (1UL << SCB_VTOR_TBLBASE_Pos)                  /*!< SCB VTOR: TBLBASE Mask */
+
+#define SCB_VTOR_TBLOFF_Pos                 7                                             /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk                (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos)            /*!< SCB VTOR: TBLOFF Mask */
+#else
+#define SCB_VTOR_TBLOFF_Pos                 7                                             /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk                (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos)           /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos              16                                             /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos          16                                             /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos            15                                             /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos              8                                             /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk             (7UL << SCB_AIRCR_PRIGROUP_Pos)                /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos           2                                             /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos         1                                             /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos             0                                             /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk            (1UL << SCB_AIRCR_VECTRESET_Pos)               /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos               4                                             /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos               2                                             /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos             1                                             /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos                9                                             /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos               8                                             /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk              (1UL << SCB_CCR_BFHFNMIGN_Pos)                 /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos               4                                             /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk              (1UL << SCB_CCR_DIV_0_TRP_Pos)                 /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos             3                                             /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos            1                                             /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk           (1UL << SCB_CCR_USERSETMPEND_Pos)              /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos          0                                             /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk         (1UL << SCB_CCR_NONBASETHRDENA_Pos)            /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos          18                                             /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk          (1UL << SCB_SHCSR_USGFAULTENA_Pos)             /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos          17                                             /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk          (1UL << SCB_SHCSR_BUSFAULTENA_Pos)             /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos          16                                             /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk          (1UL << SCB_SHCSR_MEMFAULTENA_Pos)             /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos         15                                             /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos       14                                             /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk       (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos)          /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos       13                                             /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk       (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos)          /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos       12                                             /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk       (1UL << SCB_SHCSR_USGFAULTPENDED_Pos)          /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos           11                                             /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk           (1UL << SCB_SHCSR_SYSTICKACT_Pos)              /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos            10                                             /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk            (1UL << SCB_SHCSR_PENDSVACT_Pos)               /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos            8                                             /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk           (1UL << SCB_SHCSR_MONITORACT_Pos)              /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos             7                                             /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk            (1UL << SCB_SHCSR_SVCALLACT_Pos)               /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos           3                                             /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk          (1UL << SCB_SHCSR_USGFAULTACT_Pos)             /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos           1                                             /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk          (1UL << SCB_SHCSR_BUSFAULTACT_Pos)             /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos           0                                             /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk          (1UL << SCB_SHCSR_MEMFAULTACT_Pos)             /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Registers Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos            16                                             /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk            (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos)          /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos             8                                             /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos             0                                             /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL << SCB_CFSR_MEMFAULTSR_Pos)            /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* SCB Hard Fault Status Registers Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos              31                                             /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos                30                                             /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk                (1UL << SCB_HFSR_FORCED_Pos)                   /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos                1                                             /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk               (1UL << SCB_HFSR_VECTTBL_Pos)                  /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos               4                                             /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk              (1UL << SCB_DFSR_EXTERNAL_Pos)                 /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos                 3                                             /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk                (1UL << SCB_DFSR_VCATCH_Pos)                   /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos                2                                             /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk               (1UL << SCB_DFSR_DWTTRAP_Pos)                  /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos                   1                                             /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk                  (1UL << SCB_DFSR_BKPT_Pos)                     /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos                 0                                             /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk                (1UL << SCB_DFSR_HALTED_Pos)                   /*!< SCB DFSR: HALTED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+    \brief      Type definitions for the System Control and ID Register not in the SCB
+  @{
+ */
+
+/** \brief  Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+       uint32_t RESERVED0[1];
+  __I  uint32_t ICTR;                    /*!< Offset: 0x004 (R/ )  Interrupt Controller Type Register      */
+#if ((defined __CM3_REV) && (__CM3_REV >= 0x200))
+  __IO uint32_t ACTLR;                   /*!< Offset: 0x008 (R/W)  Auxiliary Control Register      */
+#else
+       uint32_t RESERVED1[1];
+#endif
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos         0                                          /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk        (0xFUL << SCnSCB_ICTR_INTLINESNUM_Pos)      /*!< ICTR: INTLINESNUM Mask */
+
+/* Auxiliary Control Register Definitions */
+
+#define SCnSCB_ACTLR_DISFOLD_Pos            2                                          /*!< ACTLR: DISFOLD Position */
+#define SCnSCB_ACTLR_DISFOLD_Msk           (1UL << SCnSCB_ACTLR_DISFOLD_Pos)           /*!< ACTLR: DISFOLD Mask */
+
+#define SCnSCB_ACTLR_DISDEFWBUF_Pos         1                                          /*!< ACTLR: DISDEFWBUF Position */
+#define SCnSCB_ACTLR_DISDEFWBUF_Msk        (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos)        /*!< ACTLR: DISDEFWBUF Mask */
+
+#define SCnSCB_ACTLR_DISMCYCINT_Pos         0                                          /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk        (1UL << SCnSCB_ACTLR_DISMCYCINT_Pos)        /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
+    \brief      Type definitions for the System Timer Registers.
+  @{
+ */
+
+/** \brief  Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
+  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
+  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
+  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk            (1UL << SysTick_CTRL_ENABLE_Pos)               /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos)        /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_ITM     Instrumentation Trace Macrocell (ITM)
+    \brief      Type definitions for the Instrumentation Trace Macrocell (ITM)
+  @{
+ */
+
+/** \brief  Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+  __O  union
+  {
+    __O  uint8_t    u8;                  /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 8-bit                   */
+    __O  uint16_t   u16;                 /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 16-bit                  */
+    __O  uint32_t   u32;                 /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 32-bit                  */
+  }  PORT [32];                          /*!< Offset: 0x000 ( /W)  ITM Stimulus Port Registers               */
+       uint32_t RESERVED0[864];
+  __IO uint32_t TER;                     /*!< Offset: 0xE00 (R/W)  ITM Trace Enable Register                 */
+       uint32_t RESERVED1[15];
+  __IO uint32_t TPR;                     /*!< Offset: 0xE40 (R/W)  ITM Trace Privilege Register              */
+       uint32_t RESERVED2[15];
+  __IO uint32_t TCR;                     /*!< Offset: 0xE80 (R/W)  ITM Trace Control Register                */
+       uint32_t RESERVED3[29];
+  __O  uint32_t IWR;                     /*!< Offset: 0xEF8 ( /W)  ITM Integration Write Register            */
+  __I  uint32_t IRR;                     /*!< Offset: 0xEFC (R/ )  ITM Integration Read Register             */
+  __IO uint32_t IMCR;                    /*!< Offset: 0xF00 (R/W)  ITM Integration Mode Control Register     */
+       uint32_t RESERVED4[43];
+  __O  uint32_t LAR;                     /*!< Offset: 0xFB0 ( /W)  ITM Lock Access Register                  */
+  __I  uint32_t LSR;                     /*!< Offset: 0xFB4 (R/ )  ITM Lock Status Register                  */
+       uint32_t RESERVED5[6];
+  __I  uint32_t PID4;                    /*!< Offset: 0xFD0 (R/ )  ITM Peripheral Identification Register #4 */
+  __I  uint32_t PID5;                    /*!< Offset: 0xFD4 (R/ )  ITM Peripheral Identification Register #5 */
+  __I  uint32_t PID6;                    /*!< Offset: 0xFD8 (R/ )  ITM Peripheral Identification Register #6 */
+  __I  uint32_t PID7;                    /*!< Offset: 0xFDC (R/ )  ITM Peripheral Identification Register #7 */
+  __I  uint32_t PID0;                    /*!< Offset: 0xFE0 (R/ )  ITM Peripheral Identification Register #0 */
+  __I  uint32_t PID1;                    /*!< Offset: 0xFE4 (R/ )  ITM Peripheral Identification Register #1 */
+  __I  uint32_t PID2;                    /*!< Offset: 0xFE8 (R/ )  ITM Peripheral Identification Register #2 */
+  __I  uint32_t PID3;                    /*!< Offset: 0xFEC (R/ )  ITM Peripheral Identification Register #3 */
+  __I  uint32_t CID0;                    /*!< Offset: 0xFF0 (R/ )  ITM Component  Identification Register #0 */
+  __I  uint32_t CID1;                    /*!< Offset: 0xFF4 (R/ )  ITM Component  Identification Register #1 */
+  __I  uint32_t CID2;                    /*!< Offset: 0xFF8 (R/ )  ITM Component  Identification Register #2 */
+  __I  uint32_t CID3;                    /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos                0                                             /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk               (0xFUL << ITM_TPR_PRIVMASK_Pos)                /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos                   23                                             /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos             16                                             /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk             (0x7FUL << ITM_TCR_TraceBusID_Pos)             /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos                10                                             /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk                (3UL << ITM_TCR_GTSFREQ_Pos)                   /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos              8                                             /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk             (3UL << ITM_TCR_TSPrescale_Pos)                /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos                  4                                             /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk                 (1UL << ITM_TCR_SWOENA_Pos)                    /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos                  3                                             /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk                 (1UL << ITM_TCR_DWTENA_Pos)                    /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos                 2                                             /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk                (1UL << ITM_TCR_SYNCENA_Pos)                   /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos                   1                                             /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk                  (1UL << ITM_TCR_TSENA_Pos)                     /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos                  0                                             /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk                 (1UL << ITM_TCR_ITMENA_Pos)                    /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Integration Write Register Definitions */
+#define ITM_IWR_ATVALIDM_Pos                0                                             /*!< ITM IWR: ATVALIDM Position */
+#define ITM_IWR_ATVALIDM_Msk               (1UL << ITM_IWR_ATVALIDM_Pos)                  /*!< ITM IWR: ATVALIDM Mask */
+
+/* ITM Integration Read Register Definitions */
+#define ITM_IRR_ATREADYM_Pos                0                                             /*!< ITM IRR: ATREADYM Position */
+#define ITM_IRR_ATREADYM_Msk               (1UL << ITM_IRR_ATREADYM_Pos)                  /*!< ITM IRR: ATREADYM Mask */
+
+/* ITM Integration Mode Control Register Definitions */
+#define ITM_IMCR_INTEGRATION_Pos            0                                             /*!< ITM IMCR: INTEGRATION Position */
+#define ITM_IMCR_INTEGRATION_Msk           (1UL << ITM_IMCR_INTEGRATION_Pos)              /*!< ITM IMCR: INTEGRATION Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos                 2                                             /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk                (1UL << ITM_LSR_ByteAcc_Pos)                   /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos                  1                                             /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk                 (1UL << ITM_LSR_Access_Pos)                    /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos                 0                                             /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk                (1UL << ITM_LSR_Present_Pos)                   /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_DWT     Data Watchpoint and Trace (DWT)
+    \brief      Type definitions for the Data Watchpoint and Trace (DWT)
+  @{
+ */
+
+/** \brief  Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  Control Register                          */
+  __IO uint32_t CYCCNT;                  /*!< Offset: 0x004 (R/W)  Cycle Count Register                      */
+  __IO uint32_t CPICNT;                  /*!< Offset: 0x008 (R/W)  CPI Count Register                        */
+  __IO uint32_t EXCCNT;                  /*!< Offset: 0x00C (R/W)  Exception Overhead Count Register         */
+  __IO uint32_t SLEEPCNT;                /*!< Offset: 0x010 (R/W)  Sleep Count Register                      */
+  __IO uint32_t LSUCNT;                  /*!< Offset: 0x014 (R/W)  LSU Count Register                        */
+  __IO uint32_t FOLDCNT;                 /*!< Offset: 0x018 (R/W)  Folded-instruction Count Register         */
+  __I  uint32_t PCSR;                    /*!< Offset: 0x01C (R/ )  Program Counter Sample Register           */
+  __IO uint32_t COMP0;                   /*!< Offset: 0x020 (R/W)  Comparator Register 0                     */
+  __IO uint32_t MASK0;                   /*!< Offset: 0x024 (R/W)  Mask Register 0                           */
+  __IO uint32_t FUNCTION0;               /*!< Offset: 0x028 (R/W)  Function Register 0                       */
+       uint32_t RESERVED0[1];
+  __IO uint32_t COMP1;                   /*!< Offset: 0x030 (R/W)  Comparator Register 1                     */
+  __IO uint32_t MASK1;                   /*!< Offset: 0x034 (R/W)  Mask Register 1                           */
+  __IO uint32_t FUNCTION1;               /*!< Offset: 0x038 (R/W)  Function Register 1                       */
+       uint32_t RESERVED1[1];
+  __IO uint32_t COMP2;                   /*!< Offset: 0x040 (R/W)  Comparator Register 2                     */
+  __IO uint32_t MASK2;                   /*!< Offset: 0x044 (R/W)  Mask Register 2                           */
+  __IO uint32_t FUNCTION2;               /*!< Offset: 0x048 (R/W)  Function Register 2                       */
+       uint32_t RESERVED2[1];
+  __IO uint32_t COMP3;                   /*!< Offset: 0x050 (R/W)  Comparator Register 3                     */
+  __IO uint32_t MASK3;                   /*!< Offset: 0x054 (R/W)  Mask Register 3                           */
+  __IO uint32_t FUNCTION3;               /*!< Offset: 0x058 (R/W)  Function Register 3                       */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos               28                                          /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk               (0xFUL << DWT_CTRL_NUMCOMP_Pos)             /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos              27                                          /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk              (0x1UL << DWT_CTRL_NOTRCPKT_Pos)            /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos             26                                          /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk             (0x1UL << DWT_CTRL_NOEXTTRIG_Pos)           /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos              25                                          /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk              (0x1UL << DWT_CTRL_NOCYCCNT_Pos)            /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos              24                                          /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk              (0x1UL << DWT_CTRL_NOPRFCNT_Pos)            /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos             22                                          /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk             (0x1UL << DWT_CTRL_CYCEVTENA_Pos)           /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos            21                                          /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk            (0x1UL << DWT_CTRL_FOLDEVTENA_Pos)          /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos             20                                          /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk             (0x1UL << DWT_CTRL_LSUEVTENA_Pos)           /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos           19                                          /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk           (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos)         /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos             18                                          /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk             (0x1UL << DWT_CTRL_EXCEVTENA_Pos)           /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos             17                                          /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk             (0x1UL << DWT_CTRL_CPIEVTENA_Pos)           /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos             16                                          /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk             (0x1UL << DWT_CTRL_EXCTRCENA_Pos)           /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos            12                                          /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk            (0x1UL << DWT_CTRL_PCSAMPLENA_Pos)          /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos               10                                          /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk               (0x3UL << DWT_CTRL_SYNCTAP_Pos)             /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos                 9                                          /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk                (0x1UL << DWT_CTRL_CYCTAP_Pos)              /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos               5                                          /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk              (0xFUL << DWT_CTRL_POSTINIT_Pos)            /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos             1                                          /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk            (0xFUL << DWT_CTRL_POSTPRESET_Pos)          /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos              0                                          /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk             (0x1UL << DWT_CTRL_CYCCNTENA_Pos)           /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos               0                                          /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk              (0xFFUL << DWT_CPICNT_CPICNT_Pos)           /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos               0                                          /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk              (0xFFUL << DWT_EXCCNT_EXCCNT_Pos)           /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos           0                                          /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk          (0xFFUL << DWT_SLEEPCNT_SLEEPCNT_Pos)       /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos               0                                          /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk              (0xFFUL << DWT_LSUCNT_LSUCNT_Pos)           /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos             0                                          /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk            (0xFFUL << DWT_FOLDCNT_FOLDCNT_Pos)         /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos                   0                                          /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk                  (0x1FUL << DWT_MASK_MASK_Pos)               /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos           24                                          /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk           (0x1UL << DWT_FUNCTION_MATCHED_Pos)         /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos        16                                          /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk        (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos)      /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos        12                                          /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk        (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos)      /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos         10                                          /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk         (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos)       /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos            9                                          /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk           (0x1UL << DWT_FUNCTION_LNK1ENA_Pos)         /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos         8                                          /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk        (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos)      /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos           7                                          /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk          (0x1UL << DWT_FUNCTION_CYCMATCH_Pos)        /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos          5                                          /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk         (0x1UL << DWT_FUNCTION_EMITRANGE_Pos)       /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos           0                                          /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk          (0xFUL << DWT_FUNCTION_FUNCTION_Pos)        /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_TPI     Trace Port Interface (TPI)
+    \brief      Type definitions for the Trace Port Interface (TPI)
+  @{
+ */
+
+/** \brief  Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+  __IO uint32_t SSPSR;                   /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register     */
+  __IO uint32_t CSPSR;                   /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
+       uint32_t RESERVED0[2];
+  __IO uint32_t ACPR;                    /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
+       uint32_t RESERVED1[55];
+  __IO uint32_t SPPR;                    /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
+       uint32_t RESERVED2[131];
+  __I  uint32_t FFSR;                    /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
+  __IO uint32_t FFCR;                    /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
+  __I  uint32_t FSCR;                    /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
+       uint32_t RESERVED3[759];
+  __I  uint32_t TRIGGER;                 /*!< Offset: 0xEE8 (R/ )  TRIGGER */
+  __I  uint32_t FIFO0;                   /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
+  __I  uint32_t ITATBCTR2;               /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
+       uint32_t RESERVED4[1];
+  __I  uint32_t ITATBCTR0;               /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
+  __I  uint32_t FIFO1;                   /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
+  __IO uint32_t ITCTRL;                  /*!< Offset: 0xF00 (R/W)  Integration Mode Control */
+       uint32_t RESERVED5[39];
+  __IO uint32_t CLAIMSET;                /*!< Offset: 0xFA0 (R/W)  Claim tag set */
+  __IO uint32_t CLAIMCLR;                /*!< Offset: 0xFA4 (R/W)  Claim tag clear */
+       uint32_t RESERVED7[8];
+  __I  uint32_t DEVID;                   /*!< Offset: 0xFC8 (R/ )  TPIU_DEVID */
+  __I  uint32_t DEVTYPE;                 /*!< Offset: 0xFCC (R/ )  TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos              0                                          /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk             (0x1FFFUL << TPI_ACPR_PRESCALER_Pos)        /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos                 0                                          /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk                (0x3UL << TPI_SPPR_TXMODE_Pos)              /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos              3                                          /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk             (0x1UL << TPI_FFSR_FtNonStop_Pos)           /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos              2                                          /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk             (0x1UL << TPI_FFSR_TCPresent_Pos)           /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos              1                                          /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk             (0x1UL << TPI_FFSR_FtStopped_Pos)           /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos               0                                          /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk              (0x1UL << TPI_FFSR_FlInProg_Pos)            /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos                 8                                          /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk                (0x1UL << TPI_FFCR_TrigIn_Pos)              /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos                1                                          /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk               (0x1UL << TPI_FFCR_EnFCont_Pos)             /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos             0                                          /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk            (0x1UL << TPI_TRIGGER_TRIGGER_Pos)          /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos          29                                          /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos)        /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos        27                                          /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk        (0x3UL << TPI_FIFO0_ITM_bytecount_Pos)      /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos          26                                          /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos)        /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos        24                                          /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk        (0x3UL << TPI_FIFO0_ETM_bytecount_Pos)      /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos                 16                                          /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk                 (0xFFUL << TPI_FIFO0_ETM2_Pos)              /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos                  8                                          /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk                 (0xFFUL << TPI_FIFO0_ETM1_Pos)              /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos                  0                                          /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk                 (0xFFUL << TPI_FIFO0_ETM0_Pos)              /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos           0                                          /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk          (0x1UL << TPI_ITATBCTR2_ATREADY_Pos)        /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos          29                                          /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos        27                                          /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk        (0x3UL << TPI_FIFO1_ITM_bytecount_Pos)      /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos          26                                          /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos)        /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos        24                                          /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk        (0x3UL << TPI_FIFO1_ETM_bytecount_Pos)      /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos                 16                                          /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk                 (0xFFUL << TPI_FIFO1_ITM2_Pos)              /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos                  8                                          /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk                 (0xFFUL << TPI_FIFO1_ITM1_Pos)              /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos                  0                                          /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk                 (0xFFUL << TPI_FIFO1_ITM0_Pos)              /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos           0                                          /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk          (0x1UL << TPI_ITATBCTR0_ATREADY_Pos)        /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos                 0                                          /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk                (0x1UL << TPI_ITCTRL_Mode_Pos)              /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos             11                                          /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos            10                                          /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk            (0x1UL << TPI_DEVID_MANCVALID_Pos)          /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos             9                                          /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk            (0x1UL << TPI_DEVID_PTINVALID_Pos)          /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos              6                                          /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk             (0x7UL << TPI_DEVID_MinBufSz_Pos)           /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos             5                                          /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk            (0x1UL << TPI_DEVID_AsynClkIn_Pos)          /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos          0                                          /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL << TPI_DEVID_NrTraceInput_Pos)      /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos             0                                          /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk            (0xFUL << TPI_DEVTYPE_SubType_Pos)          /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos           4                                          /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if (__MPU_PRESENT == 1)
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
+    \brief      Type definitions for the Memory Protection Unit (MPU)
+  @{
+ */
+
+/** \brief  Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+  __I  uint32_t TYPE;                    /*!< Offset: 0x000 (R/ )  MPU Type Register                              */
+  __IO uint32_t CTRL;                    /*!< Offset: 0x004 (R/W)  MPU Control Register                           */
+  __IO uint32_t RNR;                     /*!< Offset: 0x008 (R/W)  MPU Region RNRber Register                     */
+  __IO uint32_t RBAR;                    /*!< Offset: 0x00C (R/W)  MPU Region Base Address Register               */
+  __IO uint32_t RASR;                    /*!< Offset: 0x010 (R/W)  MPU Region Attribute and Size Register         */
+  __IO uint32_t RBAR_A1;                 /*!< Offset: 0x014 (R/W)  MPU Alias 1 Region Base Address Register       */
+  __IO uint32_t RASR_A1;                 /*!< Offset: 0x018 (R/W)  MPU Alias 1 Region Attribute and Size Register */
+  __IO uint32_t RBAR_A2;                 /*!< Offset: 0x01C (R/W)  MPU Alias 2 Region Base Address Register       */
+  __IO uint32_t RASR_A2;                 /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
+  __IO uint32_t RBAR_A3;                 /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register       */
+  __IO uint32_t RASR_A3;                 /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+/* MPU Type Register */
+#define MPU_TYPE_IREGION_Pos               16                                             /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos                8                                             /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk               (0xFFUL << MPU_TYPE_DREGION_Pos)               /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos               0                                             /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk              (1UL << MPU_TYPE_SEPARATE_Pos)                 /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register */
+#define MPU_CTRL_PRIVDEFENA_Pos             2                                             /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk            (1UL << MPU_CTRL_PRIVDEFENA_Pos)               /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos               1                                             /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk              (1UL << MPU_CTRL_HFNMIENA_Pos)                 /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos                 0                                             /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk                (1UL << MPU_CTRL_ENABLE_Pos)                   /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register */
+#define MPU_RNR_REGION_Pos                  0                                             /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk                 (0xFFUL << MPU_RNR_REGION_Pos)                 /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register */
+#define MPU_RBAR_ADDR_Pos                   5                                             /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk                  (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos)             /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos                  4                                             /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk                 (1UL << MPU_RBAR_VALID_Pos)                    /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos                 0                                             /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk                (0xFUL << MPU_RBAR_REGION_Pos)                 /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register */
+#define MPU_RASR_ATTRS_Pos                 16                                             /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk                 (0xFFFFUL << MPU_RASR_ATTRS_Pos)               /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos                    28                                             /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk                    (1UL << MPU_RASR_XN_Pos)                       /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos                    24                                             /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk                    (0x7UL << MPU_RASR_AP_Pos)                     /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos                   19                                             /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk                   (0x7UL << MPU_RASR_TEX_Pos)                    /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos                     18                                             /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk                     (1UL << MPU_RASR_S_Pos)                        /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos                     17                                             /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk                     (1UL << MPU_RASR_C_Pos)                        /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos                     16                                             /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk                     (1UL << MPU_RASR_B_Pos)                        /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos                    8                                             /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk                   (0xFFUL << MPU_RASR_SRD_Pos)                   /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos                   1                                             /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk                  (0x1FUL << MPU_RASR_SIZE_Pos)                  /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos                 0                                             /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk                (1UL << MPU_RASR_ENABLE_Pos)                   /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
+    \brief      Type definitions for the Core Debug Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+  __IO uint32_t DHCSR;                   /*!< Offset: 0x000 (R/W)  Debug Halting Control and Status Register    */
+  __O  uint32_t DCRSR;                   /*!< Offset: 0x004 ( /W)  Debug Core Register Selector Register        */
+  __IO uint32_t DCRDR;                   /*!< Offset: 0x008 (R/W)  Debug Core Register Data Register            */
+  __IO uint32_t DEMCR;                   /*!< Offset: 0x00C (R/W)  Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register */
+#define CoreDebug_DHCSR_DBGKEY_Pos         16                                             /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk         (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos)       /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos     25                                             /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk     (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos)        /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos    24                                             /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk    (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos)       /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos       19                                             /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk       (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos)          /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos        18                                             /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk        (1UL << CoreDebug_DHCSR_S_SLEEP_Pos)           /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos         17                                             /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk         (1UL << CoreDebug_DHCSR_S_HALT_Pos)            /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos       16                                             /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk       (1UL << CoreDebug_DHCSR_S_REGRDY_Pos)          /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos     5                                             /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk    (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos)       /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos      3                                             /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk     (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos)        /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos          2                                             /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk         (1UL << CoreDebug_DHCSR_C_STEP_Pos)            /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos          1                                             /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk         (1UL << CoreDebug_DHCSR_C_HALT_Pos)            /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos       0                                             /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk      (1UL << CoreDebug_DHCSR_C_DEBUGEN_Pos)         /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register */
+#define CoreDebug_DCRSR_REGWnR_Pos         16                                             /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk         (1UL << CoreDebug_DCRSR_REGWnR_Pos)            /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos          0                                             /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk         (0x1FUL << CoreDebug_DCRSR_REGSEL_Pos)         /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register */
+#define CoreDebug_DEMCR_TRCENA_Pos         24                                             /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk         (1UL << CoreDebug_DEMCR_TRCENA_Pos)            /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos        19                                             /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk        (1UL << CoreDebug_DEMCR_MON_REQ_Pos)           /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos       18                                             /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk       (1UL << CoreDebug_DEMCR_MON_STEP_Pos)          /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos       17                                             /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk       (1UL << CoreDebug_DEMCR_MON_PEND_Pos)          /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos         16                                             /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk         (1UL << CoreDebug_DEMCR_MON_EN_Pos)            /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos     10                                             /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk     (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos)        /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos       9                                             /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk      (1UL << CoreDebug_DEMCR_VC_INTERR_Pos)         /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos       8                                             /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk      (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos)         /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos      7                                             /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk     (1UL << CoreDebug_DEMCR_VC_STATERR_Pos)        /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos       6                                             /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk      (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos)         /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos      5                                             /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk     (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos)        /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos        4                                             /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk       (1UL << CoreDebug_DEMCR_VC_MMERR_Pos)          /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos    0                                             /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk   (1UL << CoreDebug_DEMCR_VC_CORERESET_Pos)      /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_core_base     Core Definitions
+    \brief      Definitions for base addresses, unions, and structures.
+  @{
+ */
+
+/* Memory mapping of Cortex-M3 Hardware */
+#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address  */
+#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address                   */
+#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address                   */
+#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address                   */
+#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address            */
+#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address               */
+#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address                  */
+#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address  */
+
+#define SCnSCB              ((SCnSCB_Type    *)     SCS_BASE      )   /*!< System control Register not in SCB */
+#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct           */
+#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct       */
+#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct          */
+#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct           */
+#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct           */
+#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct           */
+#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct    */
+
+#if (__MPU_PRESENT == 1)
+  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit             */
+  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit             */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ *                Hardware Abstraction Layer
+  Core Function Interface contains:
+  - Core NVIC Functions
+  - Core SysTick Functions
+  - Core Debug Functions
+  - Core Register Access Functions
+ ******************************************************************************/
+/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ##########################   NVIC functions  #################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+    \brief      Functions that manage interrupts and exceptions via the NVIC.
+    @{
+ */
+
+/** \brief  Set Priority Grouping
+
+  The function sets the priority grouping field using the required unlock sequence.
+  The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+  Only values from 0..7 are used.
+  In case of a conflict between priority grouping and available
+  priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+
+    \param [in]      PriorityGroup  Priority grouping field.
+ */
+__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+  uint32_t reg_value;
+  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07);               /* only values 0..7 are used          */
+
+  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
+  reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk);             /* clear bits to change               */
+  reg_value  =  (reg_value                                 |
+                ((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) |
+                (PriorityGroupTmp << 8));                                     /* Insert write key and priorty group */
+  SCB->AIRCR =  reg_value;
+}
+
+
+/** \brief  Get Priority Grouping
+
+  The function reads the priority grouping field from the NVIC Interrupt Controller.
+
+    \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
+{
+  return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos);   /* read priority grouping field */
+}
+
+
+/** \brief  Enable External Interrupt
+
+    The function enables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* enable interrupt */
+}
+
+
+/** \brief  Disable External Interrupt
+
+    The function disables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */
+}
+
+
+/** \brief  Get Pending Interrupt
+
+    The function reads the pending register in the NVIC and returns the pending bit
+    for the specified interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not pending.
+    \return             1  Interrupt status is pending.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+  return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */
+}
+
+
+/** \brief  Set Pending Interrupt
+
+    The function sets the pending bit of an external interrupt.
+
+    \param [in]      IRQn  Interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */
+}
+
+
+/** \brief  Clear Pending Interrupt
+
+    The function clears the pending bit of an external interrupt.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
+}
+
+
+/** \brief  Get Active Interrupt
+
+    The function reads the active register in NVIC and returns the active bit.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not active.
+    \return             1  Interrupt status is active.
+ */
+__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
+{
+  return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */
+}
+
+
+/** \brief  Set Interrupt Priority
+
+    The function sets the priority of an interrupt.
+
+    \note The priority cannot be set for every core interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+    \param [in]  priority  Priority to set.
+ */
+__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+  if(IRQn < 0) {
+    SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M  System Interrupts */
+  else {
+    NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff);    }        /* set Priority for device specific Interrupts  */
+}
+
+
+/** \brief  Get Interrupt Priority
+
+    The function reads the priority of an interrupt. The interrupt
+    number can be positive to specify an external (device specific)
+    interrupt, or negative to specify an internal (core) interrupt.
+
+
+    \param [in]   IRQn  Interrupt number.
+    \return             Interrupt Priority. Value is aligned automatically to the implemented
+                        priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+  if(IRQn < 0) {
+    return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M  system interrupts */
+  else {
+    return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)]           >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts  */
+}
+
+
+/** \brief  Encode Priority
+
+    The function encodes the priority for an interrupt with the given priority group,
+    preemptive priority value, and subpriority value.
+    In case of a conflict between priority grouping and available
+    priority bits (__NVIC_PRIO_BITS), the samllest possible priority group is set.
+
+    \param [in]     PriorityGroup  Used priority group.
+    \param [in]   PreemptPriority  Preemptive priority value (starting from 0).
+    \param [in]       SubPriority  Subpriority value (starting from 0).
+    \return                        Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+  uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);          /* only values 0..7 are used          */
+  uint32_t PreemptPriorityBits;
+  uint32_t SubPriorityBits;
+
+  PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
+  SubPriorityBits     = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
+
+  return (
+           ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |
+           ((SubPriority     & ((1 << (SubPriorityBits    )) - 1)))
+         );
+}
+
+
+/** \brief  Decode Priority
+
+    The function decodes an interrupt priority value with a given priority group to
+    preemptive priority value and subpriority value.
+    In case of a conflict between priority grouping and available
+    priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
+
+    \param [in]         Priority   Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+    \param [in]     PriorityGroup  Used priority group.
+    \param [out] pPreemptPriority  Preemptive priority value (starting from 0).
+    \param [out]     pSubPriority  Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
+{
+  uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);          /* only values 0..7 are used          */
+  uint32_t PreemptPriorityBits;
+  uint32_t SubPriorityBits;
+
+  PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
+  SubPriorityBits     = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
+
+  *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);
+  *pSubPriority     = (Priority                   ) & ((1 << (SubPriorityBits    )) - 1);
+}
+
+
+/** \brief  System Reset
+
+    The function initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void NVIC_SystemReset(void)
+{
+  __DSB();                                                     /* Ensure all outstanding memory accesses included
+                                                                  buffered write are completed before reset */
+  SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
+                 (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+                 SCB_AIRCR_SYSRESETREQ_Msk);                   /* Keep priority group unchanged */
+  __DSB();                                                     /* Ensure completion of memory access */
+  while(1);                                                    /* wait until reset */
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+
+/* ##################################    SysTick function  ############################################ */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+    \brief      Functions that configure the System.
+  @{
+ */
+
+#if (__Vendor_SysTickConfig == 0)
+
+/** \brief  System Tick Configuration
+
+    The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
+    Counter is in free running mode to generate periodic interrupts.
+
+    \param [in]  ticks  Number of ticks between two interrupts.
+
+    \return          0  Function succeeded.
+    \return          1  Function failed.
+
+    \note     When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+    function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+    must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+  if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)  return (1);      /* Reload value impossible */
+
+  SysTick->LOAD  = ticks - 1;                                  /* set reload register */
+  NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);  /* set Priority for Systick Interrupt */
+  SysTick->VAL   = 0;                                          /* Load the SysTick Counter Value */
+  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
+                   SysTick_CTRL_TICKINT_Msk   |
+                   SysTick_CTRL_ENABLE_Msk;                    /* Enable SysTick IRQ and SysTick Timer */
+  return (0);                                                  /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_core_DebugFunctions ITM Functions
+    \brief   Functions that access the ITM debug interface.
+  @{
+ */
+
+extern volatile int32_t ITM_RxBuffer;                    /*!< External variable to receive characters.                         */
+#define                 ITM_RXBUFFER_EMPTY    0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/** \brief  ITM Send Character
+
+    The function transmits a character via the ITM channel 0, and
+    \li Just returns when no debugger is connected that has booked the output.
+    \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+
+    \param [in]     ch  Character to transmit.
+
+    \returns            Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+  if ((ITM->TCR & ITM_TCR_ITMENA_Msk)                  &&      /* ITM enabled */
+      (ITM->TER & (1UL << 0)        )                    )     /* ITM Port #0 enabled */
+  {
+    while (ITM->PORT[0].u32 == 0);
+    ITM->PORT[0].u8 = (uint8_t) ch;
+  }
+  return (ch);
+}
+
+
+/** \brief  ITM Receive Character
+
+    The function inputs a character via the external variable \ref ITM_RxBuffer.
+
+    \return             Received character.
+    \return         -1  No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void) {
+  int32_t ch = -1;                           /* no character available */
+
+  if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
+    ch = ITM_RxBuffer;
+    ITM_RxBuffer = ITM_RXBUFFER_EMPTY;       /* ready for next character */
+  }
+
+  return (ch);
+}
+
+
+/** \brief  ITM Check Character
+
+    The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+
+    \return          0  No character available.
+    \return          1  Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void) {
+
+  if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
+    return (0);                                 /* no character available */
+  } else {
+    return (1);                                 /*    character available */
+  }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+#endif /* __CORE_CM3_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
+
+#ifdef __cplusplus
+}
+#endif

+ 1772 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_cm4.h

@@ -0,0 +1,1772 @@
+/**************************************************************************//**
+ * @file     core_cm4.h
+ * @brief    CMSIS Cortex-M4 Core Peripheral Access Layer Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include  /* treat file as system include file for MISRA check */
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifndef __CORE_CM4_H_GENERIC
+#define __CORE_CM4_H_GENERIC
+
+/** \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
+  CMSIS violates the following MISRA-C:2004 rules:
+
+   \li Required Rule 8.5, object/function definition in header file.<br>
+     Function definitions in header files are used to allow 'inlining'.
+
+   \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+     Unions are used for effective representation of core registers.
+
+   \li Advisory Rule 19.7, Function-like macro defined.<br>
+     Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ *                 CMSIS definitions
+ ******************************************************************************/
+/** \ingroup Cortex_M4
+  @{
+ */
+
+/*  CMSIS CM4 definitions */
+#define __CM4_CMSIS_VERSION_MAIN  (0x03)                                   /*!< [31:16] CMSIS HAL main version   */
+#define __CM4_CMSIS_VERSION_SUB   (0x20)                                   /*!< [15:0]  CMSIS HAL sub version    */
+#define __CM4_CMSIS_VERSION       ((__CM4_CMSIS_VERSION_MAIN << 16) | \
+                                    __CM4_CMSIS_VERSION_SUB          )     /*!< CMSIS HAL version number         */
+
+#define __CORTEX_M                (0x04)                                   /*!< Cortex-M Core                    */
+
+
+#if   defined ( __CC_ARM )
+  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
+  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
+  #define __STATIC_INLINE  static __inline
+
+#elif defined ( __ICCARM__ )
+  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TMS470__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TI CCS Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __GNUC__ )
+  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TASKING__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
+  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
+  #define __STATIC_INLINE  static inline
+
+#endif
+
+/** __FPU_USED indicates whether an FPU is used or not. For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+  #if defined __TARGET_FPU_VFP
+    #if (__FPU_PRESENT == 1)
+      #define __FPU_USED       1
+    #else
+      #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+      #define __FPU_USED       0
+    #endif
+  #else
+    #define __FPU_USED         0
+  #endif
+
+#elif defined ( __ICCARM__ )
+  #if defined __ARMVFP__
+    #if (__FPU_PRESENT == 1)
+      #define __FPU_USED       1
+    #else
+      #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+      #define __FPU_USED       0
+    #endif
+  #else
+    #define __FPU_USED         0
+  #endif
+
+#elif defined ( __TMS470__ )
+  #if defined __TI_VFP_SUPPORT__
+    #if (__FPU_PRESENT == 1)
+      #define __FPU_USED       1
+    #else
+      #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+      #define __FPU_USED       0
+    #endif
+  #else
+    #define __FPU_USED         0
+  #endif
+
+#elif defined ( __GNUC__ )
+  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+    #if (__FPU_PRESENT == 1)
+      #define __FPU_USED       1
+    #else
+      #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+      #define __FPU_USED       0
+    #endif
+  #else
+    #define __FPU_USED         0
+  #endif
+
+#elif defined ( __TASKING__ )
+  #if defined __FPU_VFP__
+    #if (__FPU_PRESENT == 1)
+      #define __FPU_USED       1
+    #else
+      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+      #define __FPU_USED       0
+    #endif
+  #else
+    #define __FPU_USED         0
+  #endif
+#endif
+
+#include <stdint.h>                      /* standard types definitions                      */
+#include <core_cmInstr.h>                /* Core Instruction Access                         */
+#include <core_cmFunc.h>                 /* Core Function Access                            */
+#include <core_cm4_simd.h>               /* Compiler specific SIMD Intrinsics               */
+
+#endif /* __CORE_CM4_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM4_H_DEPENDANT
+#define __CORE_CM4_H_DEPENDANT
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+  #ifndef __CM4_REV
+    #define __CM4_REV               0x0000
+    #warning "__CM4_REV not defined in device header file; using default!"
+  #endif
+
+  #ifndef __FPU_PRESENT
+    #define __FPU_PRESENT             0
+    #warning "__FPU_PRESENT not defined in device header file; using default!"
+  #endif
+
+  #ifndef __MPU_PRESENT
+    #define __MPU_PRESENT             0
+    #warning "__MPU_PRESENT not defined in device header file; using default!"
+  #endif
+
+  #ifndef __NVIC_PRIO_BITS
+    #define __NVIC_PRIO_BITS          4
+    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+  #endif
+
+  #ifndef __Vendor_SysTickConfig
+    #define __Vendor_SysTickConfig    0
+    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+  #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+    \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+    <strong>IO Type Qualifiers</strong> are used
+    \li to specify the access to peripheral variables.
+    \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
+#else
+  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
+#endif
+#define     __O     volatile             /*!< Defines 'write only' permissions                */
+#define     __IO    volatile             /*!< Defines 'read / write' permissions              */
+
+/*@} end of group Cortex_M4 */
+
+
+
+/*******************************************************************************
+ *                 Register Abstraction
+  Core Register contain:
+  - Core Register
+  - Core NVIC Register
+  - Core SCB Register
+  - Core SysTick Register
+  - Core Debug Register
+  - Core MPU Register
+  - Core FPU Register
+ ******************************************************************************/
+/** \defgroup CMSIS_core_register Defines and Type Definitions
+    \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_CORE  Status and Control Registers
+    \brief  Core Register type definitions.
+  @{
+ */
+
+/** \brief  Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+  struct
+  {
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:27;              /*!< bit:  0..26  Reserved                           */
+#else
+    uint32_t _reserved0:16;              /*!< bit:  0..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:7;               /*!< bit: 20..26  Reserved                           */
+#endif
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} APSR_Type;
+
+
+/** \brief  Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} IPSR_Type;
+
+
+/** \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved                           */
+#else
+    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved                           */
+#endif
+    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0)          */
+    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0)          */
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} xPSR_Type;
+
+
+/** \brief  Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t nPRIV:1;                    /*!< bit:      0  Execution privilege in Thread mode */
+    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used                   */
+    uint32_t FPCA:1;                     /*!< bit:      2  FP extension active flag           */
+    uint32_t _reserved0:29;              /*!< bit:  3..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} CONTROL_Type;
+
+/*@} end of group CMSIS_CORE */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
+    \brief      Type definitions for the NVIC Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+  __IO uint32_t ISER[8];                 /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register           */
+       uint32_t RESERVED0[24];
+  __IO uint32_t ICER[8];                 /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register         */
+       uint32_t RSERVED1[24];
+  __IO uint32_t ISPR[8];                 /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register          */
+       uint32_t RESERVED2[24];
+  __IO uint32_t ICPR[8];                 /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register        */
+       uint32_t RESERVED3[24];
+  __IO uint32_t IABR[8];                 /*!< Offset: 0x200 (R/W)  Interrupt Active bit Register           */
+       uint32_t RESERVED4[56];
+  __IO uint8_t  IP[240];                 /*!< Offset: 0x300 (R/W)  Interrupt Priority Register (8Bit wide) */
+       uint32_t RESERVED5[644];
+  __O  uint32_t STIR;                    /*!< Offset: 0xE00 ( /W)  Software Trigger Interrupt Register     */
+}  NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos                 0                                          /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk                (0x1FFUL << NVIC_STIR_INTID_Pos)            /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCB     System Control Block (SCB)
+    \brief      Type definitions for the System Control Block Registers
+  @{
+ */
+
+/** \brief  Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
+  __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
+  __IO uint32_t VTOR;                    /*!< Offset: 0x008 (R/W)  Vector Table Offset Register                          */
+  __IO uint32_t AIRCR;                   /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register      */
+  __IO uint32_t SCR;                     /*!< Offset: 0x010 (R/W)  System Control Register                               */
+  __IO uint32_t CCR;                     /*!< Offset: 0x014 (R/W)  Configuration Control Register                        */
+  __IO uint8_t  SHP[12];                 /*!< Offset: 0x018 (R/W)  System Handlers Priority Registers (4-7, 8-11, 12-15) */
+  __IO uint32_t SHCSR;                   /*!< Offset: 0x024 (R/W)  System Handler Control and State Register             */
+  __IO uint32_t CFSR;                    /*!< Offset: 0x028 (R/W)  Configurable Fault Status Register                    */
+  __IO uint32_t HFSR;                    /*!< Offset: 0x02C (R/W)  HardFault Status Register                             */
+  __IO uint32_t DFSR;                    /*!< Offset: 0x030 (R/W)  Debug Fault Status Register                           */
+  __IO uint32_t MMFAR;                   /*!< Offset: 0x034 (R/W)  MemManage Fault Address Register                      */
+  __IO uint32_t BFAR;                    /*!< Offset: 0x038 (R/W)  BusFault Address Register                             */
+  __IO uint32_t AFSR;                    /*!< Offset: 0x03C (R/W)  Auxiliary Fault Status Register                       */
+  __I  uint32_t PFR[2];                  /*!< Offset: 0x040 (R/ )  Processor Feature Register                            */
+  __I  uint32_t DFR;                     /*!< Offset: 0x048 (R/ )  Debug Feature Register                                */
+  __I  uint32_t ADR;                     /*!< Offset: 0x04C (R/ )  Auxiliary Feature Register                            */
+  __I  uint32_t MMFR[4];                 /*!< Offset: 0x050 (R/ )  Memory Model Feature Register                         */
+  __I  uint32_t ISAR[5];                 /*!< Offset: 0x060 (R/ )  Instruction Set Attributes Register                   */
+       uint32_t RESERVED0[5];
+  __IO uint32_t CPACR;                   /*!< Offset: 0x088 (R/W)  Coprocessor Access Control Register                   */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos          24                                             /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos              20                                             /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos         16                                             /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos                4                                             /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos              0                                             /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk             (0xFUL << SCB_CPUID_REVISION_Pos)              /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos            31                                             /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos             28                                             /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos             27                                             /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos             26                                             /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos             25                                             /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos            23                                             /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos            22                                             /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos           12                                             /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos             11                                             /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk             (1UL << SCB_ICSR_RETTOBASE_Pos)                /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos             0                                             /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos)           /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos                 7                                             /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk                (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos)           /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos              16                                             /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos          16                                             /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos            15                                             /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos              8                                             /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk             (7UL << SCB_AIRCR_PRIGROUP_Pos)                /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos           2                                             /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos         1                                             /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos             0                                             /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk            (1UL << SCB_AIRCR_VECTRESET_Pos)               /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos               4                                             /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos               2                                             /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos             1                                             /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos                9                                             /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos               8                                             /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk              (1UL << SCB_CCR_BFHFNMIGN_Pos)                 /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos               4                                             /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk              (1UL << SCB_CCR_DIV_0_TRP_Pos)                 /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos             3                                             /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos            1                                             /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk           (1UL << SCB_CCR_USERSETMPEND_Pos)              /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos          0                                             /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk         (1UL << SCB_CCR_NONBASETHRDENA_Pos)            /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos          18                                             /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk          (1UL << SCB_SHCSR_USGFAULTENA_Pos)             /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos          17                                             /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk          (1UL << SCB_SHCSR_BUSFAULTENA_Pos)             /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos          16                                             /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk          (1UL << SCB_SHCSR_MEMFAULTENA_Pos)             /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos         15                                             /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos       14                                             /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk       (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos)          /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos       13                                             /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk       (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos)          /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos       12                                             /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk       (1UL << SCB_SHCSR_USGFAULTPENDED_Pos)          /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos           11                                             /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk           (1UL << SCB_SHCSR_SYSTICKACT_Pos)              /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos            10                                             /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk            (1UL << SCB_SHCSR_PENDSVACT_Pos)               /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos            8                                             /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk           (1UL << SCB_SHCSR_MONITORACT_Pos)              /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos             7                                             /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk            (1UL << SCB_SHCSR_SVCALLACT_Pos)               /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos           3                                             /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk          (1UL << SCB_SHCSR_USGFAULTACT_Pos)             /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos           1                                             /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk          (1UL << SCB_SHCSR_BUSFAULTACT_Pos)             /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos           0                                             /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk          (1UL << SCB_SHCSR_MEMFAULTACT_Pos)             /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Registers Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos            16                                             /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk            (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos)          /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos             8                                             /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos             0                                             /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL << SCB_CFSR_MEMFAULTSR_Pos)            /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* SCB Hard Fault Status Registers Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos              31                                             /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos                30                                             /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk                (1UL << SCB_HFSR_FORCED_Pos)                   /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos                1                                             /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk               (1UL << SCB_HFSR_VECTTBL_Pos)                  /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos               4                                             /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk              (1UL << SCB_DFSR_EXTERNAL_Pos)                 /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos                 3                                             /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk                (1UL << SCB_DFSR_VCATCH_Pos)                   /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos                2                                             /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk               (1UL << SCB_DFSR_DWTTRAP_Pos)                  /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos                   1                                             /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk                  (1UL << SCB_DFSR_BKPT_Pos)                     /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos                 0                                             /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk                (1UL << SCB_DFSR_HALTED_Pos)                   /*!< SCB DFSR: HALTED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+    \brief      Type definitions for the System Control and ID Register not in the SCB
+  @{
+ */
+
+/** \brief  Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+       uint32_t RESERVED0[1];
+  __I  uint32_t ICTR;                    /*!< Offset: 0x004 (R/ )  Interrupt Controller Type Register      */
+  __IO uint32_t ACTLR;                   /*!< Offset: 0x008 (R/W)  Auxiliary Control Register              */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos         0                                          /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk        (0xFUL << SCnSCB_ICTR_INTLINESNUM_Pos)      /*!< ICTR: INTLINESNUM Mask */
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISOOFP_Pos            9                                          /*!< ACTLR: DISOOFP Position */
+#define SCnSCB_ACTLR_DISOOFP_Msk           (1UL << SCnSCB_ACTLR_DISOOFP_Pos)           /*!< ACTLR: DISOOFP Mask */
+
+#define SCnSCB_ACTLR_DISFPCA_Pos            8                                          /*!< ACTLR: DISFPCA Position */
+#define SCnSCB_ACTLR_DISFPCA_Msk           (1UL << SCnSCB_ACTLR_DISFPCA_Pos)           /*!< ACTLR: DISFPCA Mask */
+
+#define SCnSCB_ACTLR_DISFOLD_Pos            2                                          /*!< ACTLR: DISFOLD Position */
+#define SCnSCB_ACTLR_DISFOLD_Msk           (1UL << SCnSCB_ACTLR_DISFOLD_Pos)           /*!< ACTLR: DISFOLD Mask */
+
+#define SCnSCB_ACTLR_DISDEFWBUF_Pos         1                                          /*!< ACTLR: DISDEFWBUF Position */
+#define SCnSCB_ACTLR_DISDEFWBUF_Msk        (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos)        /*!< ACTLR: DISDEFWBUF Mask */
+
+#define SCnSCB_ACTLR_DISMCYCINT_Pos         0                                          /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk        (1UL << SCnSCB_ACTLR_DISMCYCINT_Pos)        /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
+    \brief      Type definitions for the System Timer Registers.
+  @{
+ */
+
+/** \brief  Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
+  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
+  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
+  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk            (1UL << SysTick_CTRL_ENABLE_Pos)               /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos)        /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_ITM     Instrumentation Trace Macrocell (ITM)
+    \brief      Type definitions for the Instrumentation Trace Macrocell (ITM)
+  @{
+ */
+
+/** \brief  Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+  __O  union
+  {
+    __O  uint8_t    u8;                  /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 8-bit                   */
+    __O  uint16_t   u16;                 /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 16-bit                  */
+    __O  uint32_t   u32;                 /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 32-bit                  */
+  }  PORT [32];                          /*!< Offset: 0x000 ( /W)  ITM Stimulus Port Registers               */
+       uint32_t RESERVED0[864];
+  __IO uint32_t TER;                     /*!< Offset: 0xE00 (R/W)  ITM Trace Enable Register                 */
+       uint32_t RESERVED1[15];
+  __IO uint32_t TPR;                     /*!< Offset: 0xE40 (R/W)  ITM Trace Privilege Register              */
+       uint32_t RESERVED2[15];
+  __IO uint32_t TCR;                     /*!< Offset: 0xE80 (R/W)  ITM Trace Control Register                */
+       uint32_t RESERVED3[29];
+  __O  uint32_t IWR;                     /*!< Offset: 0xEF8 ( /W)  ITM Integration Write Register            */
+  __I  uint32_t IRR;                     /*!< Offset: 0xEFC (R/ )  ITM Integration Read Register             */
+  __IO uint32_t IMCR;                    /*!< Offset: 0xF00 (R/W)  ITM Integration Mode Control Register     */
+       uint32_t RESERVED4[43];
+  __O  uint32_t LAR;                     /*!< Offset: 0xFB0 ( /W)  ITM Lock Access Register                  */
+  __I  uint32_t LSR;                     /*!< Offset: 0xFB4 (R/ )  ITM Lock Status Register                  */
+       uint32_t RESERVED5[6];
+  __I  uint32_t PID4;                    /*!< Offset: 0xFD0 (R/ )  ITM Peripheral Identification Register #4 */
+  __I  uint32_t PID5;                    /*!< Offset: 0xFD4 (R/ )  ITM Peripheral Identification Register #5 */
+  __I  uint32_t PID6;                    /*!< Offset: 0xFD8 (R/ )  ITM Peripheral Identification Register #6 */
+  __I  uint32_t PID7;                    /*!< Offset: 0xFDC (R/ )  ITM Peripheral Identification Register #7 */
+  __I  uint32_t PID0;                    /*!< Offset: 0xFE0 (R/ )  ITM Peripheral Identification Register #0 */
+  __I  uint32_t PID1;                    /*!< Offset: 0xFE4 (R/ )  ITM Peripheral Identification Register #1 */
+  __I  uint32_t PID2;                    /*!< Offset: 0xFE8 (R/ )  ITM Peripheral Identification Register #2 */
+  __I  uint32_t PID3;                    /*!< Offset: 0xFEC (R/ )  ITM Peripheral Identification Register #3 */
+  __I  uint32_t CID0;                    /*!< Offset: 0xFF0 (R/ )  ITM Component  Identification Register #0 */
+  __I  uint32_t CID1;                    /*!< Offset: 0xFF4 (R/ )  ITM Component  Identification Register #1 */
+  __I  uint32_t CID2;                    /*!< Offset: 0xFF8 (R/ )  ITM Component  Identification Register #2 */
+  __I  uint32_t CID3;                    /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos                0                                             /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk               (0xFUL << ITM_TPR_PRIVMASK_Pos)                /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos                   23                                             /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos             16                                             /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk             (0x7FUL << ITM_TCR_TraceBusID_Pos)             /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos                10                                             /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk                (3UL << ITM_TCR_GTSFREQ_Pos)                   /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos              8                                             /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk             (3UL << ITM_TCR_TSPrescale_Pos)                /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos                  4                                             /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk                 (1UL << ITM_TCR_SWOENA_Pos)                    /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos                  3                                             /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk                 (1UL << ITM_TCR_DWTENA_Pos)                    /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos                 2                                             /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk                (1UL << ITM_TCR_SYNCENA_Pos)                   /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos                   1                                             /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk                  (1UL << ITM_TCR_TSENA_Pos)                     /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos                  0                                             /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk                 (1UL << ITM_TCR_ITMENA_Pos)                    /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Integration Write Register Definitions */
+#define ITM_IWR_ATVALIDM_Pos                0                                             /*!< ITM IWR: ATVALIDM Position */
+#define ITM_IWR_ATVALIDM_Msk               (1UL << ITM_IWR_ATVALIDM_Pos)                  /*!< ITM IWR: ATVALIDM Mask */
+
+/* ITM Integration Read Register Definitions */
+#define ITM_IRR_ATREADYM_Pos                0                                             /*!< ITM IRR: ATREADYM Position */
+#define ITM_IRR_ATREADYM_Msk               (1UL << ITM_IRR_ATREADYM_Pos)                  /*!< ITM IRR: ATREADYM Mask */
+
+/* ITM Integration Mode Control Register Definitions */
+#define ITM_IMCR_INTEGRATION_Pos            0                                             /*!< ITM IMCR: INTEGRATION Position */
+#define ITM_IMCR_INTEGRATION_Msk           (1UL << ITM_IMCR_INTEGRATION_Pos)              /*!< ITM IMCR: INTEGRATION Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos                 2                                             /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk                (1UL << ITM_LSR_ByteAcc_Pos)                   /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos                  1                                             /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk                 (1UL << ITM_LSR_Access_Pos)                    /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos                 0                                             /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk                (1UL << ITM_LSR_Present_Pos)                   /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_DWT     Data Watchpoint and Trace (DWT)
+    \brief      Type definitions for the Data Watchpoint and Trace (DWT)
+  @{
+ */
+
+/** \brief  Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  Control Register                          */
+  __IO uint32_t CYCCNT;                  /*!< Offset: 0x004 (R/W)  Cycle Count Register                      */
+  __IO uint32_t CPICNT;                  /*!< Offset: 0x008 (R/W)  CPI Count Register                        */
+  __IO uint32_t EXCCNT;                  /*!< Offset: 0x00C (R/W)  Exception Overhead Count Register         */
+  __IO uint32_t SLEEPCNT;                /*!< Offset: 0x010 (R/W)  Sleep Count Register                      */
+  __IO uint32_t LSUCNT;                  /*!< Offset: 0x014 (R/W)  LSU Count Register                        */
+  __IO uint32_t FOLDCNT;                 /*!< Offset: 0x018 (R/W)  Folded-instruction Count Register         */
+  __I  uint32_t PCSR;                    /*!< Offset: 0x01C (R/ )  Program Counter Sample Register           */
+  __IO uint32_t COMP0;                   /*!< Offset: 0x020 (R/W)  Comparator Register 0                     */
+  __IO uint32_t MASK0;                   /*!< Offset: 0x024 (R/W)  Mask Register 0                           */
+  __IO uint32_t FUNCTION0;               /*!< Offset: 0x028 (R/W)  Function Register 0                       */
+       uint32_t RESERVED0[1];
+  __IO uint32_t COMP1;                   /*!< Offset: 0x030 (R/W)  Comparator Register 1                     */
+  __IO uint32_t MASK1;                   /*!< Offset: 0x034 (R/W)  Mask Register 1                           */
+  __IO uint32_t FUNCTION1;               /*!< Offset: 0x038 (R/W)  Function Register 1                       */
+       uint32_t RESERVED1[1];
+  __IO uint32_t COMP2;                   /*!< Offset: 0x040 (R/W)  Comparator Register 2                     */
+  __IO uint32_t MASK2;                   /*!< Offset: 0x044 (R/W)  Mask Register 2                           */
+  __IO uint32_t FUNCTION2;               /*!< Offset: 0x048 (R/W)  Function Register 2                       */
+       uint32_t RESERVED2[1];
+  __IO uint32_t COMP3;                   /*!< Offset: 0x050 (R/W)  Comparator Register 3                     */
+  __IO uint32_t MASK3;                   /*!< Offset: 0x054 (R/W)  Mask Register 3                           */
+  __IO uint32_t FUNCTION3;               /*!< Offset: 0x058 (R/W)  Function Register 3                       */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos               28                                          /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk               (0xFUL << DWT_CTRL_NUMCOMP_Pos)             /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos              27                                          /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk              (0x1UL << DWT_CTRL_NOTRCPKT_Pos)            /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos             26                                          /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk             (0x1UL << DWT_CTRL_NOEXTTRIG_Pos)           /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos              25                                          /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk              (0x1UL << DWT_CTRL_NOCYCCNT_Pos)            /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos              24                                          /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk              (0x1UL << DWT_CTRL_NOPRFCNT_Pos)            /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos             22                                          /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk             (0x1UL << DWT_CTRL_CYCEVTENA_Pos)           /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos            21                                          /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk            (0x1UL << DWT_CTRL_FOLDEVTENA_Pos)          /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos             20                                          /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk             (0x1UL << DWT_CTRL_LSUEVTENA_Pos)           /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos           19                                          /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk           (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos)         /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos             18                                          /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk             (0x1UL << DWT_CTRL_EXCEVTENA_Pos)           /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos             17                                          /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk             (0x1UL << DWT_CTRL_CPIEVTENA_Pos)           /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos             16                                          /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk             (0x1UL << DWT_CTRL_EXCTRCENA_Pos)           /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos            12                                          /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk            (0x1UL << DWT_CTRL_PCSAMPLENA_Pos)          /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos               10                                          /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk               (0x3UL << DWT_CTRL_SYNCTAP_Pos)             /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos                 9                                          /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk                (0x1UL << DWT_CTRL_CYCTAP_Pos)              /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos               5                                          /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk              (0xFUL << DWT_CTRL_POSTINIT_Pos)            /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos             1                                          /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk            (0xFUL << DWT_CTRL_POSTPRESET_Pos)          /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos              0                                          /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk             (0x1UL << DWT_CTRL_CYCCNTENA_Pos)           /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos               0                                          /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk              (0xFFUL << DWT_CPICNT_CPICNT_Pos)           /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos               0                                          /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk              (0xFFUL << DWT_EXCCNT_EXCCNT_Pos)           /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos           0                                          /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk          (0xFFUL << DWT_SLEEPCNT_SLEEPCNT_Pos)       /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos               0                                          /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk              (0xFFUL << DWT_LSUCNT_LSUCNT_Pos)           /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos             0                                          /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk            (0xFFUL << DWT_FOLDCNT_FOLDCNT_Pos)         /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos                   0                                          /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk                  (0x1FUL << DWT_MASK_MASK_Pos)               /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos           24                                          /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk           (0x1UL << DWT_FUNCTION_MATCHED_Pos)         /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos        16                                          /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk        (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos)      /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos        12                                          /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk        (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos)      /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos         10                                          /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk         (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos)       /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos            9                                          /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk           (0x1UL << DWT_FUNCTION_LNK1ENA_Pos)         /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos         8                                          /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk        (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos)      /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos           7                                          /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk          (0x1UL << DWT_FUNCTION_CYCMATCH_Pos)        /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos          5                                          /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk         (0x1UL << DWT_FUNCTION_EMITRANGE_Pos)       /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos           0                                          /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk          (0xFUL << DWT_FUNCTION_FUNCTION_Pos)        /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_TPI     Trace Port Interface (TPI)
+    \brief      Type definitions for the Trace Port Interface (TPI)
+  @{
+ */
+
+/** \brief  Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+  __IO uint32_t SSPSR;                   /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register     */
+  __IO uint32_t CSPSR;                   /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
+       uint32_t RESERVED0[2];
+  __IO uint32_t ACPR;                    /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
+       uint32_t RESERVED1[55];
+  __IO uint32_t SPPR;                    /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
+       uint32_t RESERVED2[131];
+  __I  uint32_t FFSR;                    /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
+  __IO uint32_t FFCR;                    /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
+  __I  uint32_t FSCR;                    /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
+       uint32_t RESERVED3[759];
+  __I  uint32_t TRIGGER;                 /*!< Offset: 0xEE8 (R/ )  TRIGGER */
+  __I  uint32_t FIFO0;                   /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
+  __I  uint32_t ITATBCTR2;               /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
+       uint32_t RESERVED4[1];
+  __I  uint32_t ITATBCTR0;               /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
+  __I  uint32_t FIFO1;                   /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
+  __IO uint32_t ITCTRL;                  /*!< Offset: 0xF00 (R/W)  Integration Mode Control */
+       uint32_t RESERVED5[39];
+  __IO uint32_t CLAIMSET;                /*!< Offset: 0xFA0 (R/W)  Claim tag set */
+  __IO uint32_t CLAIMCLR;                /*!< Offset: 0xFA4 (R/W)  Claim tag clear */
+       uint32_t RESERVED7[8];
+  __I  uint32_t DEVID;                   /*!< Offset: 0xFC8 (R/ )  TPIU_DEVID */
+  __I  uint32_t DEVTYPE;                 /*!< Offset: 0xFCC (R/ )  TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos              0                                          /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk             (0x1FFFUL << TPI_ACPR_PRESCALER_Pos)        /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos                 0                                          /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk                (0x3UL << TPI_SPPR_TXMODE_Pos)              /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos              3                                          /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk             (0x1UL << TPI_FFSR_FtNonStop_Pos)           /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos              2                                          /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk             (0x1UL << TPI_FFSR_TCPresent_Pos)           /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos              1                                          /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk             (0x1UL << TPI_FFSR_FtStopped_Pos)           /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos               0                                          /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk              (0x1UL << TPI_FFSR_FlInProg_Pos)            /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos                 8                                          /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk                (0x1UL << TPI_FFCR_TrigIn_Pos)              /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos                1                                          /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk               (0x1UL << TPI_FFCR_EnFCont_Pos)             /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos             0                                          /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk            (0x1UL << TPI_TRIGGER_TRIGGER_Pos)          /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos          29                                          /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos)        /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos        27                                          /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk        (0x3UL << TPI_FIFO0_ITM_bytecount_Pos)      /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos          26                                          /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos)        /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos        24                                          /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk        (0x3UL << TPI_FIFO0_ETM_bytecount_Pos)      /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos                 16                                          /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk                 (0xFFUL << TPI_FIFO0_ETM2_Pos)              /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos                  8                                          /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk                 (0xFFUL << TPI_FIFO0_ETM1_Pos)              /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos                  0                                          /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk                 (0xFFUL << TPI_FIFO0_ETM0_Pos)              /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos           0                                          /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk          (0x1UL << TPI_ITATBCTR2_ATREADY_Pos)        /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos          29                                          /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos        27                                          /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk        (0x3UL << TPI_FIFO1_ITM_bytecount_Pos)      /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos          26                                          /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos)        /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos        24                                          /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk        (0x3UL << TPI_FIFO1_ETM_bytecount_Pos)      /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos                 16                                          /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk                 (0xFFUL << TPI_FIFO1_ITM2_Pos)              /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos                  8                                          /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk                 (0xFFUL << TPI_FIFO1_ITM1_Pos)              /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos                  0                                          /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk                 (0xFFUL << TPI_FIFO1_ITM0_Pos)              /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos           0                                          /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk          (0x1UL << TPI_ITATBCTR0_ATREADY_Pos)        /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos                 0                                          /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk                (0x1UL << TPI_ITCTRL_Mode_Pos)              /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos             11                                          /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos            10                                          /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk            (0x1UL << TPI_DEVID_MANCVALID_Pos)          /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos             9                                          /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk            (0x1UL << TPI_DEVID_PTINVALID_Pos)          /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos              6                                          /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk             (0x7UL << TPI_DEVID_MinBufSz_Pos)           /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos             5                                          /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk            (0x1UL << TPI_DEVID_AsynClkIn_Pos)          /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos          0                                          /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL << TPI_DEVID_NrTraceInput_Pos)      /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos             0                                          /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk            (0xFUL << TPI_DEVTYPE_SubType_Pos)          /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos           4                                          /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if (__MPU_PRESENT == 1)
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
+    \brief      Type definitions for the Memory Protection Unit (MPU)
+  @{
+ */
+
+/** \brief  Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+  __I  uint32_t TYPE;                    /*!< Offset: 0x000 (R/ )  MPU Type Register                              */
+  __IO uint32_t CTRL;                    /*!< Offset: 0x004 (R/W)  MPU Control Register                           */
+  __IO uint32_t RNR;                     /*!< Offset: 0x008 (R/W)  MPU Region RNRber Register                     */
+  __IO uint32_t RBAR;                    /*!< Offset: 0x00C (R/W)  MPU Region Base Address Register               */
+  __IO uint32_t RASR;                    /*!< Offset: 0x010 (R/W)  MPU Region Attribute and Size Register         */
+  __IO uint32_t RBAR_A1;                 /*!< Offset: 0x014 (R/W)  MPU Alias 1 Region Base Address Register       */
+  __IO uint32_t RASR_A1;                 /*!< Offset: 0x018 (R/W)  MPU Alias 1 Region Attribute and Size Register */
+  __IO uint32_t RBAR_A2;                 /*!< Offset: 0x01C (R/W)  MPU Alias 2 Region Base Address Register       */
+  __IO uint32_t RASR_A2;                 /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
+  __IO uint32_t RBAR_A3;                 /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register       */
+  __IO uint32_t RASR_A3;                 /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+/* MPU Type Register */
+#define MPU_TYPE_IREGION_Pos               16                                             /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos                8                                             /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk               (0xFFUL << MPU_TYPE_DREGION_Pos)               /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos               0                                             /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk              (1UL << MPU_TYPE_SEPARATE_Pos)                 /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register */
+#define MPU_CTRL_PRIVDEFENA_Pos             2                                             /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk            (1UL << MPU_CTRL_PRIVDEFENA_Pos)               /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos               1                                             /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk              (1UL << MPU_CTRL_HFNMIENA_Pos)                 /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos                 0                                             /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk                (1UL << MPU_CTRL_ENABLE_Pos)                   /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register */
+#define MPU_RNR_REGION_Pos                  0                                             /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk                 (0xFFUL << MPU_RNR_REGION_Pos)                 /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register */
+#define MPU_RBAR_ADDR_Pos                   5                                             /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk                  (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos)             /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos                  4                                             /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk                 (1UL << MPU_RBAR_VALID_Pos)                    /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos                 0                                             /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk                (0xFUL << MPU_RBAR_REGION_Pos)                 /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register */
+#define MPU_RASR_ATTRS_Pos                 16                                             /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk                 (0xFFFFUL << MPU_RASR_ATTRS_Pos)               /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos                    28                                             /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk                    (1UL << MPU_RASR_XN_Pos)                       /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos                    24                                             /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk                    (0x7UL << MPU_RASR_AP_Pos)                     /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos                   19                                             /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk                   (0x7UL << MPU_RASR_TEX_Pos)                    /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos                     18                                             /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk                     (1UL << MPU_RASR_S_Pos)                        /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos                     17                                             /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk                     (1UL << MPU_RASR_C_Pos)                        /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos                     16                                             /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk                     (1UL << MPU_RASR_B_Pos)                        /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos                    8                                             /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk                   (0xFFUL << MPU_RASR_SRD_Pos)                   /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos                   1                                             /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk                  (0x1FUL << MPU_RASR_SIZE_Pos)                  /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos                 0                                             /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk                (1UL << MPU_RASR_ENABLE_Pos)                   /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if (__FPU_PRESENT == 1)
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_FPU     Floating Point Unit (FPU)
+    \brief      Type definitions for the Floating Point Unit (FPU)
+  @{
+ */
+
+/** \brief  Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+       uint32_t RESERVED0[1];
+  __IO uint32_t FPCCR;                   /*!< Offset: 0x004 (R/W)  Floating-Point Context Control Register               */
+  __IO uint32_t FPCAR;                   /*!< Offset: 0x008 (R/W)  Floating-Point Context Address Register               */
+  __IO uint32_t FPDSCR;                  /*!< Offset: 0x00C (R/W)  Floating-Point Default Status Control Register        */
+  __I  uint32_t MVFR0;                   /*!< Offset: 0x010 (R/ )  Media and FP Feature Register 0                       */
+  __I  uint32_t MVFR1;                   /*!< Offset: 0x014 (R/ )  Media and FP Feature Register 1                       */
+} FPU_Type;
+
+/* Floating-Point Context Control Register */
+#define FPU_FPCCR_ASPEN_Pos                31                                             /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk                (1UL << FPU_FPCCR_ASPEN_Pos)                   /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos                30                                             /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk                (1UL << FPU_FPCCR_LSPEN_Pos)                   /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos                8                                             /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk               (1UL << FPU_FPCCR_MONRDY_Pos)                  /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos                 6                                             /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk                (1UL << FPU_FPCCR_BFRDY_Pos)                   /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos                 5                                             /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk                (1UL << FPU_FPCCR_MMRDY_Pos)                   /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos                 4                                             /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk                (1UL << FPU_FPCCR_HFRDY_Pos)                   /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos                3                                             /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk               (1UL << FPU_FPCCR_THREAD_Pos)                  /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_USER_Pos                  1                                             /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk                 (1UL << FPU_FPCCR_USER_Pos)                    /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos                0                                             /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk               (1UL << FPU_FPCCR_LSPACT_Pos)                  /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register */
+#define FPU_FPCAR_ADDRESS_Pos               3                                             /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk              (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos)        /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register */
+#define FPU_FPDSCR_AHP_Pos                 26                                             /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk                 (1UL << FPU_FPDSCR_AHP_Pos)                    /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos                  25                                             /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk                  (1UL << FPU_FPDSCR_DN_Pos)                     /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos                  24                                             /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk                  (1UL << FPU_FPDSCR_FZ_Pos)                     /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos               22                                             /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk               (3UL << FPU_FPDSCR_RMode_Pos)                  /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 */
+#define FPU_MVFR0_FP_rounding_modes_Pos    28                                             /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk    (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos)     /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos        24                                             /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk        (0xFUL << FPU_MVFR0_Short_vectors_Pos)         /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos          20                                             /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk          (0xFUL << FPU_MVFR0_Square_root_Pos)           /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos               16                                             /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk               (0xFUL << FPU_MVFR0_Divide_Pos)                /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos    12                                             /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk    (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos)     /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos      8                                             /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk     (0xFUL << FPU_MVFR0_Double_precision_Pos)      /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos      4                                             /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk     (0xFUL << FPU_MVFR0_Single_precision_Pos)      /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos      0                                             /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk     (0xFUL << FPU_MVFR0_A_SIMD_registers_Pos)      /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 */
+#define FPU_MVFR1_FP_fused_MAC_Pos         28                                             /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk         (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos)          /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos              24                                             /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk              (0xFUL << FPU_MVFR1_FP_HPFP_Pos)               /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos            4                                             /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk           (0xFUL << FPU_MVFR1_D_NaN_mode_Pos)            /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos              0                                             /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk             (0xFUL << FPU_MVFR1_FtZ_mode_Pos)              /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+#endif
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
+    \brief      Type definitions for the Core Debug Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+  __IO uint32_t DHCSR;                   /*!< Offset: 0x000 (R/W)  Debug Halting Control and Status Register    */
+  __O  uint32_t DCRSR;                   /*!< Offset: 0x004 ( /W)  Debug Core Register Selector Register        */
+  __IO uint32_t DCRDR;                   /*!< Offset: 0x008 (R/W)  Debug Core Register Data Register            */
+  __IO uint32_t DEMCR;                   /*!< Offset: 0x00C (R/W)  Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register */
+#define CoreDebug_DHCSR_DBGKEY_Pos         16                                             /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk         (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos)       /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos     25                                             /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk     (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos)        /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos    24                                             /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk    (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos)       /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos       19                                             /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk       (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos)          /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos        18                                             /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk        (1UL << CoreDebug_DHCSR_S_SLEEP_Pos)           /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos         17                                             /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk         (1UL << CoreDebug_DHCSR_S_HALT_Pos)            /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos       16                                             /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk       (1UL << CoreDebug_DHCSR_S_REGRDY_Pos)          /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos     5                                             /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk    (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos)       /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos      3                                             /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk     (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos)        /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos          2                                             /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk         (1UL << CoreDebug_DHCSR_C_STEP_Pos)            /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos          1                                             /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk         (1UL << CoreDebug_DHCSR_C_HALT_Pos)            /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos       0                                             /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk      (1UL << CoreDebug_DHCSR_C_DEBUGEN_Pos)         /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register */
+#define CoreDebug_DCRSR_REGWnR_Pos         16                                             /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk         (1UL << CoreDebug_DCRSR_REGWnR_Pos)            /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos          0                                             /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk         (0x1FUL << CoreDebug_DCRSR_REGSEL_Pos)         /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register */
+#define CoreDebug_DEMCR_TRCENA_Pos         24                                             /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk         (1UL << CoreDebug_DEMCR_TRCENA_Pos)            /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos        19                                             /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk        (1UL << CoreDebug_DEMCR_MON_REQ_Pos)           /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos       18                                             /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk       (1UL << CoreDebug_DEMCR_MON_STEP_Pos)          /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos       17                                             /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk       (1UL << CoreDebug_DEMCR_MON_PEND_Pos)          /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos         16                                             /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk         (1UL << CoreDebug_DEMCR_MON_EN_Pos)            /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos     10                                             /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk     (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos)        /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos       9                                             /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk      (1UL << CoreDebug_DEMCR_VC_INTERR_Pos)         /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos       8                                             /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk      (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos)         /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos      7                                             /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk     (1UL << CoreDebug_DEMCR_VC_STATERR_Pos)        /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos       6                                             /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk      (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos)         /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos      5                                             /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk     (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos)        /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos        4                                             /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk       (1UL << CoreDebug_DEMCR_VC_MMERR_Pos)          /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos    0                                             /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk   (1UL << CoreDebug_DEMCR_VC_CORERESET_Pos)      /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_core_base     Core Definitions
+    \brief      Definitions for base addresses, unions, and structures.
+  @{
+ */
+
+/* Memory mapping of Cortex-M4 Hardware */
+#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address  */
+#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address                   */
+#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address                   */
+#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address                   */
+#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address            */
+#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address               */
+#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address                  */
+#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address  */
+
+#define SCnSCB              ((SCnSCB_Type    *)     SCS_BASE      )   /*!< System control Register not in SCB */
+#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct           */
+#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct       */
+#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct          */
+#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct           */
+#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct           */
+#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct           */
+#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct    */
+
+#if (__MPU_PRESENT == 1)
+  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit             */
+  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit             */
+#endif
+
+#if (__FPU_PRESENT == 1)
+  #define FPU_BASE          (SCS_BASE +  0x0F30UL)                    /*!< Floating Point Unit                */
+  #define FPU               ((FPU_Type       *)     FPU_BASE      )   /*!< Floating Point Unit                */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ *                Hardware Abstraction Layer
+  Core Function Interface contains:
+  - Core NVIC Functions
+  - Core SysTick Functions
+  - Core Debug Functions
+  - Core Register Access Functions
+ ******************************************************************************/
+/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ##########################   NVIC functions  #################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+    \brief      Functions that manage interrupts and exceptions via the NVIC.
+    @{
+ */
+
+/** \brief  Set Priority Grouping
+
+  The function sets the priority grouping field using the required unlock sequence.
+  The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+  Only values from 0..7 are used.
+  In case of a conflict between priority grouping and available
+  priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+
+    \param [in]      PriorityGroup  Priority grouping field.
+ */
+__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+  uint32_t reg_value;
+  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07);               /* only values 0..7 are used          */
+
+  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
+  reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk);             /* clear bits to change               */
+  reg_value  =  (reg_value                                 |
+                ((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) |
+                (PriorityGroupTmp << 8));                                     /* Insert write key and priorty group */
+  SCB->AIRCR =  reg_value;
+}
+
+
+/** \brief  Get Priority Grouping
+
+  The function reads the priority grouping field from the NVIC Interrupt Controller.
+
+    \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
+{
+  return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos);   /* read priority grouping field */
+}
+
+
+/** \brief  Enable External Interrupt
+
+    The function enables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+/*  NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F));  enable interrupt */
+  NVIC->ISER[(uint32_t)((int32_t)IRQn) >> 5] = (uint32_t)(1 << ((uint32_t)((int32_t)IRQn) & (uint32_t)0x1F)); /* enable interrupt */
+}
+
+
+/** \brief  Disable External Interrupt
+
+    The function disables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */
+}
+
+
+/** \brief  Get Pending Interrupt
+
+    The function reads the pending register in the NVIC and returns the pending bit
+    for the specified interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not pending.
+    \return             1  Interrupt status is pending.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+  return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */
+}
+
+
+/** \brief  Set Pending Interrupt
+
+    The function sets the pending bit of an external interrupt.
+
+    \param [in]      IRQn  Interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */
+}
+
+
+/** \brief  Clear Pending Interrupt
+
+    The function clears the pending bit of an external interrupt.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
+}
+
+
+/** \brief  Get Active Interrupt
+
+    The function reads the active register in NVIC and returns the active bit.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not active.
+    \return             1  Interrupt status is active.
+ */
+__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
+{
+  return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */
+}
+
+
+/** \brief  Set Interrupt Priority
+
+    The function sets the priority of an interrupt.
+
+    \note The priority cannot be set for every core interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+    \param [in]  priority  Priority to set.
+ */
+__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+  if(IRQn < 0) {
+    SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M  System Interrupts */
+  else {
+    NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff);    }        /* set Priority for device specific Interrupts  */
+}
+
+
+/** \brief  Get Interrupt Priority
+
+    The function reads the priority of an interrupt. The interrupt
+    number can be positive to specify an external (device specific)
+    interrupt, or negative to specify an internal (core) interrupt.
+
+
+    \param [in]   IRQn  Interrupt number.
+    \return             Interrupt Priority. Value is aligned automatically to the implemented
+                        priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+  if(IRQn < 0) {
+    return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M  system interrupts */
+  else {
+    return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)]           >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts  */
+}
+
+
+/** \brief  Encode Priority
+
+    The function encodes the priority for an interrupt with the given priority group,
+    preemptive priority value, and subpriority value.
+    In case of a conflict between priority grouping and available
+    priority bits (__NVIC_PRIO_BITS), the samllest possible priority group is set.
+
+    \param [in]     PriorityGroup  Used priority group.
+    \param [in]   PreemptPriority  Preemptive priority value (starting from 0).
+    \param [in]       SubPriority  Subpriority value (starting from 0).
+    \return                        Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+  uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);          /* only values 0..7 are used          */
+  uint32_t PreemptPriorityBits;
+  uint32_t SubPriorityBits;
+
+  PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
+  SubPriorityBits     = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
+
+  return (
+           ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |
+           ((SubPriority     & ((1 << (SubPriorityBits    )) - 1)))
+         );
+}
+
+
+/** \brief  Decode Priority
+
+    The function decodes an interrupt priority value with a given priority group to
+    preemptive priority value and subpriority value.
+    In case of a conflict between priority grouping and available
+    priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
+
+    \param [in]         Priority   Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+    \param [in]     PriorityGroup  Used priority group.
+    \param [out] pPreemptPriority  Preemptive priority value (starting from 0).
+    \param [out]     pSubPriority  Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
+{
+  uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);          /* only values 0..7 are used          */
+  uint32_t PreemptPriorityBits;
+  uint32_t SubPriorityBits;
+
+  PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
+  SubPriorityBits     = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
+
+  *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);
+  *pSubPriority     = (Priority                   ) & ((1 << (SubPriorityBits    )) - 1);
+}
+
+
+/** \brief  System Reset
+
+    The function initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void NVIC_SystemReset(void)
+{
+  __DSB();                                                     /* Ensure all outstanding memory accesses included
+                                                                  buffered write are completed before reset */
+  SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
+                 (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+                 SCB_AIRCR_SYSRESETREQ_Msk);                   /* Keep priority group unchanged */
+  __DSB();                                                     /* Ensure completion of memory access */
+  while(1);                                                    /* wait until reset */
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+
+/* ##################################    SysTick function  ############################################ */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+    \brief      Functions that configure the System.
+  @{
+ */
+
+#if (__Vendor_SysTickConfig == 0)
+
+/** \brief  System Tick Configuration
+
+    The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
+    Counter is in free running mode to generate periodic interrupts.
+
+    \param [in]  ticks  Number of ticks between two interrupts.
+
+    \return          0  Function succeeded.
+    \return          1  Function failed.
+
+    \note     When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+    function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+    must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+  if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)  return (1);      /* Reload value impossible */
+
+  SysTick->LOAD  = ticks - 1;                                  /* set reload register */
+  NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);  /* set Priority for Systick Interrupt */
+  SysTick->VAL   = 0;                                          /* Load the SysTick Counter Value */
+  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
+                   SysTick_CTRL_TICKINT_Msk   |
+                   SysTick_CTRL_ENABLE_Msk;                    /* Enable SysTick IRQ and SysTick Timer */
+  return (0);                                                  /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_core_DebugFunctions ITM Functions
+    \brief   Functions that access the ITM debug interface.
+  @{
+ */
+
+extern volatile int32_t ITM_RxBuffer;                    /*!< External variable to receive characters.                         */
+#define                 ITM_RXBUFFER_EMPTY    0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/** \brief  ITM Send Character
+
+    The function transmits a character via the ITM channel 0, and
+    \li Just returns when no debugger is connected that has booked the output.
+    \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+
+    \param [in]     ch  Character to transmit.
+
+    \returns            Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+  if ((ITM->TCR & ITM_TCR_ITMENA_Msk)                  &&      /* ITM enabled */
+      (ITM->TER & (1UL << 0)        )                    )     /* ITM Port #0 enabled */
+  {
+    while (ITM->PORT[0].u32 == 0);
+    ITM->PORT[0].u8 = (uint8_t) ch;
+  }
+  return (ch);
+}
+
+
+/** \brief  ITM Receive Character
+
+    The function inputs a character via the external variable \ref ITM_RxBuffer.
+
+    \return             Received character.
+    \return         -1  No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void) {
+  int32_t ch = -1;                           /* no character available */
+
+  if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
+    ch = ITM_RxBuffer;
+    ITM_RxBuffer = ITM_RXBUFFER_EMPTY;       /* ready for next character */
+  }
+
+  return (ch);
+}
+
+
+/** \brief  ITM Check Character
+
+    The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+
+    \return          0  No character available.
+    \return          1  Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void) {
+
+  if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
+    return (0);                                 /* no character available */
+  } else {
+    return (1);                                 /*    character available */
+  }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+#endif /* __CORE_CM4_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
+
+#ifdef __cplusplus
+}
+#endif

+ 673 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_cm4_simd.h

@@ -0,0 +1,673 @@
+/**************************************************************************//**
+ * @file     core_cm4_simd.h
+ * @brief    CMSIS Cortex-M4 SIMD Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifndef __CORE_CM4_SIMD_H
+#define __CORE_CM4_SIMD_H
+
+
+/*******************************************************************************
+ *                Hardware Abstraction Layer
+ ******************************************************************************/
+
+
+/* ###################  Compiler specific Intrinsics  ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+  Access to dedicated SIMD instructions
+  @{
+*/
+
+#if   defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
+/* ARM armcc specific functions */
+
+/*------ CM4 SIMD Intrinsics -----------------------------------------------------*/
+#define __SADD8                           __sadd8
+#define __QADD8                           __qadd8
+#define __SHADD8                          __shadd8
+#define __UADD8                           __uadd8
+#define __UQADD8                          __uqadd8
+#define __UHADD8                          __uhadd8
+#define __SSUB8                           __ssub8
+#define __QSUB8                           __qsub8
+#define __SHSUB8                          __shsub8
+#define __USUB8                           __usub8
+#define __UQSUB8                          __uqsub8
+#define __UHSUB8                          __uhsub8
+#define __SADD16                          __sadd16
+#define __QADD16                          __qadd16
+#define __SHADD16                         __shadd16
+#define __UADD16                          __uadd16
+#define __UQADD16                         __uqadd16
+#define __UHADD16                         __uhadd16
+#define __SSUB16                          __ssub16
+#define __QSUB16                          __qsub16
+#define __SHSUB16                         __shsub16
+#define __USUB16                          __usub16
+#define __UQSUB16                         __uqsub16
+#define __UHSUB16                         __uhsub16
+#define __SASX                            __sasx
+#define __QASX                            __qasx
+#define __SHASX                           __shasx
+#define __UASX                            __uasx
+#define __UQASX                           __uqasx
+#define __UHASX                           __uhasx
+#define __SSAX                            __ssax
+#define __QSAX                            __qsax
+#define __SHSAX                           __shsax
+#define __USAX                            __usax
+#define __UQSAX                           __uqsax
+#define __UHSAX                           __uhsax
+#define __USAD8                           __usad8
+#define __USADA8                          __usada8
+#define __SSAT16                          __ssat16
+#define __USAT16                          __usat16
+#define __UXTB16                          __uxtb16
+#define __UXTAB16                         __uxtab16
+#define __SXTB16                          __sxtb16
+#define __SXTAB16                         __sxtab16
+#define __SMUAD                           __smuad
+#define __SMUADX                          __smuadx
+#define __SMLAD                           __smlad
+#define __SMLADX                          __smladx
+#define __SMLALD                          __smlald
+#define __SMLALDX                         __smlaldx
+#define __SMUSD                           __smusd
+#define __SMUSDX                          __smusdx
+#define __SMLSD                           __smlsd
+#define __SMLSDX                          __smlsdx
+#define __SMLSLD                          __smlsld
+#define __SMLSLDX                         __smlsldx
+#define __SEL                             __sel
+#define __QADD                            __qadd
+#define __QSUB                            __qsub
+
+#define __PKHBT(ARG1,ARG2,ARG3)          ( ((((uint32_t)(ARG1))          ) & 0x0000FFFFUL) |  \
+                                           ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL)  )
+
+#define __PKHTB(ARG1,ARG2,ARG3)          ( ((((uint32_t)(ARG1))          ) & 0xFFFF0000UL) |  \
+                                           ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL)  )
+
+#define __SMMLA(ARG1,ARG2,ARG3)          ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
+                                                      ((int64_t)(ARG3) << 32)      ) >> 32))
+
+/*-- End CM4 SIMD Intrinsics -----------------------------------------------------*/
+
+
+
+#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
+/* IAR iccarm specific functions */
+
+/*------ CM4 SIMD Intrinsics -----------------------------------------------------*/
+#include <cmsis_iar.h>
+
+/*-- End CM4 SIMD Intrinsics -----------------------------------------------------*/
+
+
+
+#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
+/* TI CCS specific functions */
+
+/*------ CM4 SIMD Intrinsics -----------------------------------------------------*/
+#include <cmsis_ccs.h>
+
+/*-- End CM4 SIMD Intrinsics -----------------------------------------------------*/
+
+
+
+#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
+/* GNU gcc specific functions */
+
+/*------ CM4 SIMD Intrinsics -----------------------------------------------------*/
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
+{
+  uint32_t result;
+
+  __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+  return(result);
+}
+
+#define __SSAT16(ARG1,ARG2) \
+({                          \
+  uint32_t __RES, __ARG1 = (ARG1); \
+  __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \
+  __RES; \
+ })
+
+#define __USAT16(ARG1,ARG2) \
+({                          \
+  uint32_t __RES, __ARG1 = (ARG1); \
+  __ASM ("usat16 %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \
+  __RES; \
+ })
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1)
+{
+  uint32_t result;
+
+  __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1)
+{
+  uint32_t result;
+
+  __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUAD  (uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+  uint32_t result;
+
+  __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+  uint32_t result;
+
+  __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+  return(result);
+}
+
+#define __SMLALD(ARG1,ARG2,ARG3) \
+({ \
+  uint32_t __ARG1 = (ARG1), __ARG2 = (ARG2), __ARG3_H = (uint32_t)((uint64_t)(ARG3) >> 32), __ARG3_L = (uint32_t)((uint64_t)(ARG3) & 0xFFFFFFFFUL); \
+  __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (__ARG3_L), "=r" (__ARG3_H) : "r" (__ARG1), "r" (__ARG2), "0" (__ARG3_L), "1" (__ARG3_H) ); \
+  (uint64_t)(((uint64_t)__ARG3_H << 32) | __ARG3_L); \
+ })
+
+#define __SMLALDX(ARG1,ARG2,ARG3) \
+({ \
+  uint32_t __ARG1 = (ARG1), __ARG2 = (ARG2), __ARG3_H = (uint32_t)((uint64_t)(ARG3) >> 32), __ARG3_L = (uint32_t)((uint64_t)(ARG3) & 0xFFFFFFFFUL); \
+  __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (__ARG3_L), "=r" (__ARG3_H) : "r" (__ARG1), "r" (__ARG2), "0" (__ARG3_L), "1" (__ARG3_H) ); \
+  (uint64_t)(((uint64_t)__ARG3_H << 32) | __ARG3_L); \
+ })
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSD  (uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+  uint32_t result;
+
+  __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+  uint32_t result;
+
+  __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+  return(result);
+}
+
+#define __SMLSLD(ARG1,ARG2,ARG3) \
+({ \
+  uint32_t __ARG1 = (ARG1), __ARG2 = (ARG2), __ARG3_H = (uint32_t)((ARG3) >> 32), __ARG3_L = (uint32_t)((ARG3) & 0xFFFFFFFFUL); \
+  __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (__ARG3_L), "=r" (__ARG3_H) : "r" (__ARG1), "r" (__ARG2), "0" (__ARG3_L), "1" (__ARG3_H) ); \
+  (uint64_t)(((uint64_t)__ARG3_H << 32) | __ARG3_L); \
+ })
+
+#define __SMLSLDX(ARG1,ARG2,ARG3) \
+({ \
+  uint32_t __ARG1 = (ARG1), __ARG2 = (ARG2), __ARG3_H = (uint32_t)((ARG3) >> 32), __ARG3_L = (uint32_t)((ARG3) & 0xFFFFFFFFUL); \
+  __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (__ARG3_L), "=r" (__ARG3_H) : "r" (__ARG1), "r" (__ARG2), "0" (__ARG3_L), "1" (__ARG3_H) ); \
+  (uint64_t)(((uint64_t)__ARG3_H << 32) | __ARG3_L); \
+ })
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SEL  (uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB(uint32_t op1, uint32_t op2)
+{
+  uint32_t result;
+
+  __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+  return(result);
+}
+
+#define __PKHBT(ARG1,ARG2,ARG3) \
+({                          \
+  uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+  __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) :  "r" (__ARG1), "r" (__ARG2), "I" (ARG3)  ); \
+  __RES; \
+ })
+
+#define __PKHTB(ARG1,ARG2,ARG3) \
+({                          \
+  uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+  if (ARG3 == 0) \
+    __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) :  "r" (__ARG1), "r" (__ARG2)  ); \
+  else \
+    __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) :  "r" (__ARG1), "r" (__ARG2), "I" (ARG3)  ); \
+  __RES; \
+ })
+
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
+{
+ int32_t result;
+
+ __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r"  (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+/*-- End CM4 SIMD Intrinsics -----------------------------------------------------*/
+
+
+
+#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
+/* TASKING carm specific functions */
+
+
+/*------ CM4 SIMD Intrinsics -----------------------------------------------------*/
+/* not yet supported */
+/*-- End CM4 SIMD Intrinsics -----------------------------------------------------*/
+
+
+#endif
+
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#endif /* __CORE_CM4_SIMD_H */
+
+#ifdef __cplusplus
+}
+#endif

+ 636 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_cmFunc.h

@@ -0,0 +1,636 @@
+/**************************************************************************//**
+ * @file     core_cmFunc.h
+ * @brief    CMSIS Cortex-M Core Function Access Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#ifndef __CORE_CMFUNC_H
+#define __CORE_CMFUNC_H
+
+
+/* ###########################  Core Function Access  ########################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+  @{
+ */
+
+#if   defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
+/* ARM armcc specific functions */
+
+#if (__ARMCC_VERSION < 400677)
+  #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
+#endif
+
+/* intrinsic void __enable_irq();     */
+/* intrinsic void __disable_irq();    */
+
+/** \brief  Get Control Register
+
+    This function returns the content of the Control Register.
+
+    \return               Control Register value
+ */
+__STATIC_INLINE uint32_t __get_CONTROL(void)
+{
+  register uint32_t __regControl         __ASM("control");
+  return(__regControl);
+}
+
+
+/** \brief  Set Control Register
+
+    This function writes the given value to the Control Register.
+
+    \param [in]    control  Control Register value to set
+ */
+__STATIC_INLINE void __set_CONTROL(uint32_t control)
+{
+  register uint32_t __regControl         __ASM("control");
+  __regControl = control;
+}
+
+
+/** \brief  Get IPSR Register
+
+    This function returns the content of the IPSR Register.
+
+    \return               IPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_IPSR(void)
+{
+  register uint32_t __regIPSR          __ASM("ipsr");
+  return(__regIPSR);
+}
+
+
+/** \brief  Get APSR Register
+
+    This function returns the content of the APSR Register.
+
+    \return               APSR Register value
+ */
+__STATIC_INLINE uint32_t __get_APSR(void)
+{
+  register uint32_t __regAPSR          __ASM("apsr");
+  return(__regAPSR);
+}
+
+
+/** \brief  Get xPSR Register
+
+    This function returns the content of the xPSR Register.
+
+    \return               xPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_xPSR(void)
+{
+  register uint32_t __regXPSR          __ASM("xpsr");
+  return(__regXPSR);
+}
+
+
+/** \brief  Get Process Stack Pointer
+
+    This function returns the current value of the Process Stack Pointer (PSP).
+
+    \return               PSP Register value
+ */
+__STATIC_INLINE uint32_t __get_PSP(void)
+{
+  register uint32_t __regProcessStackPointer  __ASM("psp");
+  return(__regProcessStackPointer);
+}
+
+
+/** \brief  Set Process Stack Pointer
+
+    This function assigns the given value to the Process Stack Pointer (PSP).
+
+    \param [in]    topOfProcStack  Process Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
+{
+  register uint32_t __regProcessStackPointer  __ASM("psp");
+  __regProcessStackPointer = topOfProcStack;
+}
+
+
+/** \brief  Get Main Stack Pointer
+
+    This function returns the current value of the Main Stack Pointer (MSP).
+
+    \return               MSP Register value
+ */
+__STATIC_INLINE uint32_t __get_MSP(void)
+{
+  register uint32_t __regMainStackPointer     __ASM("msp");
+  return(__regMainStackPointer);
+}
+
+
+/** \brief  Set Main Stack Pointer
+
+    This function assigns the given value to the Main Stack Pointer (MSP).
+
+    \param [in]    topOfMainStack  Main Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
+{
+  register uint32_t __regMainStackPointer     __ASM("msp");
+  __regMainStackPointer = topOfMainStack;
+}
+
+
+/** \brief  Get Priority Mask
+
+    This function returns the current state of the priority mask bit from the Priority Mask Register.
+
+    \return               Priority Mask value
+ */
+__STATIC_INLINE uint32_t __get_PRIMASK(void)
+{
+  register uint32_t __regPriMask         __ASM("primask");
+  return(__regPriMask);
+}
+
+
+/** \brief  Set Priority Mask
+
+    This function assigns the given value to the Priority Mask Register.
+
+    \param [in]    priMask  Priority Mask
+ */
+__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
+{
+  register uint32_t __regPriMask         __ASM("primask");
+  __regPriMask = (priMask);
+}
+
+
+#if       (__CORTEX_M >= 0x03)
+
+/** \brief  Enable FIQ
+
+    This function enables FIQ interrupts by clearing the F-bit in the CPSR.
+    Can only be executed in Privileged modes.
+ */
+#define __enable_fault_irq                __enable_fiq
+
+
+/** \brief  Disable FIQ
+
+    This function disables FIQ interrupts by setting the F-bit in the CPSR.
+    Can only be executed in Privileged modes.
+ */
+#define __disable_fault_irq               __disable_fiq
+
+
+/** \brief  Get Base Priority
+
+    This function returns the current value of the Base Priority register.
+
+    \return               Base Priority register value
+ */
+__STATIC_INLINE uint32_t  __get_BASEPRI(void)
+{
+  register uint32_t __regBasePri         __ASM("basepri");
+  return(__regBasePri);
+}
+
+
+/** \brief  Set Base Priority
+
+    This function assigns the given value to the Base Priority register.
+
+    \param [in]    basePri  Base Priority value to set
+ */
+__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
+{
+  register uint32_t __regBasePri         __ASM("basepri");
+  __regBasePri = (basePri & 0xff);
+}
+
+
+/** \brief  Get Fault Mask
+
+    This function returns the current value of the Fault Mask register.
+
+    \return               Fault Mask register value
+ */
+__STATIC_INLINE uint32_t __get_FAULTMASK(void)
+{
+  register uint32_t __regFaultMask       __ASM("faultmask");
+  return(__regFaultMask);
+}
+
+
+/** \brief  Set Fault Mask
+
+    This function assigns the given value to the Fault Mask register.
+
+    \param [in]    faultMask  Fault Mask value to set
+ */
+__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+  register uint32_t __regFaultMask       __ASM("faultmask");
+  __regFaultMask = (faultMask & (uint32_t)1);
+}
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+#if       (__CORTEX_M == 0x04)
+
+/** \brief  Get FPSCR
+
+    This function returns the current value of the Floating Point Status/Control register.
+
+    \return               Floating Point Status/Control register value
+ */
+__STATIC_INLINE uint32_t __get_FPSCR(void)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+  register uint32_t __regfpscr         __ASM("fpscr");
+  return(__regfpscr);
+#else
+   return(0);
+#endif
+}
+
+
+/** \brief  Set FPSCR
+
+    This function assigns the given value to the Floating Point Status/Control register.
+
+    \param [in]    fpscr  Floating Point Status/Control value to set
+ */
+__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+  register uint32_t __regfpscr         __ASM("fpscr");
+  __regfpscr = (fpscr);
+#endif
+}
+
+#endif /* (__CORTEX_M == 0x04) */
+
+
+#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
+/* IAR iccarm specific functions */
+
+#include <cmsis_iar.h>
+
+
+#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
+/* TI CCS specific functions */
+
+#include <cmsis_ccs.h>
+
+
+#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
+/* GNU gcc specific functions */
+
+/** \brief  Enable IRQ Interrupts
+
+  This function enables IRQ interrupts by clearing the I-bit in the CPSR.
+  Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void)
+{
+  __ASM volatile ("cpsie i" : : : "memory");
+}
+
+
+/** \brief  Disable IRQ Interrupts
+
+  This function disables IRQ interrupts by setting the I-bit in the CPSR.
+  Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)
+{
+  __ASM volatile ("cpsid i" : : : "memory");
+}
+
+
+/** \brief  Get Control Register
+
+    This function returns the content of the Control Register.
+
+    \return               Control Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void)
+{
+  uint32_t result;
+
+  __ASM volatile ("MRS %0, control" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Set Control Register
+
+    This function writes the given value to the Control Register.
+
+    \param [in]    control  Control Register value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control)
+{
+  __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
+}
+
+
+/** \brief  Get IPSR Register
+
+    This function returns the content of the IPSR Register.
+
+    \return               IPSR Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void)
+{
+  uint32_t result;
+
+  __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Get APSR Register
+
+    This function returns the content of the APSR Register.
+
+    \return               APSR Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void)
+{
+  uint32_t result;
+
+  __ASM volatile ("MRS %0, apsr" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Get xPSR Register
+
+    This function returns the content of the xPSR Register.
+
+    \return               xPSR Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void)
+{
+  uint32_t result;
+
+  __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Get Process Stack Pointer
+
+    This function returns the current value of the Process Stack Pointer (PSP).
+
+    \return               PSP Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void)
+{
+  register uint32_t result;
+
+  __ASM volatile ("MRS %0, psp\n"  : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Set Process Stack Pointer
+
+    This function assigns the given value to the Process Stack Pointer (PSP).
+
+    \param [in]    topOfProcStack  Process Stack Pointer value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
+{
+  __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
+}
+
+
+/** \brief  Get Main Stack Pointer
+
+    This function returns the current value of the Main Stack Pointer (MSP).
+
+    \return               MSP Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void)
+{
+  register uint32_t result;
+
+  __ASM volatile ("MRS %0, msp\n" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Set Main Stack Pointer
+
+    This function assigns the given value to the Main Stack Pointer (MSP).
+
+    \param [in]    topOfMainStack  Main Stack Pointer value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
+{
+  __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
+}
+
+
+/** \brief  Get Priority Mask
+
+    This function returns the current state of the priority mask bit from the Priority Mask Register.
+
+    \return               Priority Mask value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void)
+{
+  uint32_t result;
+
+  __ASM volatile ("MRS %0, primask" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Set Priority Mask
+
+    This function assigns the given value to the Priority Mask Register.
+
+    \param [in]    priMask  Priority Mask
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
+{
+  __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
+}
+
+
+#if       (__CORTEX_M >= 0x03)
+
+/** \brief  Enable FIQ
+
+    This function enables FIQ interrupts by clearing the F-bit in the CPSR.
+    Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void)
+{
+  __ASM volatile ("cpsie f" : : : "memory");
+}
+
+
+/** \brief  Disable FIQ
+
+    This function disables FIQ interrupts by setting the F-bit in the CPSR.
+    Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void)
+{
+  __ASM volatile ("cpsid f" : : : "memory");
+}
+
+
+/** \brief  Get Base Priority
+
+    This function returns the current value of the Base Priority register.
+
+    \return               Base Priority register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void)
+{
+  uint32_t result;
+
+  __ASM volatile ("MRS %0, basepri_max" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Set Base Priority
+
+    This function assigns the given value to the Base Priority register.
+
+    \param [in]    basePri  Base Priority value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
+{
+  __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
+}
+
+
+/** \brief  Get Fault Mask
+
+    This function returns the current value of the Fault Mask register.
+
+    \return               Fault Mask register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
+{
+  uint32_t result;
+
+  __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
+  return(result);
+}
+
+
+/** \brief  Set Fault Mask
+
+    This function assigns the given value to the Fault Mask register.
+
+    \param [in]    faultMask  Fault Mask value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+  __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
+}
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+#if       (__CORTEX_M == 0x04)
+
+/** \brief  Get FPSCR
+
+    This function returns the current value of the Floating Point Status/Control register.
+
+    \return               Floating Point Status/Control register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+  uint32_t result;
+
+  /* Empty asm statement works as a scheduling barrier */
+  __ASM volatile ("");
+  __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
+  __ASM volatile ("");
+  return(result);
+#else
+   return(0);
+#endif
+}
+
+
+/** \brief  Set FPSCR
+
+    This function assigns the given value to the Floating Point Status/Control register.
+
+    \param [in]    fpscr  Floating Point Status/Control value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+  /* Empty asm statement works as a scheduling barrier */
+  __ASM volatile ("");
+  __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
+  __ASM volatile ("");
+#endif
+}
+
+#endif /* (__CORTEX_M == 0x04) */
+
+
+#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
+/* TASKING carm specific functions */
+
+/*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all instrinsics,
+ * Including the CMSIS ones.
+ */
+
+#endif
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+#endif /* __CORE_CMFUNC_H */

+ 688 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_cmInstr.h

@@ -0,0 +1,688 @@
+/**************************************************************************//**
+ * @file     core_cmInstr.h
+ * @brief    CMSIS Cortex-M Core Instruction Access Header File
+ * @version  V3.20
+ * @date     05. March 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#ifndef __CORE_CMINSTR_H
+#define __CORE_CMINSTR_H
+
+
+/* ##########################  Core Instruction Access  ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+  Access to dedicated instructions
+  @{
+*/
+
+#if   defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
+/* ARM armcc specific functions */
+
+#if (__ARMCC_VERSION < 400677)
+  #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
+#endif
+
+
+/** \brief  No Operation
+
+    No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP                             __nop
+
+
+/** \brief  Wait For Interrupt
+
+    Wait For Interrupt is a hint instruction that suspends execution
+    until one of a number of events occurs.
+ */
+#define __WFI                             __wfi
+
+
+/** \brief  Wait For Event
+
+    Wait For Event is a hint instruction that permits the processor to enter
+    a low-power state until one of a number of events occurs.
+ */
+#define __WFE                             __wfe
+
+
+/** \brief  Send Event
+
+    Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV                             __sev
+
+
+/** \brief  Instruction Synchronization Barrier
+
+    Instruction Synchronization Barrier flushes the pipeline in the processor,
+    so that all instructions following the ISB are fetched from cache or
+    memory, after the instruction has been completed.
+ */
+#define __ISB()                           __isb(0xF)
+
+
+/** \brief  Data Synchronization Barrier
+
+    This function acts as a special kind of Data Memory Barrier.
+    It completes when all explicit memory accesses before this instruction complete.
+ */
+#define __DSB()                           __dsb(0xF)
+
+
+/** \brief  Data Memory Barrier
+
+    This function ensures the apparent order of the explicit memory operations before
+    and after the instruction, without ensuring their completion.
+ */
+#define __DMB()                           __dmb(0xF)
+
+
+/** \brief  Reverse byte order (32 bit)
+
+    This function reverses the byte order in integer value.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+#define __REV                             __rev
+
+
+/** \brief  Reverse byte order (16 bit)
+
+    This function reverses the byte order in two unsigned short values.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
+{
+  rev16 r0, r0
+  bx lr
+}
+#endif
+
+/** \brief  Reverse byte order in signed short value
+
+    This function reverses the byte order in a signed short value with sign extension to integer.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
+{
+  revsh r0, r0
+  bx lr
+}
+#endif
+
+
+/** \brief  Rotate Right in unsigned value (32 bit)
+
+    This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+
+    \param [in]    value  Value to rotate
+    \param [in]    value  Number of Bits to rotate
+    \return               Rotated value
+ */
+#define __ROR                             __ror
+
+
+/** \brief  Breakpoint
+
+    This function causes the processor to enter Debug state.
+    Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+
+    \param [in]    value  is ignored by the processor.
+                   If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value)                       __breakpoint(value)
+
+
+#if       (__CORTEX_M >= 0x03)
+
+/** \brief  Reverse bit order of value
+
+    This function reverses the bit order of the given value.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+#define __RBIT                            __rbit
+
+
+/** \brief  LDR Exclusive (8 bit)
+
+    This function performs a exclusive LDR command for 8 bit value.
+
+    \param [in]    ptr  Pointer to data
+    \return             value of type uint8_t at (*ptr)
+ */
+#define __LDREXB(ptr)                     ((uint8_t ) __ldrex(ptr))
+
+
+/** \brief  LDR Exclusive (16 bit)
+
+    This function performs a exclusive LDR command for 16 bit values.
+
+    \param [in]    ptr  Pointer to data
+    \return        value of type uint16_t at (*ptr)
+ */
+#define __LDREXH(ptr)                     ((uint16_t) __ldrex(ptr))
+
+
+/** \brief  LDR Exclusive (32 bit)
+
+    This function performs a exclusive LDR command for 32 bit values.
+
+    \param [in]    ptr  Pointer to data
+    \return        value of type uint32_t at (*ptr)
+ */
+#define __LDREXW(ptr)                     ((uint32_t ) __ldrex(ptr))
+
+
+/** \brief  STR Exclusive (8 bit)
+
+    This function performs a exclusive STR command for 8 bit values.
+
+    \param [in]  value  Value to store
+    \param [in]    ptr  Pointer to location
+    \return          0  Function succeeded
+    \return          1  Function failed
+ */
+#define __STREXB(value, ptr)              __strex(value, ptr)
+
+
+/** \brief  STR Exclusive (16 bit)
+
+    This function performs a exclusive STR command for 16 bit values.
+
+    \param [in]  value  Value to store
+    \param [in]    ptr  Pointer to location
+    \return          0  Function succeeded
+    \return          1  Function failed
+ */
+#define __STREXH(value, ptr)              __strex(value, ptr)
+
+
+/** \brief  STR Exclusive (32 bit)
+
+    This function performs a exclusive STR command for 32 bit values.
+
+    \param [in]  value  Value to store
+    \param [in]    ptr  Pointer to location
+    \return          0  Function succeeded
+    \return          1  Function failed
+ */
+#define __STREXW(value, ptr)              __strex(value, ptr)
+
+
+/** \brief  Remove the exclusive lock
+
+    This function removes the exclusive lock which is created by LDREX.
+
+ */
+#define __CLREX                           __clrex
+
+
+/** \brief  Signed Saturate
+
+    This function saturates a signed value.
+
+    \param [in]  value  Value to be saturated
+    \param [in]    sat  Bit position to saturate to (1..32)
+    \return             Saturated value
+ */
+#define __SSAT                            __ssat
+
+
+/** \brief  Unsigned Saturate
+
+    This function saturates an unsigned value.
+
+    \param [in]  value  Value to be saturated
+    \param [in]    sat  Bit position to saturate to (0..31)
+    \return             Saturated value
+ */
+#define __USAT                            __usat
+
+
+/** \brief  Count leading zeros
+
+    This function counts the number of leading zeros of a data value.
+
+    \param [in]  value  Value to count the leading zeros
+    \return             number of leading zeros in value
+ */
+#define __CLZ                             __clz
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+
+#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
+/* IAR iccarm specific functions */
+
+#include <cmsis_iar.h>
+
+
+#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
+/* TI CCS specific functions */
+
+#include <cmsis_ccs.h>
+
+
+#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
+/* GNU gcc specific functions */
+
+/* Define macros for porting to both thumb1 and thumb2.
+ * For thumb1, use low register (r0-r7), specified by constrant "l"
+ * Otherwise, use general registers, specified by constrant "r" */
+#if defined (__thumb__) && !defined (__thumb2__)
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
+#define __CMSIS_GCC_USE_REG(r) "l" (r)
+#else
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
+#define __CMSIS_GCC_USE_REG(r) "r" (r)
+#endif
+
+/** \brief  No Operation
+
+    No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void)
+{
+  __ASM volatile ("nop");
+}
+
+
+/** \brief  Wait For Interrupt
+
+    Wait For Interrupt is a hint instruction that suspends execution
+    until one of a number of events occurs.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void)
+{
+  __ASM volatile ("wfi");
+}
+
+
+/** \brief  Wait For Event
+
+    Wait For Event is a hint instruction that permits the processor to enter
+    a low-power state until one of a number of events occurs.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void)
+{
+  __ASM volatile ("wfe");
+}
+
+
+/** \brief  Send Event
+
+    Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void)
+{
+  __ASM volatile ("sev");
+}
+
+
+/** \brief  Instruction Synchronization Barrier
+
+    Instruction Synchronization Barrier flushes the pipeline in the processor,
+    so that all instructions following the ISB are fetched from cache or
+    memory, after the instruction has been completed.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void)
+{
+  __ASM volatile ("isb");
+}
+
+
+/** \brief  Data Synchronization Barrier
+
+    This function acts as a special kind of Data Memory Barrier.
+    It completes when all explicit memory accesses before this instruction complete.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void)
+{
+  __ASM volatile ("dsb");
+}
+
+
+/** \brief  Data Memory Barrier
+
+    This function ensures the apparent order of the explicit memory operations before
+    and after the instruction, without ensuring their completion.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void)
+{
+  __ASM volatile ("dmb");
+}
+
+
+/** \brief  Reverse byte order (32 bit)
+
+    This function reverses the byte order in integer value.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV(uint32_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+  return __builtin_bswap32(value);
+#else
+  uint32_t result;
+
+  __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+  return(result);
+#endif
+}
+
+
+/** \brief  Reverse byte order (16 bit)
+
+    This function reverses the byte order in two unsigned short values.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV16(uint32_t value)
+{
+  uint32_t result;
+
+  __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+  return(result);
+}
+
+
+/** \brief  Reverse byte order in signed short value
+
+    This function reverses the byte order in a signed short value with sign extension to integer.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+  return (short)__builtin_bswap16(value);
+#else
+  uint32_t result;
+
+  __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+  return(result);
+#endif
+}
+
+
+/** \brief  Rotate Right in unsigned value (32 bit)
+
+    This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+
+    \param [in]    value  Value to rotate
+    \param [in]    value  Number of Bits to rotate
+    \return               Rotated value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+  return (op1 >> op2) | (op1 << (32 - op2)); 
+}
+
+
+/** \brief  Breakpoint
+
+    This function causes the processor to enter Debug state.
+    Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+
+    \param [in]    value  is ignored by the processor.
+                   If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value)                       __ASM volatile ("bkpt "#value)
+
+
+#if       (__CORTEX_M >= 0x03)
+
+/** \brief  Reverse bit order of value
+
+    This function reverses the bit order of the given value.
+
+    \param [in]    value  Value to reverse
+    \return               Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
+{
+  uint32_t result;
+
+   __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
+   return(result);
+}
+
+
+/** \brief  LDR Exclusive (8 bit)
+
+    This function performs a exclusive LDR command for 8 bit value.
+
+    \param [in]    ptr  Pointer to data
+    \return             value of type uint8_t at (*ptr)
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr)
+{
+    uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+   __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+    /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+       accepted by assembler. So has to use following less efficient pattern.
+    */
+   __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+   return(result);
+}
+
+
+/** \brief  LDR Exclusive (16 bit)
+
+    This function performs a exclusive LDR command for 16 bit values.
+
+    \param [in]    ptr  Pointer to data
+    \return        value of type uint16_t at (*ptr)
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr)
+{
+    uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+   __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+    /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+       accepted by assembler. So has to use following less efficient pattern.
+    */
+   __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+   return(result);
+}
+
+
+/** \brief  LDR Exclusive (32 bit)
+
+    This function performs a exclusive LDR command for 32 bit values.
+
+    \param [in]    ptr  Pointer to data
+    \return        value of type uint32_t at (*ptr)
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr)
+{
+    uint32_t result;
+
+   __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
+   return(result);
+}
+
+
+/** \brief  STR Exclusive (8 bit)
+
+    This function performs a exclusive STR command for 8 bit values.
+
+    \param [in]  value  Value to store
+    \param [in]    ptr  Pointer to location
+    \return          0  Function succeeded
+    \return          1  Function failed
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
+{
+   uint32_t result;
+
+   __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+   return(result);
+}
+
+
+/** \brief  STR Exclusive (16 bit)
+
+    This function performs a exclusive STR command for 16 bit values.
+
+    \param [in]  value  Value to store
+    \param [in]    ptr  Pointer to location
+    \return          0  Function succeeded
+    \return          1  Function failed
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
+{
+   uint32_t result;
+
+   __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+   return(result);
+}
+
+
+/** \brief  STR Exclusive (32 bit)
+
+    This function performs a exclusive STR command for 32 bit values.
+
+    \param [in]  value  Value to store
+    \param [in]    ptr  Pointer to location
+    \return          0  Function succeeded
+    \return          1  Function failed
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
+{
+   uint32_t result;
+
+   __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+   return(result);
+}
+
+
+/** \brief  Remove the exclusive lock
+
+    This function removes the exclusive lock which is created by LDREX.
+
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void)
+{
+  __ASM volatile ("clrex" ::: "memory");
+}
+
+
+/** \brief  Signed Saturate
+
+    This function saturates a signed value.
+
+    \param [in]  value  Value to be saturated
+    \param [in]    sat  Bit position to saturate to (1..32)
+    \return             Saturated value
+ */
+#define __SSAT(ARG1,ARG2) \
+({                          \
+  uint32_t __RES, __ARG1 = (ARG1); \
+  __ASM ("ssat %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \
+  __RES; \
+ })
+
+
+/** \brief  Unsigned Saturate
+
+    This function saturates an unsigned value.
+
+    \param [in]  value  Value to be saturated
+    \param [in]    sat  Bit position to saturate to (0..31)
+    \return             Saturated value
+ */
+#define __USAT(ARG1,ARG2) \
+({                          \
+  uint32_t __RES, __ARG1 = (ARG1); \
+  __ASM ("usat %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \
+  __RES; \
+ })
+
+
+/** \brief  Count leading zeros
+
+    This function counts the number of leading zeros of a data value.
+
+    \param [in]  value  Value to count the leading zeros
+    \return             number of leading zeros in value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value)
+{
+   uint32_t result;
+
+  __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) );
+  return(result);
+}
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+
+
+#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
+/* TASKING carm specific functions */
+
+/*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all intrinsics,
+ * Including the CMSIS ones.
+ */
+
+#endif
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+#endif /* __CORE_CMINSTR_H */

+ 813 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_sc000.h

@@ -0,0 +1,813 @@
+/**************************************************************************//**
+ * @file     core_sc000.h
+ * @brief    CMSIS SC000 Core Peripheral Access Layer Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include  /* treat file as system include file for MISRA check */
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifndef __CORE_SC000_H_GENERIC
+#define __CORE_SC000_H_GENERIC
+
+/** \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
+  CMSIS violates the following MISRA-C:2004 rules:
+
+   \li Required Rule 8.5, object/function definition in header file.<br>
+     Function definitions in header files are used to allow 'inlining'.
+
+   \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+     Unions are used for effective representation of core registers.
+
+   \li Advisory Rule 19.7, Function-like macro defined.<br>
+     Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ *                 CMSIS definitions
+ ******************************************************************************/
+/** \ingroup SC000
+  @{
+ */
+
+/*  CMSIS SC000 definitions */
+#define __SC000_CMSIS_VERSION_MAIN  (0x03)                                   /*!< [31:16] CMSIS HAL main version */
+#define __SC000_CMSIS_VERSION_SUB   (0x20)                                   /*!< [15:0]  CMSIS HAL sub version  */
+#define __SC000_CMSIS_VERSION       ((__SC000_CMSIS_VERSION_MAIN << 16) | \
+                                      __SC000_CMSIS_VERSION_SUB          )   /*!< CMSIS HAL version number       */
+
+#define __CORTEX_SC                (0)                                       /*!< Cortex secure core             */
+
+
+#if   defined ( __CC_ARM )
+  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
+  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
+  #define __STATIC_INLINE  static __inline
+
+#elif defined ( __ICCARM__ )
+  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __GNUC__ )
+  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TASKING__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
+  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
+  #define __STATIC_INLINE  static inline
+
+#endif
+
+/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all
+*/
+#define __FPU_USED       0
+
+#if defined ( __CC_ARM )
+  #if defined __TARGET_FPU_VFP
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __ICCARM__ )
+  #if defined __ARMVFP__
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __GNUC__ )
+  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __TASKING__ )
+  #if defined __FPU_VFP__
+    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+#endif
+
+#include <stdint.h>                      /* standard types definitions                      */
+#include <core_cmInstr.h>                /* Core Instruction Access                         */
+#include <core_cmFunc.h>                 /* Core Function Access                            */
+
+#endif /* __CORE_SC000_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_SC000_H_DEPENDANT
+#define __CORE_SC000_H_DEPENDANT
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+  #ifndef __SC000_REV
+    #define __SC000_REV             0x0000
+    #warning "__SC000_REV not defined in device header file; using default!"
+  #endif
+
+  #ifndef __MPU_PRESENT
+    #define __MPU_PRESENT             0
+    #warning "__MPU_PRESENT not defined in device header file; using default!"
+  #endif
+
+  #ifndef __NVIC_PRIO_BITS
+    #define __NVIC_PRIO_BITS          2
+    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+  #endif
+
+  #ifndef __Vendor_SysTickConfig
+    #define __Vendor_SysTickConfig    0
+    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+  #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+    \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+    <strong>IO Type Qualifiers</strong> are used
+    \li to specify the access to peripheral variables.
+    \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
+#else
+  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
+#endif
+#define     __O     volatile             /*!< Defines 'write only' permissions                */
+#define     __IO    volatile             /*!< Defines 'read / write' permissions              */
+
+/*@} end of group SC000 */
+
+
+
+/*******************************************************************************
+ *                 Register Abstraction
+  Core Register contain:
+  - Core Register
+  - Core NVIC Register
+  - Core SCB Register
+  - Core SysTick Register
+  - Core MPU Register
+ ******************************************************************************/
+/** \defgroup CMSIS_core_register Defines and Type Definitions
+    \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_CORE  Status and Control Registers
+    \brief  Core Register type definitions.
+  @{
+ */
+
+/** \brief  Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+  struct
+  {
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:27;              /*!< bit:  0..26  Reserved                           */
+#else
+    uint32_t _reserved0:16;              /*!< bit:  0..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:7;               /*!< bit: 20..26  Reserved                           */
+#endif
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} APSR_Type;
+
+
+/** \brief  Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} IPSR_Type;
+
+
+/** \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved                           */
+#else
+    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved                           */
+#endif
+    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0)          */
+    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0)          */
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} xPSR_Type;
+
+
+/** \brief  Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t nPRIV:1;                    /*!< bit:      0  Execution privilege in Thread mode */
+    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used                   */
+    uint32_t FPCA:1;                     /*!< bit:      2  FP extension active flag           */
+    uint32_t _reserved0:29;              /*!< bit:  3..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} CONTROL_Type;
+
+/*@} end of group CMSIS_CORE */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
+    \brief      Type definitions for the NVIC Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+  __IO uint32_t ISER[1];                 /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register           */
+       uint32_t RESERVED0[31];
+  __IO uint32_t ICER[1];                 /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register          */
+       uint32_t RSERVED1[31];
+  __IO uint32_t ISPR[1];                 /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register           */
+       uint32_t RESERVED2[31];
+  __IO uint32_t ICPR[1];                 /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register         */
+       uint32_t RESERVED3[31];
+       uint32_t RESERVED4[64];
+  __IO uint32_t IP[8];                   /*!< Offset: 0x300 (R/W)  Interrupt Priority Register              */
+}  NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCB     System Control Block (SCB)
+    \brief      Type definitions for the System Control Block Registers
+  @{
+ */
+
+/** \brief  Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
+  __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
+  __IO uint32_t VTOR;                    /*!< Offset: 0x008 (R/W)  Vector Table Offset Register                          */
+  __IO uint32_t AIRCR;                   /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register      */
+  __IO uint32_t SCR;                     /*!< Offset: 0x010 (R/W)  System Control Register                               */
+  __IO uint32_t CCR;                     /*!< Offset: 0x014 (R/W)  Configuration Control Register                        */
+       uint32_t RESERVED0[1];
+  __IO uint32_t SHP[2];                  /*!< Offset: 0x01C (R/W)  System Handlers Priority Registers. [0] is RESERVED   */
+  __IO uint32_t SHCSR;                   /*!< Offset: 0x024 (R/W)  System Handler Control and State Register             */
+       uint32_t RESERVED1[154];
+  __IO uint32_t SFCR;                    /*!< Offset: 0x290 (R/W)  Security Features Register                            */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos          24                                             /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos              20                                             /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos         16                                             /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos                4                                             /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos              0                                             /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk             (0xFUL << SCB_CPUID_REVISION_Pos)              /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos            31                                             /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos             28                                             /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos             27                                             /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos             26                                             /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos             25                                             /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos            23                                             /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos            22                                             /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos           12                                             /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos             0                                             /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos)           /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos                 7                                             /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk                (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos)           /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos              16                                             /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos          16                                             /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos            15                                             /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos           2                                             /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos         1                                             /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos               4                                             /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos               2                                             /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos             1                                             /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos                9                                             /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos             3                                             /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos         15                                             /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/* SCB Security Features Register Definitions */
+#define SCB_SFCR_UNIBRTIMING_Pos            0                                             /*!< SCB SFCR: UNIBRTIMING Position */
+#define SCB_SFCR_UNIBRTIMING_Msk           (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SFCR: UNIBRTIMING Mask */
+
+#define SCB_SFCR_SECKEY_Pos                16                                             /*!< SCB SFCR: SECKEY Position */
+#define SCB_SFCR_SECKEY_Msk               (0xFFFFUL << SCB_SHCSR_SVCALLPENDED_Pos)        /*!< SCB SFCR: SECKEY Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+    \brief      Type definitions for the System Control and ID Register not in the SCB
+  @{
+ */
+
+/** \brief  Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+       uint32_t RESERVED0[2];
+  __IO uint32_t ACTLR;                   /*!< Offset: 0x008 (R/W)  Auxiliary Control Register      */
+} SCnSCB_Type;
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISMCYCINT_Pos         0                                          /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk        (1UL << SCnSCB_ACTLR_DISMCYCINT_Pos)        /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
+    \brief      Type definitions for the System Timer Registers.
+  @{
+ */
+
+/** \brief  Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
+  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
+  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
+  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk            (1UL << SysTick_CTRL_ENABLE_Pos)               /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos)        /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+#if (__MPU_PRESENT == 1)
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
+    \brief      Type definitions for the Memory Protection Unit (MPU)
+  @{
+ */
+
+/** \brief  Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+  __I  uint32_t TYPE;                    /*!< Offset: 0x000 (R/ )  MPU Type Register                              */
+  __IO uint32_t CTRL;                    /*!< Offset: 0x004 (R/W)  MPU Control Register                           */
+  __IO uint32_t RNR;                     /*!< Offset: 0x008 (R/W)  MPU Region RNRber Register                     */
+  __IO uint32_t RBAR;                    /*!< Offset: 0x00C (R/W)  MPU Region Base Address Register               */
+  __IO uint32_t RASR;                    /*!< Offset: 0x010 (R/W)  MPU Region Attribute and Size Register         */
+} MPU_Type;
+
+/* MPU Type Register */
+#define MPU_TYPE_IREGION_Pos               16                                             /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos                8                                             /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk               (0xFFUL << MPU_TYPE_DREGION_Pos)               /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos               0                                             /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk              (1UL << MPU_TYPE_SEPARATE_Pos)                 /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register */
+#define MPU_CTRL_PRIVDEFENA_Pos             2                                             /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk            (1UL << MPU_CTRL_PRIVDEFENA_Pos)               /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos               1                                             /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk              (1UL << MPU_CTRL_HFNMIENA_Pos)                 /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos                 0                                             /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk                (1UL << MPU_CTRL_ENABLE_Pos)                   /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register */
+#define MPU_RNR_REGION_Pos                  0                                             /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk                 (0xFFUL << MPU_RNR_REGION_Pos)                 /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register */
+#define MPU_RBAR_ADDR_Pos                   8                                             /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk                  (0xFFFFFFUL << MPU_RBAR_ADDR_Pos)              /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos                  4                                             /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk                 (1UL << MPU_RBAR_VALID_Pos)                    /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos                 0                                             /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk                (0xFUL << MPU_RBAR_REGION_Pos)                 /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register */
+#define MPU_RASR_ATTRS_Pos                 16                                             /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk                 (0xFFFFUL << MPU_RASR_ATTRS_Pos)               /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos                    28                                             /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk                    (1UL << MPU_RASR_XN_Pos)                       /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos                    24                                             /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk                    (0x7UL << MPU_RASR_AP_Pos)                     /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos                   19                                             /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk                   (0x7UL << MPU_RASR_TEX_Pos)                    /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos                     18                                             /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk                     (1UL << MPU_RASR_S_Pos)                        /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos                     17                                             /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk                     (1UL << MPU_RASR_C_Pos)                        /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos                     16                                             /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk                     (1UL << MPU_RASR_B_Pos)                        /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos                    8                                             /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk                   (0xFFUL << MPU_RASR_SRD_Pos)                   /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos                   1                                             /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk                  (0x1FUL << MPU_RASR_SIZE_Pos)                  /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos                 0                                             /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk                (1UL << MPU_RASR_ENABLE_Pos)                   /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
+    \brief      SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR)
+                are only accessible over DAP and not via processor. Therefore
+                they are not covered by the Cortex-M0 header file.
+  @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_core_base     Core Definitions
+    \brief      Definitions for base addresses, unions, and structures.
+  @{
+ */
+
+/* Memory mapping of SC000 Hardware */
+#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
+#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address              */
+#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address                 */
+#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address */
+
+#define SCnSCB              ((SCnSCB_Type    *)     SCS_BASE      )   /*!< System control Register not in SCB */
+#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct           */
+#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct       */
+#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct          */
+
+#if (__MPU_PRESENT == 1)
+  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit             */
+  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit             */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ *                Hardware Abstraction Layer
+  Core Function Interface contains:
+  - Core NVIC Functions
+  - Core SysTick Functions
+  - Core Register Access Functions
+ ******************************************************************************/
+/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ##########################   NVIC functions  #################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+    \brief      Functions that manage interrupts and exceptions via the NVIC.
+    @{
+ */
+
+/* Interrupt Priorities are WORD accessible only under ARMv6M                   */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn)         (  (((uint32_t)(IRQn)       )    &  0x03) * 8 )
+#define _SHP_IDX(IRQn)           ( ((((uint32_t)(IRQn) & 0x0F)-8) >>    2)     )
+#define _IP_IDX(IRQn)            (   ((uint32_t)(IRQn)            >>    2)     )
+
+
+/** \brief  Enable External Interrupt
+
+    The function enables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Disable External Interrupt
+
+    The function disables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Get Pending Interrupt
+
+    The function reads the pending register in the NVIC and returns the pending bit
+    for the specified interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not pending.
+    \return             1  Interrupt status is pending.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+  return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0));
+}
+
+
+/** \brief  Set Pending Interrupt
+
+    The function sets the pending bit of an external interrupt.
+
+    \param [in]      IRQn  Interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
+}
+
+
+/** \brief  Clear Pending Interrupt
+
+    The function clears the pending bit of an external interrupt.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
+}
+
+
+/** \brief  Set Interrupt Priority
+
+    The function sets the priority of an interrupt.
+
+    \note The priority cannot be set for every core interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+    \param [in]  priority  Priority to set.
+ */
+__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+  if(IRQn < 0) {
+    SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
+        (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
+  else {
+    NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
+        (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
+}
+
+
+/** \brief  Get Interrupt Priority
+
+    The function reads the priority of an interrupt. The interrupt
+    number can be positive to specify an external (device specific)
+    interrupt, or negative to specify an internal (core) interrupt.
+
+
+    \param [in]   IRQn  Interrupt number.
+    \return             Interrupt Priority. Value is aligned automatically to the implemented
+                        priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+  if(IRQn < 0) {
+    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M0 system interrupts */
+  else {
+    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts  */
+}
+
+
+/** \brief  System Reset
+
+    The function initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void NVIC_SystemReset(void)
+{
+  __DSB();                                                     /* Ensure all outstanding memory accesses included
+                                                                  buffered write are completed before reset */
+  SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
+                 SCB_AIRCR_SYSRESETREQ_Msk);
+  __DSB();                                                     /* Ensure completion of memory access */
+  while(1);                                                    /* wait until reset */
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+
+/* ##################################    SysTick function  ############################################ */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+    \brief      Functions that configure the System.
+  @{
+ */
+
+#if (__Vendor_SysTickConfig == 0)
+
+/** \brief  System Tick Configuration
+
+    The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
+    Counter is in free running mode to generate periodic interrupts.
+
+    \param [in]  ticks  Number of ticks between two interrupts.
+
+    \return          0  Function succeeded.
+    \return          1  Function failed.
+
+    \note     When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+    function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+    must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+  if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)  return (1);      /* Reload value impossible */
+
+  SysTick->LOAD  = ticks - 1;                                  /* set reload register */
+  NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);  /* set Priority for Systick Interrupt */
+  SysTick->VAL   = 0;                                          /* Load the SysTick Counter Value */
+  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
+                   SysTick_CTRL_TICKINT_Msk   |
+                   SysTick_CTRL_ENABLE_Msk;                    /* Enable SysTick IRQ and SysTick Timer */
+  return (0);                                                  /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#endif /* __CORE_SC000_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
+
+#ifdef __cplusplus
+}
+#endif

+ 1598 - 0
bsp/CME_M7/CMSIS/CMSIS/Include/core_sc300.h

@@ -0,0 +1,1598 @@
+/**************************************************************************//**
+ * @file     core_sc300.h
+ * @brief    CMSIS SC300 Core Peripheral Access Layer Header File
+ * @version  V3.20
+ * @date     25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+   All rights reserved.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+   - Neither the name of ARM nor the names of its contributors may be used
+     to endorse or promote products derived from this software without
+     specific prior written permission.
+   *
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+   ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include  /* treat file as system include file for MISRA check */
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifndef __CORE_SC300_H_GENERIC
+#define __CORE_SC300_H_GENERIC
+
+/** \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
+  CMSIS violates the following MISRA-C:2004 rules:
+
+   \li Required Rule 8.5, object/function definition in header file.<br>
+     Function definitions in header files are used to allow 'inlining'.
+
+   \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+     Unions are used for effective representation of core registers.
+
+   \li Advisory Rule 19.7, Function-like macro defined.<br>
+     Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ *                 CMSIS definitions
+ ******************************************************************************/
+/** \ingroup SC3000
+  @{
+ */
+
+/*  CMSIS SC300 definitions */
+#define __SC300_CMSIS_VERSION_MAIN  (0x03)                                   /*!< [31:16] CMSIS HAL main version */
+#define __SC300_CMSIS_VERSION_SUB   (0x20)                                   /*!< [15:0]  CMSIS HAL sub version  */
+#define __SC300_CMSIS_VERSION       ((__SC300_CMSIS_VERSION_MAIN << 16) | \
+                                      __SC300_CMSIS_VERSION_SUB          )   /*!< CMSIS HAL version number       */
+
+#define __CORTEX_SC                (300)                                     /*!< Cortex secure core             */
+
+
+#if   defined ( __CC_ARM )
+  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
+  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
+  #define __STATIC_INLINE  static __inline
+
+#elif defined ( __ICCARM__ )
+  #define __ASM           __asm                                       /*!< asm keyword for IAR Compiler          */
+  #define __INLINE        inline                                      /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __GNUC__ )
+  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
+  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
+  #define __STATIC_INLINE  static inline
+
+#elif defined ( __TASKING__ )
+  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
+  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
+  #define __STATIC_INLINE  static inline
+
+#endif
+
+/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all
+*/
+#define __FPU_USED       0
+
+#if defined ( __CC_ARM )
+  #if defined __TARGET_FPU_VFP
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __ICCARM__ )
+  #if defined __ARMVFP__
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __GNUC__ )
+  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+
+#elif defined ( __TASKING__ )
+  #if defined __FPU_VFP__
+    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+  #endif
+#endif
+
+#include <stdint.h>                      /* standard types definitions                      */
+#include <core_cmInstr.h>                /* Core Instruction Access                         */
+#include <core_cmFunc.h>                 /* Core Function Access                            */
+
+#endif /* __CORE_SC300_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_SC300_H_DEPENDANT
+#define __CORE_SC300_H_DEPENDANT
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+  #ifndef __SC300_REV
+    #define __SC300_REV               0x0000
+    #warning "__SC300_REV not defined in device header file; using default!"
+  #endif
+
+  #ifndef __MPU_PRESENT
+    #define __MPU_PRESENT             0
+    #warning "__MPU_PRESENT not defined in device header file; using default!"
+  #endif
+
+  #ifndef __NVIC_PRIO_BITS
+    #define __NVIC_PRIO_BITS          4
+    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+  #endif
+
+  #ifndef __Vendor_SysTickConfig
+    #define __Vendor_SysTickConfig    0
+    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+  #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+    \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+    <strong>IO Type Qualifiers</strong> are used
+    \li to specify the access to peripheral variables.
+    \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
+#else
+  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
+#endif
+#define     __O     volatile             /*!< Defines 'write only' permissions                */
+#define     __IO    volatile             /*!< Defines 'read / write' permissions              */
+
+/*@} end of group SC300 */
+
+
+
+/*******************************************************************************
+ *                 Register Abstraction
+  Core Register contain:
+  - Core Register
+  - Core NVIC Register
+  - Core SCB Register
+  - Core SysTick Register
+  - Core Debug Register
+  - Core MPU Register
+ ******************************************************************************/
+/** \defgroup CMSIS_core_register Defines and Type Definitions
+    \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_CORE  Status and Control Registers
+    \brief  Core Register type definitions.
+  @{
+ */
+
+/** \brief  Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+  struct
+  {
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:27;              /*!< bit:  0..26  Reserved                           */
+#else
+    uint32_t _reserved0:16;              /*!< bit:  0..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:7;               /*!< bit: 20..26  Reserved                           */
+#endif
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} APSR_Type;
+
+
+/** \brief  Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} IPSR_Type;
+
+
+/** \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
+#if (__CORTEX_M != 0x04)
+    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved                           */
+#else
+    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved                           */
+    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags        */
+    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved                           */
+#endif
+    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0)          */
+    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0)          */
+    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag          */
+    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
+    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
+    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
+    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} xPSR_Type;
+
+
+/** \brief  Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+  struct
+  {
+    uint32_t nPRIV:1;                    /*!< bit:      0  Execution privilege in Thread mode */
+    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used                   */
+    uint32_t FPCA:1;                     /*!< bit:      2  FP extension active flag           */
+    uint32_t _reserved0:29;              /*!< bit:  3..31  Reserved                           */
+  } b;                                   /*!< Structure used for bit  access                  */
+  uint32_t w;                            /*!< Type      used for word access                  */
+} CONTROL_Type;
+
+/*@} end of group CMSIS_CORE */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
+    \brief      Type definitions for the NVIC Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+  __IO uint32_t ISER[8];                 /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register           */
+       uint32_t RESERVED0[24];
+  __IO uint32_t ICER[8];                 /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register         */
+       uint32_t RSERVED1[24];
+  __IO uint32_t ISPR[8];                 /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register          */
+       uint32_t RESERVED2[24];
+  __IO uint32_t ICPR[8];                 /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register        */
+       uint32_t RESERVED3[24];
+  __IO uint32_t IABR[8];                 /*!< Offset: 0x200 (R/W)  Interrupt Active bit Register           */
+       uint32_t RESERVED4[56];
+  __IO uint8_t  IP[240];                 /*!< Offset: 0x300 (R/W)  Interrupt Priority Register (8Bit wide) */
+       uint32_t RESERVED5[644];
+  __O  uint32_t STIR;                    /*!< Offset: 0xE00 ( /W)  Software Trigger Interrupt Register     */
+}  NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos                 0                                          /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk                (0x1FFUL << NVIC_STIR_INTID_Pos)            /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCB     System Control Block (SCB)
+    \brief      Type definitions for the System Control Block Registers
+  @{
+ */
+
+/** \brief  Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
+  __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
+  __IO uint32_t VTOR;                    /*!< Offset: 0x008 (R/W)  Vector Table Offset Register                          */
+  __IO uint32_t AIRCR;                   /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register      */
+  __IO uint32_t SCR;                     /*!< Offset: 0x010 (R/W)  System Control Register                               */
+  __IO uint32_t CCR;                     /*!< Offset: 0x014 (R/W)  Configuration Control Register                        */
+  __IO uint8_t  SHP[12];                 /*!< Offset: 0x018 (R/W)  System Handlers Priority Registers (4-7, 8-11, 12-15) */
+  __IO uint32_t SHCSR;                   /*!< Offset: 0x024 (R/W)  System Handler Control and State Register             */
+  __IO uint32_t CFSR;                    /*!< Offset: 0x028 (R/W)  Configurable Fault Status Register                    */
+  __IO uint32_t HFSR;                    /*!< Offset: 0x02C (R/W)  HardFault Status Register                             */
+  __IO uint32_t DFSR;                    /*!< Offset: 0x030 (R/W)  Debug Fault Status Register                           */
+  __IO uint32_t MMFAR;                   /*!< Offset: 0x034 (R/W)  MemManage Fault Address Register                      */
+  __IO uint32_t BFAR;                    /*!< Offset: 0x038 (R/W)  BusFault Address Register                             */
+  __IO uint32_t AFSR;                    /*!< Offset: 0x03C (R/W)  Auxiliary Fault Status Register                       */
+  __I  uint32_t PFR[2];                  /*!< Offset: 0x040 (R/ )  Processor Feature Register                            */
+  __I  uint32_t DFR;                     /*!< Offset: 0x048 (R/ )  Debug Feature Register                                */
+  __I  uint32_t ADR;                     /*!< Offset: 0x04C (R/ )  Auxiliary Feature Register                            */
+  __I  uint32_t MMFR[4];                 /*!< Offset: 0x050 (R/ )  Memory Model Feature Register                         */
+  __I  uint32_t ISAR[5];                 /*!< Offset: 0x060 (R/ )  Instruction Set Attributes Register                   */
+       uint32_t RESERVED0[5];
+  __IO uint32_t CPACR;                   /*!< Offset: 0x088 (R/W)  Coprocessor Access Control Register                   */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos          24                                             /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos              20                                             /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos         16                                             /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos                4                                             /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos              0                                             /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk             (0xFUL << SCB_CPUID_REVISION_Pos)              /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos            31                                             /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos             28                                             /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos             27                                             /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos             26                                             /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos             25                                             /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos            23                                             /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos            22                                             /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos           12                                             /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos             11                                             /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk             (1UL << SCB_ICSR_RETTOBASE_Pos)                /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos             0                                             /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos)           /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLBASE_Pos               29                                             /*!< SCB VTOR: TBLBASE Position */
+#define SCB_VTOR_TBLBASE_Msk               (1UL << SCB_VTOR_TBLBASE_Pos)                  /*!< SCB VTOR: TBLBASE Mask */
+
+#define SCB_VTOR_TBLOFF_Pos                 7                                             /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk                (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos)            /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos              16                                             /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos          16                                             /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos            15                                             /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos              8                                             /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk             (7UL << SCB_AIRCR_PRIGROUP_Pos)                /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos           2                                             /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos         1                                             /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos             0                                             /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk            (1UL << SCB_AIRCR_VECTRESET_Pos)               /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos               4                                             /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos               2                                             /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos             1                                             /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos                9                                             /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos               8                                             /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk              (1UL << SCB_CCR_BFHFNMIGN_Pos)                 /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos               4                                             /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk              (1UL << SCB_CCR_DIV_0_TRP_Pos)                 /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos             3                                             /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos            1                                             /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk           (1UL << SCB_CCR_USERSETMPEND_Pos)              /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos          0                                             /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk         (1UL << SCB_CCR_NONBASETHRDENA_Pos)            /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos          18                                             /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk          (1UL << SCB_SHCSR_USGFAULTENA_Pos)             /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos          17                                             /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk          (1UL << SCB_SHCSR_BUSFAULTENA_Pos)             /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos          16                                             /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk          (1UL << SCB_SHCSR_MEMFAULTENA_Pos)             /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos         15                                             /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos       14                                             /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk       (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos)          /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos       13                                             /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk       (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos)          /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos       12                                             /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk       (1UL << SCB_SHCSR_USGFAULTPENDED_Pos)          /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos           11                                             /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk           (1UL << SCB_SHCSR_SYSTICKACT_Pos)              /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos            10                                             /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk            (1UL << SCB_SHCSR_PENDSVACT_Pos)               /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos            8                                             /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk           (1UL << SCB_SHCSR_MONITORACT_Pos)              /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos             7                                             /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk            (1UL << SCB_SHCSR_SVCALLACT_Pos)               /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos           3                                             /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk          (1UL << SCB_SHCSR_USGFAULTACT_Pos)             /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos           1                                             /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk          (1UL << SCB_SHCSR_BUSFAULTACT_Pos)             /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos           0                                             /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk          (1UL << SCB_SHCSR_MEMFAULTACT_Pos)             /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Registers Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos            16                                             /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk            (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos)          /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos             8                                             /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos             0                                             /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL << SCB_CFSR_MEMFAULTSR_Pos)            /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* SCB Hard Fault Status Registers Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos              31                                             /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos                30                                             /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk                (1UL << SCB_HFSR_FORCED_Pos)                   /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos                1                                             /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk               (1UL << SCB_HFSR_VECTTBL_Pos)                  /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos               4                                             /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk              (1UL << SCB_DFSR_EXTERNAL_Pos)                 /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos                 3                                             /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk                (1UL << SCB_DFSR_VCATCH_Pos)                   /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos                2                                             /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk               (1UL << SCB_DFSR_DWTTRAP_Pos)                  /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos                   1                                             /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk                  (1UL << SCB_DFSR_BKPT_Pos)                     /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos                 0                                             /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk                (1UL << SCB_DFSR_HALTED_Pos)                   /*!< SCB DFSR: HALTED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+    \brief      Type definitions for the System Control and ID Register not in the SCB
+  @{
+ */
+
+/** \brief  Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+       uint32_t RESERVED0[1];
+  __I  uint32_t ICTR;                    /*!< Offset: 0x004 (R/ )  Interrupt Controller Type Register      */
+       uint32_t RESERVED1[1];
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos         0                                          /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk        (0xFUL << SCnSCB_ICTR_INTLINESNUM_Pos)      /*!< ICTR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
+    \brief      Type definitions for the System Timer Registers.
+  @{
+ */
+
+/** \brief  Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
+  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
+  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
+  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk            (1UL << SysTick_CTRL_ENABLE_Pos)               /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos)        /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_ITM     Instrumentation Trace Macrocell (ITM)
+    \brief      Type definitions for the Instrumentation Trace Macrocell (ITM)
+  @{
+ */
+
+/** \brief  Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+  __O  union
+  {
+    __O  uint8_t    u8;                  /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 8-bit                   */
+    __O  uint16_t   u16;                 /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 16-bit                  */
+    __O  uint32_t   u32;                 /*!< Offset: 0x000 ( /W)  ITM Stimulus Port 32-bit                  */
+  }  PORT [32];                          /*!< Offset: 0x000 ( /W)  ITM Stimulus Port Registers               */
+       uint32_t RESERVED0[864];
+  __IO uint32_t TER;                     /*!< Offset: 0xE00 (R/W)  ITM Trace Enable Register                 */
+       uint32_t RESERVED1[15];
+  __IO uint32_t TPR;                     /*!< Offset: 0xE40 (R/W)  ITM Trace Privilege Register              */
+       uint32_t RESERVED2[15];
+  __IO uint32_t TCR;                     /*!< Offset: 0xE80 (R/W)  ITM Trace Control Register                */
+       uint32_t RESERVED3[29];
+  __O  uint32_t IWR;                     /*!< Offset: 0xEF8 ( /W)  ITM Integration Write Register            */
+  __I  uint32_t IRR;                     /*!< Offset: 0xEFC (R/ )  ITM Integration Read Register             */
+  __IO uint32_t IMCR;                    /*!< Offset: 0xF00 (R/W)  ITM Integration Mode Control Register     */
+       uint32_t RESERVED4[43];
+  __O  uint32_t LAR;                     /*!< Offset: 0xFB0 ( /W)  ITM Lock Access Register                  */
+  __I  uint32_t LSR;                     /*!< Offset: 0xFB4 (R/ )  ITM Lock Status Register                  */
+       uint32_t RESERVED5[6];
+  __I  uint32_t PID4;                    /*!< Offset: 0xFD0 (R/ )  ITM Peripheral Identification Register #4 */
+  __I  uint32_t PID5;                    /*!< Offset: 0xFD4 (R/ )  ITM Peripheral Identification Register #5 */
+  __I  uint32_t PID6;                    /*!< Offset: 0xFD8 (R/ )  ITM Peripheral Identification Register #6 */
+  __I  uint32_t PID7;                    /*!< Offset: 0xFDC (R/ )  ITM Peripheral Identification Register #7 */
+  __I  uint32_t PID0;                    /*!< Offset: 0xFE0 (R/ )  ITM Peripheral Identification Register #0 */
+  __I  uint32_t PID1;                    /*!< Offset: 0xFE4 (R/ )  ITM Peripheral Identification Register #1 */
+  __I  uint32_t PID2;                    /*!< Offset: 0xFE8 (R/ )  ITM Peripheral Identification Register #2 */
+  __I  uint32_t PID3;                    /*!< Offset: 0xFEC (R/ )  ITM Peripheral Identification Register #3 */
+  __I  uint32_t CID0;                    /*!< Offset: 0xFF0 (R/ )  ITM Component  Identification Register #0 */
+  __I  uint32_t CID1;                    /*!< Offset: 0xFF4 (R/ )  ITM Component  Identification Register #1 */
+  __I  uint32_t CID2;                    /*!< Offset: 0xFF8 (R/ )  ITM Component  Identification Register #2 */
+  __I  uint32_t CID3;                    /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos                0                                             /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk               (0xFUL << ITM_TPR_PRIVMASK_Pos)                /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos                   23                                             /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos             16                                             /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk             (0x7FUL << ITM_TCR_TraceBusID_Pos)             /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos                10                                             /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk                (3UL << ITM_TCR_GTSFREQ_Pos)                   /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos              8                                             /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk             (3UL << ITM_TCR_TSPrescale_Pos)                /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos                  4                                             /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk                 (1UL << ITM_TCR_SWOENA_Pos)                    /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos                  3                                             /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk                 (1UL << ITM_TCR_DWTENA_Pos)                    /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos                 2                                             /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk                (1UL << ITM_TCR_SYNCENA_Pos)                   /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos                   1                                             /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk                  (1UL << ITM_TCR_TSENA_Pos)                     /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos                  0                                             /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk                 (1UL << ITM_TCR_ITMENA_Pos)                    /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Integration Write Register Definitions */
+#define ITM_IWR_ATVALIDM_Pos                0                                             /*!< ITM IWR: ATVALIDM Position */
+#define ITM_IWR_ATVALIDM_Msk               (1UL << ITM_IWR_ATVALIDM_Pos)                  /*!< ITM IWR: ATVALIDM Mask */
+
+/* ITM Integration Read Register Definitions */
+#define ITM_IRR_ATREADYM_Pos                0                                             /*!< ITM IRR: ATREADYM Position */
+#define ITM_IRR_ATREADYM_Msk               (1UL << ITM_IRR_ATREADYM_Pos)                  /*!< ITM IRR: ATREADYM Mask */
+
+/* ITM Integration Mode Control Register Definitions */
+#define ITM_IMCR_INTEGRATION_Pos            0                                             /*!< ITM IMCR: INTEGRATION Position */
+#define ITM_IMCR_INTEGRATION_Msk           (1UL << ITM_IMCR_INTEGRATION_Pos)              /*!< ITM IMCR: INTEGRATION Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos                 2                                             /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk                (1UL << ITM_LSR_ByteAcc_Pos)                   /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos                  1                                             /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk                 (1UL << ITM_LSR_Access_Pos)                    /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos                 0                                             /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk                (1UL << ITM_LSR_Present_Pos)                   /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_DWT     Data Watchpoint and Trace (DWT)
+    \brief      Type definitions for the Data Watchpoint and Trace (DWT)
+  @{
+ */
+
+/** \brief  Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  Control Register                          */
+  __IO uint32_t CYCCNT;                  /*!< Offset: 0x004 (R/W)  Cycle Count Register                      */
+  __IO uint32_t CPICNT;                  /*!< Offset: 0x008 (R/W)  CPI Count Register                        */
+  __IO uint32_t EXCCNT;                  /*!< Offset: 0x00C (R/W)  Exception Overhead Count Register         */
+  __IO uint32_t SLEEPCNT;                /*!< Offset: 0x010 (R/W)  Sleep Count Register                      */
+  __IO uint32_t LSUCNT;                  /*!< Offset: 0x014 (R/W)  LSU Count Register                        */
+  __IO uint32_t FOLDCNT;                 /*!< Offset: 0x018 (R/W)  Folded-instruction Count Register         */
+  __I  uint32_t PCSR;                    /*!< Offset: 0x01C (R/ )  Program Counter Sample Register           */
+  __IO uint32_t COMP0;                   /*!< Offset: 0x020 (R/W)  Comparator Register 0                     */
+  __IO uint32_t MASK0;                   /*!< Offset: 0x024 (R/W)  Mask Register 0                           */
+  __IO uint32_t FUNCTION0;               /*!< Offset: 0x028 (R/W)  Function Register 0                       */
+       uint32_t RESERVED0[1];
+  __IO uint32_t COMP1;                   /*!< Offset: 0x030 (R/W)  Comparator Register 1                     */
+  __IO uint32_t MASK1;                   /*!< Offset: 0x034 (R/W)  Mask Register 1                           */
+  __IO uint32_t FUNCTION1;               /*!< Offset: 0x038 (R/W)  Function Register 1                       */
+       uint32_t RESERVED1[1];
+  __IO uint32_t COMP2;                   /*!< Offset: 0x040 (R/W)  Comparator Register 2                     */
+  __IO uint32_t MASK2;                   /*!< Offset: 0x044 (R/W)  Mask Register 2                           */
+  __IO uint32_t FUNCTION2;               /*!< Offset: 0x048 (R/W)  Function Register 2                       */
+       uint32_t RESERVED2[1];
+  __IO uint32_t COMP3;                   /*!< Offset: 0x050 (R/W)  Comparator Register 3                     */
+  __IO uint32_t MASK3;                   /*!< Offset: 0x054 (R/W)  Mask Register 3                           */
+  __IO uint32_t FUNCTION3;               /*!< Offset: 0x058 (R/W)  Function Register 3                       */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos               28                                          /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk               (0xFUL << DWT_CTRL_NUMCOMP_Pos)             /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos              27                                          /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk              (0x1UL << DWT_CTRL_NOTRCPKT_Pos)            /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos             26                                          /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk             (0x1UL << DWT_CTRL_NOEXTTRIG_Pos)           /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos              25                                          /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk              (0x1UL << DWT_CTRL_NOCYCCNT_Pos)            /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos              24                                          /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk              (0x1UL << DWT_CTRL_NOPRFCNT_Pos)            /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos             22                                          /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk             (0x1UL << DWT_CTRL_CYCEVTENA_Pos)           /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos            21                                          /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk            (0x1UL << DWT_CTRL_FOLDEVTENA_Pos)          /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos             20                                          /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk             (0x1UL << DWT_CTRL_LSUEVTENA_Pos)           /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos           19                                          /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk           (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos)         /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos             18                                          /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk             (0x1UL << DWT_CTRL_EXCEVTENA_Pos)           /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos             17                                          /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk             (0x1UL << DWT_CTRL_CPIEVTENA_Pos)           /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos             16                                          /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk             (0x1UL << DWT_CTRL_EXCTRCENA_Pos)           /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos            12                                          /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk            (0x1UL << DWT_CTRL_PCSAMPLENA_Pos)          /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos               10                                          /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk               (0x3UL << DWT_CTRL_SYNCTAP_Pos)             /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos                 9                                          /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk                (0x1UL << DWT_CTRL_CYCTAP_Pos)              /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos               5                                          /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk              (0xFUL << DWT_CTRL_POSTINIT_Pos)            /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos             1                                          /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk            (0xFUL << DWT_CTRL_POSTPRESET_Pos)          /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos              0                                          /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk             (0x1UL << DWT_CTRL_CYCCNTENA_Pos)           /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos               0                                          /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk              (0xFFUL << DWT_CPICNT_CPICNT_Pos)           /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos               0                                          /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk              (0xFFUL << DWT_EXCCNT_EXCCNT_Pos)           /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos           0                                          /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk          (0xFFUL << DWT_SLEEPCNT_SLEEPCNT_Pos)       /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos               0                                          /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk              (0xFFUL << DWT_LSUCNT_LSUCNT_Pos)           /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos             0                                          /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk            (0xFFUL << DWT_FOLDCNT_FOLDCNT_Pos)         /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos                   0                                          /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk                  (0x1FUL << DWT_MASK_MASK_Pos)               /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos           24                                          /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk           (0x1UL << DWT_FUNCTION_MATCHED_Pos)         /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos        16                                          /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk        (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos)      /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos        12                                          /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk        (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos)      /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos         10                                          /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk         (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos)       /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos            9                                          /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk           (0x1UL << DWT_FUNCTION_LNK1ENA_Pos)         /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos         8                                          /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk        (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos)      /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos           7                                          /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk          (0x1UL << DWT_FUNCTION_CYCMATCH_Pos)        /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos          5                                          /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk         (0x1UL << DWT_FUNCTION_EMITRANGE_Pos)       /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos           0                                          /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk          (0xFUL << DWT_FUNCTION_FUNCTION_Pos)        /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_TPI     Trace Port Interface (TPI)
+    \brief      Type definitions for the Trace Port Interface (TPI)
+  @{
+ */
+
+/** \brief  Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+  __IO uint32_t SSPSR;                   /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register     */
+  __IO uint32_t CSPSR;                   /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
+       uint32_t RESERVED0[2];
+  __IO uint32_t ACPR;                    /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
+       uint32_t RESERVED1[55];
+  __IO uint32_t SPPR;                    /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
+       uint32_t RESERVED2[131];
+  __I  uint32_t FFSR;                    /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
+  __IO uint32_t FFCR;                    /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
+  __I  uint32_t FSCR;                    /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
+       uint32_t RESERVED3[759];
+  __I  uint32_t TRIGGER;                 /*!< Offset: 0xEE8 (R/ )  TRIGGER */
+  __I  uint32_t FIFO0;                   /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
+  __I  uint32_t ITATBCTR2;               /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
+       uint32_t RESERVED4[1];
+  __I  uint32_t ITATBCTR0;               /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
+  __I  uint32_t FIFO1;                   /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
+  __IO uint32_t ITCTRL;                  /*!< Offset: 0xF00 (R/W)  Integration Mode Control */
+       uint32_t RESERVED5[39];
+  __IO uint32_t CLAIMSET;                /*!< Offset: 0xFA0 (R/W)  Claim tag set */
+  __IO uint32_t CLAIMCLR;                /*!< Offset: 0xFA4 (R/W)  Claim tag clear */
+       uint32_t RESERVED7[8];
+  __I  uint32_t DEVID;                   /*!< Offset: 0xFC8 (R/ )  TPIU_DEVID */
+  __I  uint32_t DEVTYPE;                 /*!< Offset: 0xFCC (R/ )  TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos              0                                          /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk             (0x1FFFUL << TPI_ACPR_PRESCALER_Pos)        /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos                 0                                          /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk                (0x3UL << TPI_SPPR_TXMODE_Pos)              /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos              3                                          /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk             (0x1UL << TPI_FFSR_FtNonStop_Pos)           /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos              2                                          /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk             (0x1UL << TPI_FFSR_TCPresent_Pos)           /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos              1                                          /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk             (0x1UL << TPI_FFSR_FtStopped_Pos)           /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos               0                                          /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk              (0x1UL << TPI_FFSR_FlInProg_Pos)            /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos                 8                                          /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk                (0x1UL << TPI_FFCR_TrigIn_Pos)              /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos                1                                          /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk               (0x1UL << TPI_FFCR_EnFCont_Pos)             /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos             0                                          /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk            (0x1UL << TPI_TRIGGER_TRIGGER_Pos)          /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos          29                                          /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos)        /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos        27                                          /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk        (0x3UL << TPI_FIFO0_ITM_bytecount_Pos)      /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos          26                                          /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos)        /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos        24                                          /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk        (0x3UL << TPI_FIFO0_ETM_bytecount_Pos)      /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos                 16                                          /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk                 (0xFFUL << TPI_FIFO0_ETM2_Pos)              /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos                  8                                          /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk                 (0xFFUL << TPI_FIFO0_ETM1_Pos)              /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos                  0                                          /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk                 (0xFFUL << TPI_FIFO0_ETM0_Pos)              /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos           0                                          /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk          (0x1UL << TPI_ITATBCTR2_ATREADY_Pos)        /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos          29                                          /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos        27                                          /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk        (0x3UL << TPI_FIFO1_ITM_bytecount_Pos)      /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos          26                                          /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos)        /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos        24                                          /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk        (0x3UL << TPI_FIFO1_ETM_bytecount_Pos)      /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos                 16                                          /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk                 (0xFFUL << TPI_FIFO1_ITM2_Pos)              /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos                  8                                          /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk                 (0xFFUL << TPI_FIFO1_ITM1_Pos)              /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos                  0                                          /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk                 (0xFFUL << TPI_FIFO1_ITM0_Pos)              /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos           0                                          /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk          (0x1UL << TPI_ITATBCTR0_ATREADY_Pos)        /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos                 0                                          /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk                (0x1UL << TPI_ITCTRL_Mode_Pos)              /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos             11                                          /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos            10                                          /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk            (0x1UL << TPI_DEVID_MANCVALID_Pos)          /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos             9                                          /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk            (0x1UL << TPI_DEVID_PTINVALID_Pos)          /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos              6                                          /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk             (0x7UL << TPI_DEVID_MinBufSz_Pos)           /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos             5                                          /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk            (0x1UL << TPI_DEVID_AsynClkIn_Pos)          /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos          0                                          /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL << TPI_DEVID_NrTraceInput_Pos)      /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos             0                                          /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk            (0xFUL << TPI_DEVTYPE_SubType_Pos)          /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos           4                                          /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if (__MPU_PRESENT == 1)
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
+    \brief      Type definitions for the Memory Protection Unit (MPU)
+  @{
+ */
+
+/** \brief  Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+  __I  uint32_t TYPE;                    /*!< Offset: 0x000 (R/ )  MPU Type Register                              */
+  __IO uint32_t CTRL;                    /*!< Offset: 0x004 (R/W)  MPU Control Register                           */
+  __IO uint32_t RNR;                     /*!< Offset: 0x008 (R/W)  MPU Region RNRber Register                     */
+  __IO uint32_t RBAR;                    /*!< Offset: 0x00C (R/W)  MPU Region Base Address Register               */
+  __IO uint32_t RASR;                    /*!< Offset: 0x010 (R/W)  MPU Region Attribute and Size Register         */
+  __IO uint32_t RBAR_A1;                 /*!< Offset: 0x014 (R/W)  MPU Alias 1 Region Base Address Register       */
+  __IO uint32_t RASR_A1;                 /*!< Offset: 0x018 (R/W)  MPU Alias 1 Region Attribute and Size Register */
+  __IO uint32_t RBAR_A2;                 /*!< Offset: 0x01C (R/W)  MPU Alias 2 Region Base Address Register       */
+  __IO uint32_t RASR_A2;                 /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
+  __IO uint32_t RBAR_A3;                 /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register       */
+  __IO uint32_t RASR_A3;                 /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+/* MPU Type Register */
+#define MPU_TYPE_IREGION_Pos               16                                             /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos                8                                             /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk               (0xFFUL << MPU_TYPE_DREGION_Pos)               /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos               0                                             /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk              (1UL << MPU_TYPE_SEPARATE_Pos)                 /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register */
+#define MPU_CTRL_PRIVDEFENA_Pos             2                                             /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk            (1UL << MPU_CTRL_PRIVDEFENA_Pos)               /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos               1                                             /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk              (1UL << MPU_CTRL_HFNMIENA_Pos)                 /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos                 0                                             /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk                (1UL << MPU_CTRL_ENABLE_Pos)                   /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register */
+#define MPU_RNR_REGION_Pos                  0                                             /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk                 (0xFFUL << MPU_RNR_REGION_Pos)                 /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register */
+#define MPU_RBAR_ADDR_Pos                   5                                             /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk                  (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos)             /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos                  4                                             /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk                 (1UL << MPU_RBAR_VALID_Pos)                    /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos                 0                                             /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk                (0xFUL << MPU_RBAR_REGION_Pos)                 /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register */
+#define MPU_RASR_ATTRS_Pos                 16                                             /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk                 (0xFFFFUL << MPU_RASR_ATTRS_Pos)               /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos                    28                                             /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk                    (1UL << MPU_RASR_XN_Pos)                       /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos                    24                                             /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk                    (0x7UL << MPU_RASR_AP_Pos)                     /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos                   19                                             /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk                   (0x7UL << MPU_RASR_TEX_Pos)                    /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos                     18                                             /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk                     (1UL << MPU_RASR_S_Pos)                        /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos                     17                                             /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk                     (1UL << MPU_RASR_C_Pos)                        /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos                     16                                             /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk                     (1UL << MPU_RASR_B_Pos)                        /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos                    8                                             /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk                   (0xFFUL << MPU_RASR_SRD_Pos)                   /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos                   1                                             /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk                  (0x1FUL << MPU_RASR_SIZE_Pos)                  /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos                 0                                             /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk                (1UL << MPU_RASR_ENABLE_Pos)                   /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/** \ingroup  CMSIS_core_register
+    \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
+    \brief      Type definitions for the Core Debug Registers
+  @{
+ */
+
+/** \brief  Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+  __IO uint32_t DHCSR;                   /*!< Offset: 0x000 (R/W)  Debug Halting Control and Status Register    */
+  __O  uint32_t DCRSR;                   /*!< Offset: 0x004 ( /W)  Debug Core Register Selector Register        */
+  __IO uint32_t DCRDR;                   /*!< Offset: 0x008 (R/W)  Debug Core Register Data Register            */
+  __IO uint32_t DEMCR;                   /*!< Offset: 0x00C (R/W)  Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register */
+#define CoreDebug_DHCSR_DBGKEY_Pos         16                                             /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk         (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos)       /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos     25                                             /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk     (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos)        /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos    24                                             /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk    (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos)       /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos       19                                             /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk       (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos)          /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos        18                                             /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk        (1UL << CoreDebug_DHCSR_S_SLEEP_Pos)           /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos         17                                             /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk         (1UL << CoreDebug_DHCSR_S_HALT_Pos)            /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos       16                                             /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk       (1UL << CoreDebug_DHCSR_S_REGRDY_Pos)          /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos     5                                             /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk    (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos)       /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos      3                                             /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk     (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos)        /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos          2                                             /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk         (1UL << CoreDebug_DHCSR_C_STEP_Pos)            /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos          1                                             /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk         (1UL << CoreDebug_DHCSR_C_HALT_Pos)            /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos       0                                             /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk      (1UL << CoreDebug_DHCSR_C_DEBUGEN_Pos)         /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register */
+#define CoreDebug_DCRSR_REGWnR_Pos         16                                             /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk         (1UL << CoreDebug_DCRSR_REGWnR_Pos)            /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos          0                                             /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk         (0x1FUL << CoreDebug_DCRSR_REGSEL_Pos)         /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register */
+#define CoreDebug_DEMCR_TRCENA_Pos         24                                             /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk         (1UL << CoreDebug_DEMCR_TRCENA_Pos)            /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos        19                                             /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk        (1UL << CoreDebug_DEMCR_MON_REQ_Pos)           /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos       18                                             /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk       (1UL << CoreDebug_DEMCR_MON_STEP_Pos)          /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos       17                                             /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk       (1UL << CoreDebug_DEMCR_MON_PEND_Pos)          /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos         16                                             /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk         (1UL << CoreDebug_DEMCR_MON_EN_Pos)            /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos     10                                             /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk     (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos)        /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos       9                                             /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk      (1UL << CoreDebug_DEMCR_VC_INTERR_Pos)         /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos       8                                             /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk      (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos)         /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos      7                                             /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk     (1UL << CoreDebug_DEMCR_VC_STATERR_Pos)        /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos       6                                             /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk      (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos)         /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos      5                                             /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk     (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos)        /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos        4                                             /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk       (1UL << CoreDebug_DEMCR_VC_MMERR_Pos)          /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos    0                                             /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk   (1UL << CoreDebug_DEMCR_VC_CORERESET_Pos)      /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/** \ingroup    CMSIS_core_register
+    \defgroup   CMSIS_core_base     Core Definitions
+    \brief      Definitions for base addresses, unions, and structures.
+  @{
+ */
+
+/* Memory mapping of Cortex-M3 Hardware */
+#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address  */
+#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address                   */
+#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address                   */
+#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address                   */
+#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address            */
+#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address               */
+#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address                  */
+#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address  */
+
+#define SCnSCB              ((SCnSCB_Type    *)     SCS_BASE      )   /*!< System control Register not in SCB */
+#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct           */
+#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct       */
+#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct          */
+#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct           */
+#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct           */
+#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct           */
+#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct    */
+
+#if (__MPU_PRESENT == 1)
+  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit             */
+  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit             */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ *                Hardware Abstraction Layer
+  Core Function Interface contains:
+  - Core NVIC Functions
+  - Core SysTick Functions
+  - Core Debug Functions
+  - Core Register Access Functions
+ ******************************************************************************/
+/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ##########################   NVIC functions  #################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+    \brief      Functions that manage interrupts and exceptions via the NVIC.
+    @{
+ */
+
+/** \brief  Set Priority Grouping
+
+  The function sets the priority grouping field using the required unlock sequence.
+  The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+  Only values from 0..7 are used.
+  In case of a conflict between priority grouping and available
+  priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+
+    \param [in]      PriorityGroup  Priority grouping field.
+ */
+__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+  uint32_t reg_value;
+  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07);               /* only values 0..7 are used          */
+
+  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
+  reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk);             /* clear bits to change               */
+  reg_value  =  (reg_value                                 |
+                ((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) |
+                (PriorityGroupTmp << 8));                                     /* Insert write key and priorty group */
+  SCB->AIRCR =  reg_value;
+}
+
+
+/** \brief  Get Priority Grouping
+
+  The function reads the priority grouping field from the NVIC Interrupt Controller.
+
+    \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
+{
+  return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos);   /* read priority grouping field */
+}
+
+
+/** \brief  Enable External Interrupt
+
+    The function enables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* enable interrupt */
+}
+
+
+/** \brief  Disable External Interrupt
+
+    The function disables a device-specific interrupt in the NVIC interrupt controller.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */
+}
+
+
+/** \brief  Get Pending Interrupt
+
+    The function reads the pending register in the NVIC and returns the pending bit
+    for the specified interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not pending.
+    \return             1  Interrupt status is pending.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+  return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */
+}
+
+
+/** \brief  Set Pending Interrupt
+
+    The function sets the pending bit of an external interrupt.
+
+    \param [in]      IRQn  Interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */
+}
+
+
+/** \brief  Clear Pending Interrupt
+
+    The function clears the pending bit of an external interrupt.
+
+    \param [in]      IRQn  External interrupt number. Value cannot be negative.
+ */
+__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+  NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
+}
+
+
+/** \brief  Get Active Interrupt
+
+    The function reads the active register in NVIC and returns the active bit.
+
+    \param [in]      IRQn  Interrupt number.
+
+    \return             0  Interrupt status is not active.
+    \return             1  Interrupt status is active.
+ */
+__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
+{
+  return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */
+}
+
+
+/** \brief  Set Interrupt Priority
+
+    The function sets the priority of an interrupt.
+
+    \note The priority cannot be set for every core interrupt.
+
+    \param [in]      IRQn  Interrupt number.
+    \param [in]  priority  Priority to set.
+ */
+__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+  if(IRQn < 0) {
+    SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M  System Interrupts */
+  else {
+    NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff);    }        /* set Priority for device specific Interrupts  */
+}
+
+
+/** \brief  Get Interrupt Priority
+
+    The function reads the priority of an interrupt. The interrupt
+    number can be positive to specify an external (device specific)
+    interrupt, or negative to specify an internal (core) interrupt.
+
+
+    \param [in]   IRQn  Interrupt number.
+    \return             Interrupt Priority. Value is aligned automatically to the implemented
+                        priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+  if(IRQn < 0) {
+    return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M  system interrupts */
+  else {
+    return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)]           >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts  */
+}
+
+
+/** \brief  Encode Priority
+
+    The function encodes the priority for an interrupt with the given priority group,
+    preemptive priority value, and subpriority value.
+    In case of a conflict between priority grouping and available
+    priority bits (__NVIC_PRIO_BITS), the samllest possible priority group is set.
+
+    \param [in]     PriorityGroup  Used priority group.
+    \param [in]   PreemptPriority  Preemptive priority value (starting from 0).
+    \param [in]       SubPriority  Subpriority value (starting from 0).
+    \return                        Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+  uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);          /* only values 0..7 are used          */
+  uint32_t PreemptPriorityBits;
+  uint32_t SubPriorityBits;
+
+  PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
+  SubPriorityBits     = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
+
+  return (
+           ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |
+           ((SubPriority     & ((1 << (SubPriorityBits    )) - 1)))
+         );
+}
+
+
+/** \brief  Decode Priority
+
+    The function decodes an interrupt priority value with a given priority group to
+    preemptive priority value and subpriority value.
+    In case of a conflict between priority grouping and available
+    priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
+
+    \param [in]         Priority   Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+    \param [in]     PriorityGroup  Used priority group.
+    \param [out] pPreemptPriority  Preemptive priority value (starting from 0).
+    \param [out]     pSubPriority  Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
+{
+  uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);          /* only values 0..7 are used          */
+  uint32_t PreemptPriorityBits;
+  uint32_t SubPriorityBits;
+
+  PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
+  SubPriorityBits     = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
+
+  *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);
+  *pSubPriority     = (Priority                   ) & ((1 << (SubPriorityBits    )) - 1);
+}
+
+
+/** \brief  System Reset
+
+    The function initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void NVIC_SystemReset(void)
+{
+  __DSB();                                                     /* Ensure all outstanding memory accesses included
+                                                                  buffered write are completed before reset */
+  SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
+                 (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+                 SCB_AIRCR_SYSRESETREQ_Msk);                   /* Keep priority group unchanged */
+  __DSB();                                                     /* Ensure completion of memory access */
+  while(1);                                                    /* wait until reset */
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+
+/* ##################################    SysTick function  ############################################ */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+    \brief      Functions that configure the System.
+  @{
+ */
+
+#if (__Vendor_SysTickConfig == 0)
+
+/** \brief  System Tick Configuration
+
+    The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
+    Counter is in free running mode to generate periodic interrupts.
+
+    \param [in]  ticks  Number of ticks between two interrupts.
+
+    \return          0  Function succeeded.
+    \return          1  Function failed.
+
+    \note     When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+    function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+    must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+  if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)  return (1);      /* Reload value impossible */
+
+  SysTick->LOAD  = ticks - 1;                                  /* set reload register */
+  NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);  /* set Priority for Systick Interrupt */
+  SysTick->VAL   = 0;                                          /* Load the SysTick Counter Value */
+  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
+                   SysTick_CTRL_TICKINT_Msk   |
+                   SysTick_CTRL_ENABLE_Msk;                    /* Enable SysTick IRQ and SysTick Timer */
+  return (0);                                                  /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/** \ingroup  CMSIS_Core_FunctionInterface
+    \defgroup CMSIS_core_DebugFunctions ITM Functions
+    \brief   Functions that access the ITM debug interface.
+  @{
+ */
+
+extern volatile int32_t ITM_RxBuffer;                    /*!< External variable to receive characters.                         */
+#define                 ITM_RXBUFFER_EMPTY    0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/** \brief  ITM Send Character
+
+    The function transmits a character via the ITM channel 0, and
+    \li Just returns when no debugger is connected that has booked the output.
+    \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+
+    \param [in]     ch  Character to transmit.
+
+    \returns            Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+  if ((ITM->TCR & ITM_TCR_ITMENA_Msk)                  &&      /* ITM enabled */
+      (ITM->TER & (1UL << 0)        )                    )     /* ITM Port #0 enabled */
+  {
+    while (ITM->PORT[0].u32 == 0);
+    ITM->PORT[0].u8 = (uint8_t) ch;
+  }
+  return (ch);
+}
+
+
+/** \brief  ITM Receive Character
+
+    The function inputs a character via the external variable \ref ITM_RxBuffer.
+
+    \return             Received character.
+    \return         -1  No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void) {
+  int32_t ch = -1;                           /* no character available */
+
+  if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
+    ch = ITM_RxBuffer;
+    ITM_RxBuffer = ITM_RXBUFFER_EMPTY;       /* ready for next character */
+  }
+
+  return (ch);
+}
+
+
+/** \brief  ITM Check Character
+
+    The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+
+    \return          0  No character available.
+    \return          1  Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void) {
+
+  if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
+    return (0);                                 /* no character available */
+  } else {
+    return (1);                                 /*    character available */
+  }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+#endif /* __CORE_SC300_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
+
+#ifdef __cplusplus
+}
+#endif

+ 30 - 0
bsp/CME_M7/CMSIS/SConscript

@@ -0,0 +1,30 @@
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+# get current directory
+cwd = GetCurrentDir()
+
+# The set of source files associated with this SConscript file.
+src = Split("""
+CME_M7/system_cmem7.c
+""")
+
+# add for startup script 
+if rtconfig.CROSS_TOOL == 'gcc':
+    src += ['CME_M7/startup/gcc/startup_CME_M7.c']
+elif rtconfig.CROSS_TOOL == 'keil':
+    src += ['CME_M7/startup/arm/startup_cmem7.s']
+elif rtconfig.CROSS_TOOL == 'iar':
+    print('================ERROR============================')
+    print('Not support IAR yet!')
+    print('=================================================')
+    exit(0)
+
+path = [cwd + '/CME_M7']
+
+path += [cwd + '/CMSIS/Include']
+
+group = DefineGroup('CMSIS', src, depend = [''], CPPPATH = path)
+
+Return('group')

+ 28 - 0
bsp/CME_M7/Kconfig

@@ -0,0 +1,28 @@
+mainmenu "RT-Thread Configuration"
+
+config BSP_DIR
+    string
+    option env="BSP_ROOT"
+    default "."
+
+config RTT_DIR
+    string
+    option env="RTT_ROOT"
+    default "../.."
+
+# you can change the RTT_ROOT default "../.." to your rtthread_root,
+# example : default "F:/git_repositories/rt-thread"
+
+config PKGS_DIR
+    string
+    option env="PKGS_ROOT"
+    default "packages"
+
+source "$RTT_DIR/Kconfig"
+source "$PKGS_DIR/Kconfig"
+
+config SOC_CME_M7
+    bool 
+    select ARCH_ARM_CORTEX_M3
+    select RT_USING_COMPONENTS_INIT
+    default y

+ 12 - 0
bsp/CME_M7/SConscript

@@ -0,0 +1,12 @@
+from building import *
+
+cwd  = GetCurrentDir()
+objs = []
+list = os.listdir(cwd)
+
+for d in list:
+    path = os.path.join(cwd, d)
+    if os.path.isfile(os.path.join(path, 'SConscript')):
+        objs = objs + SConscript(os.path.join(d, 'SConscript'))
+
+Return('objs')

+ 31 - 0
bsp/CME_M7/SConstruct

@@ -0,0 +1,31 @@
+import os
+import sys
+import rtconfig
+from rtconfig import RTT_ROOT
+
+sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
+from building import *
+
+TARGET = 'rtthread.' + rtconfig.TARGET_EXT
+
+DefaultEnvironment(tools=[])
+env = Environment(tools = ['mingw'],
+	AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+	CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
+	AR = rtconfig.AR, ARFLAGS = '-rc',
+	LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
+env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+
+if rtconfig.PLATFORM == 'iar':
+	env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
+	env.Replace(ARFLAGS = [''])
+	env.Replace(LINKCOM = ['$LINK $SOURCES $LINKFLAGS -o $TARGET --map project.map'])
+
+Export('RTT_ROOT')
+Export('rtconfig')
+
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
+
+# make a building
+DoBuilding(TARGET, objs)

+ 14 - 0
bsp/CME_M7/StdPeriph_Driver/SConscript

@@ -0,0 +1,14 @@
+import rtconfig
+Import('RTT_ROOT')
+from building import *
+
+# get current directory
+cwd = GetCurrentDir()
+
+src = Glob('src/*.c')
+
+path = [cwd + '/inc']
+
+group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path)
+
+Return('group')

+ 8014 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7.h

@@ -0,0 +1,8014 @@
+
+/****************************************************************************************************//**
+ * @file     cmem7.h
+ *
+ * @brief    CMSIS Cortex-M3 Peripheral Access Layer Header File for
+ *           cmem7 from <unknown Vendor>.
+ *
+ * @version  V1.0
+ * @date     5. January 2015
+ *
+ * @note     Generated with SVDConv V2.75 
+ *           from CMSIS SVD File 'SVDConv_CME_M7.svd' Version 1.0,
+ *******************************************************************************************************/
+
+
+
+/** @addtogroup (null)
+  * @{
+  */
+
+/** @addtogroup cmem7
+  * @{
+  */
+
+#ifndef CMEM7_H
+#define CMEM7_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* -------------------------  Interrupt Number Definition  ------------------------ */
+
+typedef enum {
+/* -------------------  Cortex-M3 Processor Exceptions Numbers  ------------------- */
+  Reset_IRQn                    = -15,              /*!<   1  Reset Vector, invoked on Power up and warm reset                 */
+  NonMaskableInt_IRQn           = -14,              /*!<   2  Non maskable Interrupt, cannot be stopped or preempted           */
+  HardFault_IRQn                = -13,              /*!<   3  Hard Fault, all classes of Fault                                 */
+  MemoryManagement_IRQn         = -12,              /*!<   4  Memory Management, MPU mismatch, including Access Violation
+                                                         and No Match                                                          */
+  BusFault_IRQn                 = -11,              /*!<   5  Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory
+                                                         related Fault                                                         */
+  UsageFault_IRQn               = -10,              /*!<   6  Usage Fault, i.e. Undef Instruction, Illegal State Transition    */
+  SVCall_IRQn                   =  -5,              /*!<  11  System Service Call via SVC instruction                          */
+  DebugMonitor_IRQn             =  -4,              /*!<  12  Debug Monitor                                                    */
+  PendSV_IRQn                   =  -2,              /*!<  14  Pendable request for system service                              */
+  SysTick_IRQn                  =  -1,              /*!<  15  System Tick Timer                                                */
+/* ----------------------  cmem7 Specific Interrupt Numbers  ---------------------- */
+  ETH_INT_IRQn                  =   0,              /*!<   0  ETH_INT                                                          */
+  USB_INT_IRQn                  =   1,              /*!<   1  USB_INT                                                          */
+  DMA_INT_IRQn                  =   2,              /*!<   2  DMA_INT                                                          */
+  CAN0_INT_IRQn                 =   3,              /*!<   3  CAN0_INT                                                         */
+  CAN1_INT_IRQn                 =   4,              /*!<   4  CAN1_INT                                                         */
+  FP0_INT_IRQn                  =   5,              /*!<   5  FP0_INT                                                          */
+  FP1_INT_IRQn                  =   6,              /*!<   6  FP1_INT                                                          */
+  FP2_INT_IRQn                  =   7,              /*!<   7  FP2_INT                                                          */
+  FP3_INT_IRQn                  =   8,              /*!<   8  FP3_INT                                                          */
+  FP4_INT_IRQn                  =   9,              /*!<   9  FP4_INT                                                          */
+  FP5_INT_IRQn                  =  10,              /*!<  10  FP5_INT                                                          */
+  FP6_INT_IRQn                  =  11,              /*!<  11  FP6_INT                                                          */
+  FP7_INT_IRQn                  =  12,              /*!<  12  FP7_INT                                                          */
+  FP8_INT_IRQn                  =  13,              /*!<  13  FP8_INT                                                          */
+  FP9_INT_IRQn                  =  14,              /*!<  14  FP9_INT                                                          */
+  FP10_INT_IRQn                 =  15,              /*!<  15  FP10_INT                                                         */
+  FP11_INT_IRQn                 =  16,              /*!<  16  FP11_INT                                                         */
+  FP12_INT_IRQn                 =  17,              /*!<  17  FP12_INT                                                         */
+  FP13_INT_IRQn                 =  18,              /*!<  18  FP13_INT                                                         */
+  FP14_INT_IRQn                 =  19,              /*!<  19  FP14_INT                                                         */
+  FP15_INT_IRQn                 =  20,              /*!<  20  FP15_INT                                                         */
+  UART0_INT_IRQn                =  21,              /*!<  21  UART0_INT                                                        */
+  UART1_INT_IRQn                =  22,              /*!<  22  UART1_INT                                                        */
+  ADC_INT_IRQn                  =  23,              /*!<  23  ADC_INT                                                          */
+  GPIO_INT_IRQn                 =  24,              /*!<  24  GPIO_INT                                                         */
+  SPI1_INT_IRQn                 =  25,              /*!<  25  SPI1_INT                                                         */
+  I2C1_INT_IRQn                 =  26,              /*!<  26  I2C1_INT                                                         */
+  SPI0_INT_IRQn                 =  27,              /*!<  27  SPI0_INT                                                         */
+  I2C0_INT_IRQn                 =  28,              /*!<  28  I2C0_INT                                                         */
+  RTC_1S_INT_IRQn               =  29,              /*!<  29  RTC_1S_INT                                                       */
+  RTC_1MS_INT_IRQn              =  30,              /*!<  30  RTC_1MS_INT                                                      */
+  WDG_INT_IRQn                  =  31,              /*!<  31  WDG_INT                                                          */
+  TIMER_INT_IRQn                =  32,              /*!<  32  TIMER_INT                                                        */
+  DDRC_SW_PROC_IRQn             =  33,              /*!<  33  DDRC_SW_PROC                                                     */
+  ETH_PMT_INT_IRQn              =  34,              /*!<  34  ETH_PMT_INT                                                      */
+  PAD_INT_IRQn                  =  35,              /*!<  35  PAD_INT                                                          */
+  DDRC_LANE_SYNC_IRQn           =  36,              /*!<  36  DDRC_LANE_SYNC                                                   */
+  UART2_INT_IRQn                =  37               /*!<  37  UART2_INT                                                        */
+} IRQn_Type;
+
+
+/** @addtogroup Configuration_of_CMSIS
+  * @{
+  */
+
+
+/* ================================================================================ */
+/* ================      Processor and Core Peripheral Section     ================ */
+/* ================================================================================ */
+
+/* ----------------Configuration of the Cortex-M3 Processor and Core Peripherals---------------- */
+#define __CM3_REV                 0x0000            /*!< Cortex-M3 Core Revision                                               */
+#define __MPU_PRESENT                  0            /*!< MPU present or not                                                    */
+#define __NVIC_PRIO_BITS               0            /*!< Number of Bits used for Priority Levels                               */
+#define __Vendor_SysTickConfig         0            /*!< Set to 1 if different SysTick Config is used                          */
+/** @} */ /* End of group Configuration_of_CMSIS */
+
+#include <core_cm3.h>                               /*!< Cortex-M3 processor and core peripherals                              */
+#include "system_cmem7.h"                           /*!< cmem7 System                                                          */
+
+
+/* ================================================================================ */
+/* ================       Device Specific Peripheral Section       ================ */
+/* ================================================================================ */
+
+
+/** @addtogroup Device_Peripheral_Registers
+  * @{
+  */
+
+
+/* -------------------  Start of section using anonymous unions  ------------------ */
+#if defined(__CC_ARM)
+  #pragma push
+  #pragma anon_unions
+#elif defined(__ICCARM__)
+  #pragma language=extended
+#elif defined(__GNUC__)
+  /* anonymous unions are enabled by default */
+#elif defined(__TMS470__)
+/* anonymous unions are enabled by default */
+#elif defined(__TASKING__)
+  #pragma warning 586
+#else
+  #warning Not supported compiler type
+#endif
+
+
+
+/* ================================================================================ */
+/* ================                      UART0                     ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief asynchronous serial controller 0 (UART0)
+  */
+
+typedef struct {                                    /*!< UART0 Structure                                                       */
+  __IO uint16_t  BAUDRATE;                          /*!< baudrate Register                                                     */
+  __I  uint16_t  RESERVED0;
+  __IO uint16_t  TX_BUF;                            /*!< transmit buffer Register                                              */
+  __I  uint16_t  RESERVED1;
+  __I  uint16_t  RX_BUF;                            /*!< receive buffer Register                                               */
+  __I  uint16_t  RESERVED2;
+  
+  union {
+    __IO uint32_t  CTRL;                            /*!< control Register                                                      */
+    
+    struct {
+      __IO uint32_t  MODE       :  3;               /*!< asc mode control                                                      */
+      __IO uint32_t  STOP       :  2;               /*!< number of stop bits selection                                         */
+      __IO uint32_t  PARITY     :  1;               /*!< parity selection                                                      */
+      __IO uint32_t  LOOPBACK   :  1;               /*!< loopback mode enable bit                                              */
+           uint32_t             :  1;
+      __IO uint32_t  RX_EN      :  1;               /*!< receive enable bit                                                    */
+           uint32_t             :  1;
+      __IO uint32_t  FIFO_EN    :  1;               /*!< FIFO enable bit                                                       */
+      __IO uint32_t  CTS        :  1;               /*!< Clear to send, enable signal to send                                  */
+      __IO uint32_t  BAUD_MODE  :  1;               /*!< baudrate generation mode                                              */
+      __IO uint32_t  RX_THRESHOLD:  5;              /*!< receive threshold                                                     */
+      __IO uint32_t  RX_HALF_FULL:  5;              /*!< receive fifi half full level                                          */
+    } CTRL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_MASK;                        /*!< interrupt mask register                                               */
+    
+    struct {
+      __IO uint32_t  RNE        :  1;               /*!< Receive FIFO not empty interrupt                                      */
+      __IO uint32_t  TE         :  1;               /*!< Transmitter FIFO empty interrupt                                      */
+      __IO uint32_t  THE        :  1;               /*!< Transmitter FIFO at least half empty flag                             */
+      __IO uint32_t  TONE       :  1;               /*!< timeout when the receiver FIFO is not empty interrupt                 */
+      __IO uint32_t  TOE        :  1;               /*!< timeout when the receiver FIFO is empty interrupt                     */
+      __IO uint32_t  RHF        :  1;               /*!< receiver FIFO is half full interrupt                                  */
+      __IO uint32_t  TF         :  1;               /*!< transmitter FIFO full interrupt                                       */
+      __IO uint32_t  PE         :  1;               /*!< parity error interrupt                                                */
+      __IO uint32_t  FE         :  1;               /*!< frame error interrupt                                                 */
+      __IO uint32_t  OE         :  1;               /*!< overrun error interrupt                                               */
+      __IO uint32_t  RX_THRE_REACH:  1;             /*!< Receive threshold reach interrupt                                     */
+    } INT_MASK_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  STATUS;                          /*!< status register                                                       */
+    
+    struct {
+      __IO uint32_t  RNE        :  1;               /*!< receiver FIFO not empty                                               */
+      __IO uint32_t  TE         :  1;               /*!< Transmitter FIFO empty                                                */
+      __IO uint32_t  THE        :  1;               /*!< Transmitter FIFO at least half empty flag                             */
+      __IO uint32_t  TONE       :  1;               /*!< timeout when the receiver FIFO is not empty                           */
+      __IO uint32_t  TOE        :  1;               /*!< time out when the receiver FIFO is empty                              */
+      __IO uint32_t  RHF        :  1;               /*!< receiver FIFO is half full                                            */
+      __IO uint32_t  TF         :  1;               /*!< transmitter FIFO is full                                              */
+    } STATUS_b;                                     /*!< BitSize                                                               */
+  };
+  __IO uint8_t   TIMEOUT;                           /*!< timeout Register                                                      */
+  __I  uint8_t   RESERVED3[3];
+  
+  union {
+    __IO uint32_t  TX_RESET;                        /*!< transmit reset Register                                               */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< enable                                                                */
+    } TX_RESET_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RX_RESET;                        /*!< receive reset Register                                                */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< enable                                                                */
+    } RX_RESET_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RUN;                             /*!< uart enable register                                                  */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< enable                                                                */
+    } RUN_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_RAW;                         /*!< raw interrupt before mask register                                    */
+    
+    struct {
+      __IO uint32_t  RNE        :  1;               /*!< Receive FIFO not empty interrupt                                      */
+      __IO uint32_t  TE         :  1;               /*!< Transmitter FIFO empty interrupt                                      */
+      __IO uint32_t  THE        :  1;               /*!< Transmitter FIFO at least half empty flag                             */
+      __IO uint32_t  TONE       :  1;               /*!< timeout when the receiver FIFO is not empty interrupt                 */
+      __IO uint32_t  TOE        :  1;               /*!< timeout when the receiver FIFO is empty interrupt                     */
+      __IO uint32_t  RHF        :  1;               /*!< receiver FIFO is half full interrupt                                  */
+      __IO uint32_t  TF         :  1;               /*!< transmitter FIFO full interrupt                                       */
+      __IO uint32_t  PE         :  1;               /*!< parity error interrupt                                                */
+      __IO uint32_t  FE         :  1;               /*!< frame error interrupt                                                 */
+      __IO uint32_t  OE         :  1;               /*!< overrun error interrupt                                               */
+      __IO uint32_t  RX_THRE_REACH:  1;             /*!< Receive threshold reach interrupt                                     */
+    } INT_RAW_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_SEEN;                        /*!< interrupt after mask register                                         */
+    
+    struct {
+      __IO uint32_t  RNE        :  1;               /*!< Receive FIFO not empty interrupt                                      */
+      __IO uint32_t  TE         :  1;               /*!< Transmitter FIFO empty interrupt                                      */
+      __IO uint32_t  THE        :  1;               /*!< Transmitter FIFO at least half empty flag                             */
+      __IO uint32_t  TONE       :  1;               /*!< timeout when the receiver FIFO is not empty interrupt                 */
+      __IO uint32_t  TOE        :  1;               /*!< timeout when the receiver FIFO is empty interrupt                     */
+      __IO uint32_t  RHF        :  1;               /*!< receiver FIFO is half full interrupt                                  */
+      __IO uint32_t  TF         :  1;               /*!< transmitter FIFO full interrupt                                       */
+      __IO uint32_t  PE         :  1;               /*!< parity error interrupt                                                */
+      __IO uint32_t  FE         :  1;               /*!< frame error interrupt                                                 */
+      __IO uint32_t  OE         :  1;               /*!< overrun error interrupt                                               */
+      __IO uint32_t  RX_THRE_REACH:  1;             /*!< Receive threshold reach interrupt                                     */
+    } INT_SEEN_b;                                   /*!< BitSize                                                               */
+  };
+} UART0_Type;
+
+
+/* ================================================================================ */
+/* ================                       WDG                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief watchdog (WDG)
+  */
+
+typedef struct {                                    /*!< WDG Structure                                                         */
+  
+  union {
+    __IO uint32_t  CTRL;                            /*!< control Register                                                      */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< flag indicates if watchdog is enabled or not                          */
+      __IO uint32_t  INT_LEN    :  1;               /*!< watchdog report interrupt when COUNTER is 1/4 or 1/2 of LENGTH        */
+    } CTRL_b;                                       /*!< BitSize                                                               */
+  };
+  __IO uint32_t  LEN;                               /*!< Ticks decrease down to 25% or 50% to trigger an interrupt             */
+  
+  union {
+    __IO uint32_t  INT_CTRL;                        /*!< interrupt control                                                     */
+    
+    struct {
+      __IO uint32_t  MASK       :  1;               /*!< mask register                                                         */
+      __IO uint32_t  TRIGGER_MODE:  1;              /*!< trigger mode                                                          */
+    } INT_CTRL_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_STA;                         /*!< interrupt status register                                             */
+    
+    struct {
+      __IO uint32_t  STA        :  1;               /*!< interrupt status                                                      */
+    } INT_STA_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_RAW;                         /*!< interrupt raw register                                                */
+    
+    struct {
+      __IO uint32_t  STA        :  1;               /*!< interrupt status                                                      */
+    } INT_RAW_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  CNT;                               /*!< counter register                                                      */
+} WDG_Type;
+
+
+/* ================================================================================ */
+/* ================                     TIMER0                     ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief timer 0 (TIMER0)
+  */
+
+typedef struct {                                    /*!< TIMER0 Structure                                                      */
+  
+  union {
+    __IO uint32_t  CTRL;                            /*!< control Register                                                      */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< flag indicates if timer is enabled or not                             */
+    } CTRL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TYPE;                            /*!< type Register                                                         */
+    
+    struct {
+      __IO uint32_t  SIGNLE_SHOT:  1;               /*!< indicate timer generate only one interrupt if not reload              */
+    } TYPE_b;                                       /*!< BitSize                                                               */
+  };
+  __IO uint32_t  LEN;                               /*!< length                                                                */
+  
+  union {
+    __IO uint32_t  INT_EN;                          /*!< interrupt enable                                                      */
+    
+    struct {
+      __IO uint32_t  EN_REVERSE :  1;               /*!< flag indicates if timer is disable or not                             */
+    } INT_EN_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_STA;                         /*!< interrupt status                                                      */
+    
+    struct {
+      __IO uint32_t  STA        :  1;               /*!< interrupt status                                                      */
+    } INT_STA_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_RAW;                         /*!< interrupt raw register                                                */
+    
+    struct {
+      __IO uint32_t  STA        :  1;               /*!< interrupt status                                                      */
+    } INT_RAW_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  CNT;                               /*!< counter register                                                      */
+} TIMER0_Type;
+
+
+/* ================================================================================ */
+/* ================                      SPI0                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief SPI 0 (SPI0)
+  */
+
+typedef struct {                                    /*!< SPI0 Structure                                                        */
+  
+  union {
+    __I  uint32_t  STATUS;                          /*!< status Register                                                       */
+    
+    struct {
+      __I  uint32_t  RFIFO_EMPTY:  1;               /*!< receive fifo is empty                                                 */
+      __I  uint32_t  RFIFO_FULL :  1;               /*!< receive fifo is full                                                  */
+      __I  uint32_t  RFIFO_ALMOST_EMPTY:  1;        /*!< receive fifo is almost empty                                          */
+      __I  uint32_t  RFIFO_ALMOST_FULL:  1;         /*!< receive fifo almost full                                              */
+      __I  uint32_t  TFIFO_EMPTY:  1;               /*!< transmit fifo is empty                                                */
+      __I  uint32_t  TFIFO_FULL :  1;               /*!< transmit fifo is full                                                 */
+      __I  uint32_t  TFIFO_ALMOST_EMPTY:  1;        /*!< transmit fifo is almost empty                                         */
+      __I  uint32_t  TFIFO_ALMOST_FULL:  1;         /*!< transmit fifo almost full                                             */
+      __I  uint32_t  BUSY       :  1;               /*!< indecates if SPI is idle or busy                                      */
+    } STATUS_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTRL;                            /*!< control Register                                                      */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< indicates if SPI is enabled or not                                    */
+      __IO uint32_t  RX_EN      :  1;               /*!< indicates if SPI receiver is enabled or not                           */
+      __IO uint32_t  CLK_HIGH   :  1;               /*!< indicats if idle clock polarity is high level                         */
+      __IO uint32_t  NEG_EDGE   :  1;               /*!< 1, indicates SPI takes sample at the rise edge and transmit
+                                                         data at the trailing edge. 0, conversely.                             */
+      __IO uint32_t  TX_BIT_SEQUENCE:  1;           /*!< transmit bit sequence. 0 : MSB is sent first                          */
+      __IO uint32_t  RX_BIT_SEQUENCE:  1;           /*!< receive bit sequence. 0: MSB is received first                        */
+    } CTRL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_MASK;                        /*!< interrupt mask Register                                               */
+    
+    struct {
+      __IO uint32_t  RFIFO_UNDERFLOW:  1;           /*!< receive fifo underflow interrupt                                      */
+      __IO uint32_t  RFIFO_OVERFLOW:  1;            /*!< receive fifo overflow interrupt                                       */
+      __IO uint32_t  RFIFO_ALMOST_FULL:  1;         /*!< receive fifo almost full interrupt                                    */
+      __IO uint32_t  TFIFO_UNDERFLOW:  1;           /*!< transmit fifo underflow interrupt                                     */
+      __IO uint32_t  TFIFO_OVERFLOW:  1;            /*!< transmit fifo overflow interrupt                                      */
+      __IO uint32_t  TFIFO_ALMOST_EMPTY:  1;        /*!< transmit fifo almost empty interrupt                                  */
+      __IO uint32_t  DONE       :  1;               /*!< transmit done interrupt                                               */
+    } INT_MASK_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_STATUS;                      /*!< interrupt Register                                                    */
+    
+    struct {
+      __IO uint32_t  RFIFO_UNDERFLOW:  1;           /*!< receive fifo underflow interrupt                                      */
+      __IO uint32_t  RFIFO_OVERFLOW:  1;            /*!< receive fifo overflow interrupt                                       */
+      __IO uint32_t  RFIFO_ALMOST_FULL:  1;         /*!< receive fifo almost full interrupt                                    */
+      __IO uint32_t  TFIFO_UNDERFLOW:  1;           /*!< transmit fifo underflow interrupt                                     */
+      __IO uint32_t  TFIFO_OVERFLOW:  1;            /*!< transmit fifo overflow interrupt                                      */
+      __IO uint32_t  TFIFO_ALMOST_EMPTY:  1;        /*!< transmit fifo almost empty interrupt                                  */
+      __IO uint32_t  DONE       :  1;               /*!< transmit done interrupt                                               */
+    } INT_STATUS_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_RAW;                         /*!< interrupt raw Register                                                */
+    
+    struct {
+      __IO uint32_t  RFIFO_UNDERFLOW:  1;           /*!< receive fifo underflow interrupt                                      */
+      __IO uint32_t  RFIFO_OVERFLOW:  1;            /*!< receive fifo overflow interrupt                                       */
+      __IO uint32_t  RFIFO_ALMOST_FULL:  1;         /*!< receive fifo almost full interrupt                                    */
+      __IO uint32_t  TFIFO_UNDERFLOW:  1;           /*!< transmit fifo underflow interrupt                                     */
+      __IO uint32_t  TFIFO_OVERFLOW:  1;            /*!< transmit fifo overflow interrupt                                      */
+      __IO uint32_t  TFIFO_ALMOST_EMPTY:  1;        /*!< transmit fifo almost empty interrupt                                  */
+      __IO uint32_t  DONE       :  1;               /*!< transmit done interrupt                                               */
+    } INT_RAW_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  BCNT;                            /*!< bit length while transmitting and receiving                           */
+    
+    struct {
+      __IO uint32_t  CNT        :  5;               /*!< bit length while transmitting and receiving, BCNT + 1                 */
+    } BCNT_b;                                       /*!< BitSize                                                               */
+  };
+  __IO uint8_t   GAP;                               /*!< half cycle number between continuous data frame                       */
+  __I  uint8_t   RESERVED0[3];
+  __IO uint16_t  DIV;                               /*!< frequency division register, fsck = fclk_io / (DIV + 1) / 2           */
+  __I  uint16_t  RESERVED1;
+  __IO uint32_t  TRANS_CNT;                         /*!< transmit data length, data number = TRANS_CNT + 1                     */
+  
+  union {
+    __O  uint32_t  TRANS_START;                     /*!< transmit startup register, write 1 to trigger transmision once        */
+    
+    struct {
+      __O  uint32_t  TX_TRIGGER :  1;               /*!< write 1 to trigger transmision once                                   */
+    } TRANS_START_b;                                /*!< BitSize                                                               */
+  };
+  __IO uint32_t  RW_DATA;                           /*!< raw data register                                                     */
+} SPI0_Type;
+
+
+/* ================================================================================ */
+/* ================                      I2C0                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief I2C 0 (I2C0)
+  */
+
+typedef struct {                                    /*!< I2C0 Structure                                                        */
+  
+  union {
+    __IO uint32_t  CTRL;                            /*!< control Register                                                      */
+    
+    struct {
+      __IO uint32_t  MODE       :  1;               /*!< master or slave mode                                                  */
+      __IO uint32_t  MASTER_ADDR_WIDTH:  1;         /*!< 7- or 10-bits address as a master                                     */
+      __IO uint32_t  SLAVE_ADDR_WIDTH:  1;          /*!< 7- or 10-bits address width as a slave                                */
+    } CTRL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint16_t  TAR;                             /*!< target address Register                                               */
+    
+    struct {
+      __IO uint16_t  ADDR10     : 10;               /*!< 7- or 10-bits address                                                 */
+      __IO uint16_t  START_BYTE :  1;               /*!< Enable start Byte for each transfer                                   */
+    } TAR_b;                                        /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED0;
+  
+  union {
+    __IO uint16_t  SAR;                             /*!< slave address Register                                                */
+    
+    struct {
+      __IO uint16_t  ADDR10     : 10;               /*!< 7- or 10-bits address                                                 */
+    } SAR_b;                                        /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED1;
+  
+  union {
+    __IO uint32_t  DATA_CMD;                        /*!< I2C transfer data/command entry                                       */
+    
+    struct {
+      __IO uint32_t  DATA       :  8;               /*!< 8-bits data                                                           */
+      __O  uint32_t  RD_CMD     :  1;               /*!< read command for master mode only, write 0 if slave mode              */
+      __O  uint32_t  WR_CMD     :  1;               /*!< write command for master mode only                                    */
+      __O  uint32_t  WR_RD_CMD  :  1;               /*!< write and read command for master mode only                           */
+    } DATA_CMD_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  WRITE_READ_CNT;                  /*!< I2C write and read data byte counter Register                         */
+    
+    struct {
+      __IO uint32_t  RD_BYTE_CNT:  9;               /*!< Decide the number of bytes read back as a master-receiver             */
+           uint32_t             :  7;
+      __IO uint32_t  WR_BYTE_CNT:  9;               /*!< Decide the number of byte to send as a master-transmitter             */
+    } WRITE_READ_CNT_b;                             /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SCL_CNT;                         /*!< I2C clk pulse counter                                                 */
+    
+    struct {
+      __IO uint32_t  HIGH_LEVEL_TICK: 16;           /*!< the SCL clock high-period count                                       */
+      __IO uint32_t  LOW_LEVEL_TICK: 16;            /*!< the SCL clock low-period count                                        */
+    } SCL_CNT_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED2;
+  
+  union {
+    __I  uint32_t  INT_STATUS;                      /*!< I2C interrupt sources                                                 */
+    
+    struct {
+      __I  uint32_t  RX_UNDER   :  1;               /*!< receiver underflow                                                    */
+      __I  uint32_t  RX_OVER    :  1;               /*!< receiver overflow                                                     */
+      __I  uint32_t  RX_FULL    :  1;               /*!< receiver is full                                                      */
+      __I  uint32_t  TX_OVER    :  1;               /*!< transmit overflow                                                     */
+      __I  uint32_t  TX_EMPTY   :  1;               /*!< transmit is empty                                                     */
+      __I  uint32_t  RD_REQ     :  1;               /*!< read request                                                          */
+      __I  uint32_t  TX_ABRT    :  1;               /*!< transmit abortion                                                     */
+      __I  uint32_t  RX_DONE    :  1;               /*!< receive done                                                          */
+      __I  uint32_t  TX_DONE    :  1;               /*!< transmit done                                                         */
+      __I  uint32_t  WR_REQ     :  1;               /*!< write request                                                         */
+    } INT_STATUS_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_MASK;                        /*!< I2C interrupt mask register                                           */
+    
+    struct {
+      __I  uint32_t  RX_UNDER   :  1;               /*!< receiver underflow                                                    */
+      __I  uint32_t  RX_OVER    :  1;               /*!< receiver overflow                                                     */
+      __I  uint32_t  RX_FULL    :  1;               /*!< receiver is full                                                      */
+      __I  uint32_t  TX_OVER    :  1;               /*!< transmit overflow                                                     */
+      __I  uint32_t  TX_EMPTY   :  1;               /*!< transmit is empty                                                     */
+      __I  uint32_t  RD_REQ     :  1;               /*!< read request                                                          */
+      __I  uint32_t  TX_ABRT    :  1;               /*!< transmit abortion                                                     */
+      __I  uint32_t  RX_DONE    :  1;               /*!< receive done                                                          */
+      __I  uint32_t  TX_DONE    :  1;               /*!< transmit done                                                         */
+      __I  uint32_t  WR_REQ     :  1;               /*!< write request                                                         */
+    } INT_MASK_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED3;
+  
+  union {
+    __IO uint32_t  RX_TL;                           /*!< I2C receive FIFO threshold                                            */
+    
+    struct {
+      __IO uint32_t  THRESHOLD  :  5;               /*!< FIFO threashold                                                       */
+    } RX_TL_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TX_TL;                           /*!< I2C transmit FIFO threshold                                           */
+    
+    struct {
+      __IO uint32_t  THRESHOLD  :  5;               /*!< FIFO threashold                                                       */
+    } TX_TL_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_ALL_INT;                     /*!< I2C clear all interrupt register                                      */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear all individual interrupts                 */
+    } CLR_ALL_INT_b;                                /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_RX_UNDER;                    /*!< I2C clear RX_UNDER interrupt                                          */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear the RX_UNDER interrupt (bit 19)
+                                                         of the I2C_STATUS register                                            */
+    } CLR_RX_UNDER_b;                               /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_RX_OVER;                     /*!< I2C clear RX_OVER interrupt                                           */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear the RX_OVER interrupt (bit 20) of
+                                                         the I2C_STATUS register                                               */
+    } CLR_RX_OVER_b;                                /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_TX_OVER;                     /*!< I2C clear TX_OVER interrupt                                           */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear the TX_OVER interrupt (bit 22) of
+                                                         the I2C_STATUS register                                               */
+    } CLR_TX_OVER_b;                                /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_RD_REQ;                      /*!< I2C clear RD_REQ interrupt                                            */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear the RD_REQ interrupt (bit 24) of
+                                                         the I2C_STATUS register                                               */
+    } CLR_RD_REQ_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_TX_ABRT;                     /*!< I2C clear TX_ABRT interrupt                                           */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear the TX_ABRT interrupts (bit 25 ,
+                                                         bit 18, bit 17, bit 16 and bit 15) of the I2C_STATUS register.        */
+    } CLR_TX_ABRT_b;                                /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_RX_DONE;                     /*!< I2C clear RX_DONE interrupt                                           */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear the RX_DONE interrupt (bit 26) of
+                                                         the I2C_STATUS register                                               */
+    } CLR_RX_DONE_b;                                /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ENABLE;                          /*!< I2C enable register                                                   */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< enable device                                                         */
+           uint32_t             : 30;
+      __IO uint32_t  RESET      :  1;               /*!< TX and RX FIFO are held in an erased state( flushed) and all
+                                                         interrupts deserted                                                   */
+    } ENABLE_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  STATUS;                          /*!< I2C status register                                                   */
+    
+    struct {
+      __I  uint32_t  BUSY       :  1;               /*!< I2C busy Status                                                       */
+      __I  uint32_t  TX_FIFO_NOT_FULL:  1;          /*!< transmit FIFO is not full                                             */
+      __I  uint32_t  TX_FIFO_EMPTY:  1;             /*!< transmit FIFO is empty                                                */
+      __I  uint32_t  RX_FIFO_NOT_EMPTY:  1;         /*!< receive FIFO is not empty                                             */
+      __I  uint32_t  RX_FIFO_FULL:  1;              /*!< receive FIFO is full                                                  */
+      __I  uint32_t  EN         :  1;               /*!< I2C is enabled                                                        */
+      __I  uint32_t  TX_BYTE_W_ACK:  9;             /*!< Number of bytes sent to slave with acknowledge during the last
+                                                         write transaction as a master-transmitter only                        */
+      __I  uint32_t  ABRT_ADDR_NOACK:  1;           /*!< the address sent was not acknowledged by any slave as a master        */
+      __I  uint32_t  ABRT_TX_DATA_NOACK:  1;        /*!< the data sent was not acknowledged by any slave as a master           */
+      __I  uint32_t  ABRT_SLAVE_FLUSH_TX_FIFO:  1;  /*!< Slave has received a read command and some data exists in the
+                                                         TX FIFO so the slave issues a TX_ABRT interrupt to flush old
+                                                          data in TX FIFO                                                      */
+      __I  uint32_t  ABRT_SLAVE_RD_IN_TX:  1;       /*!< When the processor side responds to a slave mode request for
+                                                         data to be transmitted to a remote master and user writes a
+                                                          1 in CMD (bit 8) of I2C_DATA_CMD register                            */
+      __I  uint32_t  RX_UNDER   :  1;               /*!< receiver is underflow                                                 */
+      __I  uint32_t  RX_OVER    :  1;               /*!< receiver is overflow                                                  */
+      __I  uint32_t  RX_FULL    :  1;               /*!< receiver is full                                                      */
+      __I  uint32_t  TX_OVER    :  1;               /*!< transmit is overflow                                                  */
+      __I  uint32_t  TX_EMPTY   :  1;               /*!< transmit is empty                                                     */
+      __I  uint32_t  RD_REQ     :  1;               /*!< read request is received                                              */
+      __I  uint32_t  TX_ABRT    :  1;               /*!< transmit is abort                                                     */
+      __I  uint32_t  RX_DONE    :  1;               /*!< receive is done                                                       */
+      __I  uint32_t  TX_DONE    :  1;               /*!< transmit is done                                                      */
+      __I  uint32_t  WR_REQ     :  1;               /*!< write request is received                                             */
+      __I  uint32_t  MST_RD_FLAG:  1;               /*!< Master is executing read command                                      */
+      __I  uint32_t  MST_WR_FLAG:  1;               /*!< Master is executing read command                                      */
+      __I  uint32_t  MST_WR_RD_FLAG:  1;            /*!< Master is executing write-read command                                */
+    } STATUS_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  TX_FIFO_LEVEL;                   /*!< I2C transmit FIFO level                                               */
+    
+    struct {
+      __I  uint32_t  LEVEL      :  5;               /*!< FIFO level                                                            */
+    } TX_FIFO_LEVEL_b;                              /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  RX_FIFO_LEVEL;                   /*!< I2C receive FIFO level                                                */
+    
+    struct {
+      __I  uint32_t  LEVEL      :  5;               /*!< FIFO level                                                            */
+    } RX_FIFO_LEVEL_b;                              /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED4;
+  
+  union {
+    __O  uint32_t  SLAVE_NACK;                      /*!< I2C slave send a data NACK                                            */
+    
+    struct {
+      __O  uint32_t  NACK       :  1;               /*!< data NACK                                                             */
+    } SLAVE_NACK_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED5;
+  
+  union {
+    __IO uint32_t  SDA_SETUP;                       /*!< I2C SDA setup timer                                                   */
+    
+    struct {
+      __IO uint32_t  TSETUP     : 10;               /*!< This counter defines the max value of the following constrains:THD:STA
+                                                         TSU:STO,TSETUP: T / INPUT_CLK_PERIOD                                  */
+      __IO uint32_t  TSU_DAT    :  8;               /*!< This counter defines the constrain of TSU:DAT: 250ns (or 100ns)
+                                                         / INPUT_CLK_PERIOD                                                    */
+    } SDA_SETUP_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TSU_STA_SETUP;                   /*!< I2C Tsu_sta and Tbuf_free timer                                       */
+    
+    struct {
+      __IO uint32_t  TBUF       : 10;               /*!< This counter defines the constrain of bus free interval: Tbuf,
+                                                         Tbuf : Tbus_free / INPUT_CLK_PERIOD                                   */
+      __IO uint32_t  TSU_STA    : 10;               /*!< This counter defines the constrain of Tsu:sta, Tsu:sta : Tsu:sta
+                                                         / INPUT_CLK_PERIOD                                                    */
+      __IO uint32_t  SDA_FILTER_CNT:  4;            /*!< SDA filter count                                                      */
+      __IO uint32_t  SDA_FILTER_EN:  1;             /*!< SDA filter enable bit                                                 */
+      __IO uint32_t  SCL_FILTER_CNT:  4;            /*!< SCL filter count                                                      */
+      __IO uint32_t  SCL_FILTER_EN:  1;             /*!< SCL filter enable bit                                                 */
+    } TSU_STA_SETUP_b;                              /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CLR_TX_DONE;                     /*!< I2C clear TX_DONE interrupt                                           */
+    
+    struct {
+      __I  uint32_t  CLEAR      :  1;               /*!< Read this register to clear the TX_DONE interrupt (bit 27) of
+                                                         the I2C_STATUS register                                               */
+    } CLR_TX_DONE_b;                                /*!< BitSize                                                               */
+  };
+} I2C0_Type;
+
+
+/* ================================================================================ */
+/* ================                       RTC                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief RTC (RTC)
+  */
+
+typedef struct {                                    /*!< RTC Structure                                                         */
+  
+  union {
+    __IO uint32_t  INT_STATUS;                      /*!< interrupt Register                                                    */
+    
+    struct {
+      __IO uint32_t  SECOND     :  1;               /*!< 1s interrupt, write 1 clear 0                                         */
+      __IO uint32_t  MILLSECOND :  1;               /*!< 1ms interrupt, write 1 clear 0                                        */
+    } INT_STATUS_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SECOND;                            /*!< current seconds of system time                                        */
+  
+  union {
+    __IO uint16_t  MILLSECOND;                      /*!< current millseconds of system time                                    */
+    
+    struct {
+      __IO uint16_t  MS         : 10;               /*!< micro seconds                                                         */
+    } MILLSECOND_b;                                 /*!< BitSize                                                               */
+  };
+} RTC_Type;
+
+
+/* ================================================================================ */
+/* ================                      GPIO                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief GPIO (GPIO)
+  */
+
+typedef struct {                                    /*!< GPIO Structure                                                        */
+  __I  uint32_t  GPIO_IN;                           /*!< GPIO input data                                                       */
+  __IO uint32_t  GPIO_OUT_UNMASK;                   /*!< GPIO output mask Register                                             */
+  __IO uint32_t  GPIO_OUT_DATA;                     /*!< GPIO output data register                                             */
+  __IO uint32_t  GPIO_OE;                           /*!< GPIO output driver enable                                             */
+  __IO uint32_t  GPIO_INT_MASK;                     /*!< GPIO input interrupt mask                                             */
+  __IO uint32_t  GPIO_INT_STATUS;                   /*!< GPIO input interrupt status                                           */
+  __IO uint32_t  GPIO_INT_RAW;                      /*!< GPIO input interrupt raw                                              */
+  __IO uint32_t  GPIO_POSITIVE_EDGE_INT_TRIGGER;    /*!< triggers an interrupt while a positive edge, else negitive edge       */
+  
+  union {
+    __IO uint32_t  PWM_OUT_SEL;                     /*!< Select gpio output from PWM                                           */
+    
+    struct {
+      __IO uint32_t  GPIO_31    :  1;               /*!< GPIO[31] is selected to output PWM                                    */
+      __IO uint32_t  GPIO_H_9   :  1;               /*!< GPIO_H[9] is selected to output PWM                                   */
+      __IO uint32_t  GPIO_H_19  :  1;               /*!< GPIO_H[19] is selected to output PWM                                  */
+      __IO uint32_t  GPIO_H_20  :  1;               /*!< GPIO_H[20] is selected to output PWM                                  */
+    } PWM_OUT_SEL_b;                                /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  PWM_OUT0_LEN;                    /*!< Pwm channel 0 paramters                                               */
+    
+    struct {
+      __IO uint32_t  LOW_LEVEL_TICK: 16;            /*!< low level width = ticks + 1                                           */
+      __IO uint32_t  HIGH_LEVEL_TICK: 16;           /*!< high level width = ticks + 1                                          */
+    } PWM_OUT0_LEN_b;                               /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  PWM_OUT1_LEN;                    /*!< Pwm channel 1 paramters                                               */
+    
+    struct {
+      __IO uint32_t  LOW_LEVEL_TICK: 16;            /*!< low level width = ticks + 1                                           */
+      __IO uint32_t  HIGH_LEVEL_TICK: 16;           /*!< high level width = ticks + 1                                          */
+    } PWM_OUT1_LEN_b;                               /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  PWM_OUT2_LEN;                    /*!< Pwm channel 2 paramters                                               */
+    
+    struct {
+      __IO uint32_t  LOW_LEVEL_TICK: 16;            /*!< low level width = ticks + 1                                           */
+      __IO uint32_t  HIGH_LEVEL_TICK: 16;           /*!< high level width = ticks + 1                                          */
+    } PWM_OUT2_LEN_b;                               /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  PWM_OUT3_LEN;                    /*!< Pwm channel 3 paramters                                               */
+    
+    struct {
+      __IO uint32_t  LOW_LEVEL_TICK: 16;            /*!< low level width = ticks + 1                                           */
+      __IO uint32_t  HIGH_LEVEL_TICK: 16;           /*!< high level width = ticks + 1                                          */
+    } PWM_OUT3_LEN_b;                               /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  PWM_OUT_EN;                      /*!< Pwm enable                                                            */
+    
+    struct {
+      __IO uint32_t  GPIO_31    :  1;               /*!< GPIO[31] is selected to output PWM                                    */
+      __IO uint32_t  GPIO_H_9   :  1;               /*!< GPIO_H[9] is selected to output PWM                                   */
+      __IO uint32_t  GPIO_H_19  :  1;               /*!< GPIO_H[19] is selected to output PWM                                  */
+      __IO uint32_t  GPIO_H_20  :  1;               /*!< GPIO_H[20] is selected to output PWM                                  */
+    } PWM_OUT_EN_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint32_t  GPIO_H_IN;                         /*!< GPIO_H input data                                                     */
+  __IO uint32_t  GPIO_H_OUT_UNMASK;                 /*!< GPIO_H output unmask Register                                         */
+  __IO uint32_t  GPIO_H_OUT_DATA;                   /*!< GPIO_H output data register                                           */
+  __IO uint32_t  GPIO_H_OE;                         /*!< GPIO_H output driver enable                                           */
+  __IO uint32_t  GPIO_H_INT_MASK;                   /*!< GPIO_H interrupt mask                                                 */
+  __IO uint32_t  GPIO_H_INT_STATUS;                 /*!< GPIO_H interrupt status                                               */
+  __IO uint32_t  GPIO_H_INT_RAW;                    /*!< GPIO_H interrupt raw                                                  */
+  __IO uint32_t  GPIO_H_POSITIVE_EDGE_INT_TRIGGER;  /*!< triggers an interrupt while a positive edge, else negitive edge       */
+  __I  uint32_t  GPIO_N_IN;                         /*!< GPIO_N input data                                                     */
+  __IO uint32_t  GPIO_N_OUT_UNMASK;                 /*!< GPIO_N output unmask Register                                         */
+  __IO uint32_t  GPIO_N_OUT_DATA;                   /*!< GPIO_N output data register                                           */
+  __IO uint32_t  GPIO_N_OE;                         /*!< GPIO_N output driver enable                                           */
+  __IO uint32_t  GPIO_N_INT_MASK;                   /*!< GPIO_N interrupt mask                                                 */
+  __IO uint32_t  GPIO_N_INT_STATUS;                 /*!< GPIO_N interrupt status                                               */
+  __IO uint32_t  GPIO_N_INT_RAW;                    /*!< GPIO_N interrupt raw                                                  */
+  __IO uint32_t  GPIO_N_POSITIVE_EDGE_INT_TRIGGER;  /*!< triggers an interrupt while a positive edge, else negitive edge       */
+} GPIO_Type;
+
+
+/* ================================================================================ */
+/* ================                    NOR_FLASH                   ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief NOR_FLASH (NOR_FLASH)
+  */
+
+typedef struct {                                    /*!< NOR_FLASH Structure                                                   */
+  
+  union {
+    __IO uint32_t  CTRL0;                           /*!< control Register 0                                                    */
+    
+    struct {
+      __IO uint32_t  DIV        :  8;               /*!< frequency division register, fsck = fclk_io / (DIV + 1) / 2           */
+      __IO uint32_t  CS_REVALID_INTERVAL:  8;       /*!< interval from CS invalid to valid, number of half cycle of SCK        */
+      __IO uint32_t  RW_BYTE_CNT: 16;               /*!< RW byte count (eliminate CMD, ADDRESS, DUMMY in normal state,
+                                                         contains all in transparent state. 0 is unlimited                     */
+    } CTRL0_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTRL1;                           /*!< control Register 1                                                    */
+    
+    struct {
+      __IO uint32_t  CMD        :  8;               /*!< operated command                                                      */
+      __IO uint32_t  ADDRESS    : 24;               /*!< RW address                                                            */
+    } CTRL1_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TRIGGER;                         /*!< trigger register                                                      */
+    
+    struct {
+      __O  uint32_t  OP_START   :  1;               /*!< operation start.                                                      */
+      __IO uint32_t  OP_CLEAN   :  1;               /*!< operation clean, stop current opration and clean FIFO                 */
+      __IO uint32_t  TRSP_RD_EN :  1;               /*!< if a read operation after transparent operation                       */
+      __IO uint32_t  TRSP_EN    :  1;               /*!< enable transparent operation                                          */
+    } TRIGGER_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  STATUS;                          /*!< status register                                                       */
+    
+    struct {
+      __I  uint32_t  BUSY       :  1;               /*!< reading or writting                                                   */
+      __I  uint32_t  RD_FIFO_ALMOST_FULL:  1;       /*!< read FIFO is almost full                                              */
+      __I  uint32_t  RD_FIFO_EMPTY:  1;             /*!< read FIFO is empty                                                    */
+      __I  uint32_t  RD_FIFO_FULL:  1;              /*!< read FIFO is full                                                     */
+      __I  uint32_t  WR_FIFO_ALMOST_EMPTY:  1;      /*!< write FIFO is almost empty                                            */
+      __I  uint32_t  WR_FIFO_FULL:  1;              /*!< write FIFO is full                                                    */
+      __I  uint32_t  WR_FIFO_EMPTY:  1;             /*!< write FIFO is empty                                                   */
+    } STATUS_b;                                     /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DATA;                              /*!< data register. lower bits are significant in read and higher
+                                                         bits are significant in writting                                      */
+  
+  union {
+    __IO uint32_t  BYPASS;                          /*!< bypass Register, is used for JTAG connecting FLASH directly           */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< enable bypass                                                         */
+    } BYPASS_b;                                     /*!< BitSize                                                               */
+  };
+} NOR_FLASH_Type;
+
+
+/* ================================================================================ */
+/* ================                       ADC                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief ADC (ADC)
+  */
+
+typedef struct {                                    /*!< ADC Structure                                                         */
+  
+  union {
+    __IO uint32_t  POWERDOWN_RESET;                 /*!< power down and reset Register                                         */
+    
+    struct {
+      __IO uint32_t  RESET_ADC2 :  1;               /*!< ADC2, reset, active high                                              */
+      __IO uint32_t  RESET_ADC1 :  1;               /*!< ADC1, reset, active high                                              */
+      __IO uint32_t  POWERDOWN_ADC2:  1;            /*!< ADC2, power down, active high                                         */
+      __IO uint32_t  POWERDOWN_ADC1:  1;            /*!< ADC1, power down, active high                                         */
+    } POWERDOWN_RESET_b;                            /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG0;                            /*!< config Register                                                       */
+    
+    struct {
+      __IO uint32_t  VSEN       :  3;               /*!< ADC-1 VSEN Selection                                                  */
+      __IO uint32_t  PHASE_CTRL :  2;               /*!< ADC-1 and ADC-2 CLK Phase Control                                     */
+    } CFG0_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_ADC1;                        /*!< config ADC1 register                                                  */
+    
+    struct {
+      __IO uint32_t  SYSTEM_MODE:  3;               /*!< system mode selection                                                 */
+      __IO uint32_t  CHANNEL_SEL:  4;               /*!< channel selection                                                     */
+      __IO uint32_t  MULTI_CHANNEL_CONTINUE_SCAN:  1;/*!< If continue to scan multiply channel, else single scan               */
+      __IO uint32_t  MULTI_CHANNEL_BIT:  8;         /*!< each bit represents each channel                                      */
+    } CFG_ADC1_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_ADC2;                        /*!< config ADC1 register                                                  */
+    
+    struct {
+      __IO uint32_t  SYSTEM_MODE:  3;               /*!< system mode selection                                                 */
+      __IO uint32_t  CHANNEL_SEL:  4;               /*!< channel selection                                                     */
+      __IO uint32_t  MULTI_CHANNEL_CONTINUE_SCAN:  1;/*!< If continue to scan multiply channel, else single scan               */
+      __IO uint32_t  MULTI_CHANNEL_BIT:  8;         /*!< each bit represents each channel                                      */
+    } CFG_ADC2_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ADC1_FIFO_CLEAR;                 /*!< clear adc1 fifo data                                                  */
+    
+    struct {
+      __IO uint32_t  CLEAR      :  1;               /*!< clear fifo data, active high                                          */
+    } ADC1_FIFO_CLEAR_b;                            /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ADC2_FIFO_CLEAR;                 /*!< clear adc2 fifo data                                                  */
+    
+    struct {
+      __IO uint32_t  CLEAR      :  1;               /*!< clear fifo data, active high                                          */
+    } ADC2_FIFO_CLEAR_b;                            /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ALL_ADC_FIFO_CLEAR;              /*!< clear adc1 and adc2 fifo data                                         */
+    
+    struct {
+      __IO uint32_t  CLEAR      :  1;               /*!< clear fifo data, active high                                          */
+    } ALL_ADC_FIFO_CLEAR_b;                         /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_MASK;                        /*!< interrupt mask register                                               */
+    
+    struct {
+      __IO uint32_t  ADC1_ALMOST_FULL:  1;          /*!< ADC 1 almost full                                                     */
+      __IO uint32_t  ADC1_OVERFLOW:  1;             /*!< ADC 1 is overflow                                                     */
+      __IO uint32_t  ADC1_EMPTY_ERR:  1;            /*!< ADC 1 read empty error                                                */
+      __IO uint32_t  ADC2_ALMOST_FULL:  1;          /*!< ADC 2 almost full                                                     */
+      __IO uint32_t  ADC2_OVERFLOW:  1;             /*!< ADC 2 is overflow                                                     */
+      __IO uint32_t  ADC2_EMPTY_ERR:  1;            /*!< ADC 2 read empty error                                                */
+    } INT_MASK_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_RAW;                         /*!< interrupt raw register                                                */
+    
+    struct {
+      __IO uint32_t  ADC1_ALMOST_FULL:  1;          /*!< ADC 1 almost full                                                     */
+      __IO uint32_t  ADC1_OVERFLOW:  1;             /*!< ADC 1 is overflow                                                     */
+      __IO uint32_t  ADC1_EMPTY_ERR:  1;            /*!< ADC 1 read empty error                                                */
+      __IO uint32_t  ADC2_ALMOST_FULL:  1;          /*!< ADC 2 almost full                                                     */
+      __IO uint32_t  ADC2_OVERFLOW:  1;             /*!< ADC 2 is overflow                                                     */
+      __IO uint32_t  ADC2_EMPTY_ERR:  1;            /*!< ADC 2 read empty error                                                */
+    } INT_RAW_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_STATUS;                      /*!< interrupt status register                                             */
+    
+    struct {
+      __IO uint32_t  ADC1_ALMOST_FULL:  1;          /*!< ADC 1 almost full                                                     */
+      __IO uint32_t  ADC1_OVERFLOW:  1;             /*!< ADC 1 is overflow                                                     */
+      __IO uint32_t  ADC1_EMPTY_ERR:  1;            /*!< ADC 1 read empty error                                                */
+      __IO uint32_t  ADC2_ALMOST_FULL:  1;          /*!< ADC 2 almost full                                                     */
+      __IO uint32_t  ADC2_OVERFLOW:  1;             /*!< ADC 2 is overflow                                                     */
+      __IO uint32_t  ADC2_EMPTY_ERR:  1;            /*!< ADC 2 read empty error                                                */
+    } INT_STATUS_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint32_t  ADC1_OUT;                          /*!< ADC-1 Output data (Signed-Magnitude Format)                           */
+  __I  uint32_t  ADC2_OUT;                          /*!< ADC-2 Output data (Signed-Magnitude Format)                           */
+  __I  uint32_t  ADC1_OUT_OFFSET_CALIBRATION;       /*!< ADC-1 Output in offset calibration when Input=0, Ideally DAO[11:0]=000h */
+  __I  uint32_t  ADC2_OUT_OFFSET_CALIBRATION;       /*!< ADC-2 Output in offset calibration when Input=0, Ideally DAO[11:0]=000h */
+  __I  uint32_t  ADC1_OUT_NEGTIVE_GAIN_CALIBRATION; /*!< ADC-1 Output in gain calibration when Input=-FS, Ideally DAO[11:0]=801h */
+  __I  uint32_t  ADC2_OUT_NEGTIVE_GAIN_CALIBRATION; /*!< ADC-2 Output in gain calibration when Input=-FS, Ideally DAO[11:0]=801h */
+  __I  uint32_t  ADC1_OUT_POSITIVE_GAIN_CALIBRATION;/*!< ADC-1 Output in gain calibration when Input=FS, Ideally DAO[11:0]=7FFh */
+  __I  uint32_t  ADC2_OUT_POSITIVE_GAIN_CALIBRATION;/*!< ADC-2 Output in gain calibration when Input=FS, Ideally DAO[11:0]=7FFh */
+  
+  union {
+    __I  uint32_t  EOC;                             /*!< Conversion End Indicator                                              */
+    
+    struct {
+      __I  uint32_t  ADC2_EOC_GAIN:  1;             /*!< ADC2 EOC_GAIN signal, conversion is done                              */
+      __I  uint32_t  ADC2_EOC_OFF:  1;              /*!< ADC2 EOC_OFF signal, conversion is done                               */
+      __I  uint32_t  ADC2_EOC   :  1;               /*!< ADC2 EOC signal, conversion is done                                   */
+      __I  uint32_t  ADC1_EOC_GAIN:  1;             /*!< ADC1 EOC_GAIN signal, conversion is done                              */
+      __I  uint32_t  ADC1_EOC_OFF:  1;              /*!< ADC1 EOC_OFF signal, conversion is done                               */
+      __I  uint32_t  ADC1_EOC   :  1;               /*!< ADC1 EOC signal, conversion is done                                   */
+    } EOC_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  BUSY;                            /*!< ADC is busy                                                           */
+    
+    struct {
+      __I  uint32_t  ADC1_BUSY  :  1;               /*!< ADC1 is busy                                                          */
+      __I  uint32_t  ADC2_BUSY  :  1;               /*!< ADC2 is busy                                                          */
+    } BUSY_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  ADC1_START;                      /*!< ADC1 startup enable                                                   */
+    
+    struct {
+      __O  uint32_t  EN         :  1;               /*!< start                                                                 */
+    } ADC1_START_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  ADC1_STOP;                       /*!< ADC1 stop enable                                                      */
+    
+    struct {
+      __O  uint32_t  EN         :  1;               /*!< start                                                                 */
+    } ADC1_STOP_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint16_t  ADC1_FIFO_READ;                  /*!< ADC1 FIFO read data                                                   */
+    
+    struct {
+      __O  uint16_t  DATA       : 12;               /*!< data                                                                  */
+      __O  uint16_t  CHANNEL    :  4;               /*!< channel number                                                        */
+    } ADC1_FIFO_READ_b;                             /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED0;
+  
+  union {
+    __O  uint32_t  ADC2_START;                      /*!< ADC2 startup enable, only for single-conversion                       */
+    
+    struct {
+      __O  uint32_t  EN         :  1;               /*!< start                                                                 */
+    } ADC2_START_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  ADC2_STOP;                       /*!< ADC1 stop enable, only for single-conversion                          */
+    
+    struct {
+      __O  uint32_t  EN         :  1;               /*!< start                                                                 */
+    } ADC2_STOP_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint16_t  ADC2_FIFO_READ;                  /*!< ADC2 FIFO read data                                                   */
+    
+    struct {
+      __O  uint16_t  DATA       : 12;               /*!< data                                                                  */
+      __O  uint16_t  CHANNEL    :  4;               /*!< channel number                                                        */
+    } ADC2_FIFO_READ_b;                             /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED1;
+  
+  union {
+    __O  uint32_t  ALL_ADC_START;                   /*!< all ADCs start                                                        */
+    
+    struct {
+      __O  uint32_t  EN         :  1;               /*!< start                                                                 */
+    } ALL_ADC_START_b;                              /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  ALL_ADC_STOP;                    /*!< all ADCs stop                                                         */
+    
+    struct {
+      __O  uint32_t  EN         :  1;               /*!< start                                                                 */
+    } ALL_ADC_STOP_b;                               /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  ALL_ADC_FIFO_READ;               /*!< all ADCs FIFO read data                                               */
+    
+    struct {
+      __I  uint32_t  ADC1_DATA  : 12;               /*!< ADC1 data                                                             */
+      __I  uint32_t  ADC1_CHANNEL:  4;              /*!< ADC1 channel number                                                   */
+      __I  uint32_t  ADC2_DATA  : 12;               /*!< ADC2 data                                                             */
+      __I  uint32_t  ADC2_CHANNEL:  4;              /*!< ADC2 channel number                                                   */
+    } ALL_ADC_FIFO_READ_b;                          /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  STATUS;                          /*!< status register                                                       */
+    
+    struct {
+      __I  uint32_t  ADC1_READ_EMPTY:  1;           /*!< ADC1 read empty                                                       */
+      __I  uint32_t  ADC2_READ_EMPTY:  1;           /*!< ADC2 read empty                                                       */
+      __I  uint32_t  ADC1_READ_ALMOST_EMPTY:  1;    /*!< ADC1 read almost empty                                                */
+      __I  uint32_t  ADC2_READ_ALMOST_EMPTY:  1;    /*!< ADC2 read almost empty                                                */
+      __I  uint32_t  ADC1_WRITE_FULL:  1;           /*!< ADC1 write full                                                       */
+      __I  uint32_t  ADC2_WRITE_FULL:  1;           /*!< ADC2 write full                                                       */
+      __I  uint32_t  ADC1_WRITE_ALMOST_FULL:  1;    /*!< ADC1 write almost full                                                */
+      __I  uint32_t  ADC2_WRITE_ALMOST_FULL:  1;    /*!< ADC2 write almost full                                                */
+    } STATUS_b;                                     /*!< BitSize                                                               */
+  };
+} ADC_Type;
+
+
+/* ================================================================================ */
+/* ================                      EFUSE                     ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief EFUSE (EFUSE)
+  */
+
+typedef struct {                                    /*!< EFUSE Structure                                                       */
+  
+  union {
+    __IO uint32_t  USER_CTRL_LOW;                   /*!< low user region control                                               */
+    
+    struct {
+      __IO uint32_t  WR_EN      :  1;               /*!< write enable. 1 : write data into EFUSE. clear 0 after read           */
+      __IO uint32_t  RD_EN      :  1;               /*!< read enable. 1 : write data into EFUSE. clear 0 after read            */
+      __I  uint32_t  BUSY       :  1;               /*!< reading or writting                                                   */
+      __IO uint32_t  COMPARE_FAIL:  1;              /*!< data read isn't consist with EFUSE                                    */
+      __I  uint32_t  RD_CRC_ERR :  1;               /*!< CRC error in reading                                                  */
+      __I  uint32_t  WR_CRC_ERR :  1;               /*!< CRC error in writting                                                 */
+      __I  uint32_t  LOCK       :  1;               /*!< user region in EFUSE is locked, EFUSE can't be burn                   */
+      __IO uint32_t  TMRF       :  2;               /*!< Reference resistor select, 1200ohm is recommended                     */
+    } USER_CTRL_LOW_b;                              /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TIMING_0;                        /*!< timing 0                                                              */
+    
+    struct {
+      __IO uint32_t  TPRS       :  7;               /*!< TPRS                                                                  */
+      __IO uint32_t  TESR       :  2;               /*!< TESR                                                                  */
+      __IO uint32_t  TRC        :  4;               /*!< TRC                                                                   */
+      __IO uint32_t  TRPW       :  3;               /*!< TRPW                                                                  */
+      __IO uint32_t  TRAH       :  2;               /*!< TRAH                                                                  */
+      __IO uint32_t  TRAC       :  3;               /*!< TRAC                                                                  */
+           uint32_t             :  6;
+      __IO uint32_t  TPWPH      :  5;               /*!< TPWPH[6:2]                                                            */
+    } TIMING_0_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TIMING_1;                        /*!< timing 1                                                              */
+    
+    struct {
+      __IO uint32_t  TPWPS      :  7;               /*!< TPWPS                                                                 */
+      __IO uint32_t  TEPS       :  4;               /*!< TEPS                                                                  */
+      __IO uint32_t  TPP        : 11;               /*!< TPP                                                                   */
+      __IO uint32_t  TPIT       :  8;               /*!< TPIT                                                                  */
+      __IO uint32_t  TPWPH      :  2;               /*!< TPWPS[1:0]                                                            */
+    } TIMING_1_b;                                   /*!< BitSize                                                               */
+  };
+  __IO uint32_t  USER_DATA0_LOW;                    /*!< user data [31:0]                                                      */
+  __IO uint32_t  USER_DATA1_LOW;                    /*!< user data [63:32]                                                     */
+  __IO uint32_t  USER_DATA2_LOW;                    /*!< user data [95:64]                                                     */
+  __IO uint32_t  USER_DATA3_LOW;                    /*!< user data [127:96]                                                    */
+  
+  union {
+    __IO uint32_t  USER_DATA4_LOW;                  /*!< crc and lock bit                                                      */
+    
+    struct {
+      __IO uint32_t  LOCK       :  1;               /*!< write protection if true                                              */
+           uint32_t             : 23;
+      __IO uint32_t  CRC        :  8;               /*!< CRC                                                                   */
+    } USER_DATA4_LOW_b;                             /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED0[3];
+  
+  union {
+    __IO uint32_t  USER_CTRL_HI;                    /*!< high user region control                                              */
+    
+    struct {
+      __IO uint32_t  WR_EN      :  1;               /*!< write enable. 1 : write data into EFUSE. clear 0 after read           */
+      __IO uint32_t  RD_EN      :  1;               /*!< read enable. 1 : write data into EFUSE. clear 0 after read            */
+      __I  uint32_t  BUSY       :  1;               /*!< reading or writting                                                   */
+      __IO uint32_t  COMPARE_FAIL:  1;              /*!< data read isn't consist with EFUSE                                    */
+      __I  uint32_t  RD_CRC_ERR :  1;               /*!< CRC error in reading                                                  */
+      __I  uint32_t  WR_CRC_ERR :  1;               /*!< CRC error in writting                                                 */
+      __I  uint32_t  LOCK       :  1;               /*!< user region in EFUSE is locked, EFUSE can't be burn                   */
+      __IO uint32_t  TMRF       :  2;               /*!< Reference resistor select, 1200ohm is recommended                     */
+    } USER_CTRL_HI_b;                               /*!< BitSize                                                               */
+  };
+  __IO uint32_t  USER_DATA0_HI;                     /*!< user data [159:128]                                                   */
+  __IO uint32_t  USER_DATA1_HI;                     /*!< user data [191:160]                                                   */
+  __IO uint32_t  USER_DATA2_HI;                     /*!< user data [223:192]                                                   */
+  __IO uint32_t  USER_DATA3_HI;                     /*!< user data [255:224]                                                   */
+  
+  union {
+    __IO uint32_t  USER_DATA4_HI;                   /*!< crc and lock bit                                                      */
+    
+    struct {
+      __IO uint32_t  LOCK       :  1;               /*!< write protection if true                                              */
+           uint32_t             : 23;
+      __IO uint32_t  CRC        :  8;               /*!< CRC                                                                   */
+    } USER_DATA4_HI_b;                              /*!< BitSize                                                               */
+  };
+} EFUSE_Type;
+
+
+/* ================================================================================ */
+/* ================                      CAN0                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief CAN 0 (CAN0)
+  */
+
+typedef struct {                                    /*!< CAN0 Structure                                                        */
+  
+  union {
+    __IO uint8_t   MODE;                            /*!< mode Register                                                         */
+    
+    struct {
+      __IO uint8_t   RM         :  1;               /*!< reset mode if 1 or operation mode                                     */
+      __IO uint8_t   LOM        :  1;               /*!< Listen only mode                                                      */
+      __IO uint8_t   STM        :  1;               /*!< self test mode                                                        */
+      __IO uint8_t   AFM        :  1;               /*!< acceptance filter mode. Single filter if 1, dual filter if 0          */
+      __IO uint8_t   SM         :  1;               /*!< sleep mode                                                            */
+    } MODE_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED0[3];
+  
+  union {
+    __O  uint8_t   CMD;                             /*!< command Register                                                      */
+    
+    struct {
+      __O  uint8_t   TR         :  1;               /*!< Set to 1 when a message is to be transmitted                          */
+      __O  uint8_t   AT         :  1;               /*!< Set to 1 to cancel the next transmission request                      */
+      __O  uint8_t   RRB        :  1;               /*!< Set to 1 to release the Receive Buffer                                */
+      __O  uint8_t   CDO        :  1;               /*!< Set to 1 to clear the data overrun condition signaled by the
+                                                         Data Overrun Status bit (SR.1).                                       */
+      __O  uint8_t   SSR        :  1;               /*!< Set to 1 when a message is to be transmitted and received simultaneously */
+    } CMD_b;                                        /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED1[3];
+  
+  union {
+    __I  uint8_t   STATUS;                          /*!< status Register                                                       */
+    
+    struct {
+      __I  uint8_t   RBNE       :  1;               /*!< Receive Buffer not empty                                              */
+      __I  uint8_t   DO         :  1;               /*!< Data Overrun Status                                                   */
+      __I  uint8_t   TB_UNLOCK  :  1;               /*!< Transmit Buffer is unlocked and not in transmitting                   */
+      __I  uint8_t   TC         :  1;               /*!< Transmission complete                                                 */
+      __I  uint8_t   RXING      :  1;               /*!< receiving the data                                                    */
+      __I  uint8_t   TXING      :  1;               /*!< transmitting the data                                                 */
+      __I  uint8_t   ERR        :  1;               /*!< At least one of the error counters is more than Error Warning
+                                                         Limit Register                                                        */
+      __I  uint8_t   BUS_OFF    :  1;               /*!< in 'Bus Off' state                                                    */
+    } STATUS_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED2[3];
+  
+  union {
+    __I  uint8_t   INT;                             /*!< interrupt Register                                                    */
+    
+    struct {
+      __I  uint8_t   RBNF       :  1;               /*!< Receive Buffer not empty                                              */
+      __I  uint8_t   TB_UNLOCK  :  1;               /*!< Transmit Buffer is unlocked and not in transmitting                   */
+      __I  uint8_t   ERR        :  1;               /*!< Set on every change (set or clear) of either the Bus Status
+                                                         or Error Status bits (SR.7,SR.6)                                      */
+      __I  uint8_t   DO         :  1;               /*!< Data Overrun Status                                                   */
+      __I  uint8_t   WAKEUP     :  1;               /*!< wake-up                                                               */
+      __I  uint8_t   EP         :  1;               /*!< Set when the MCAN2 re-enters error active state after being
+                                                         in error passive state or when at least one error counter exceeds
+                                                          the protocol-defined level of 127                                    */
+      __I  uint8_t   AL         :  1;               /*!< Set when the MCAN2 loses arbitration and becomes a receiver           */
+      __I  uint8_t   BUS_ERR    :  1;               /*!< Set when the MCAN2 detects an error on the CAN-bus                    */
+    } INT_b;                                        /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED3[3];
+  
+  union {
+    __IO uint8_t   INT_EN;                          /*!< interrupt enabled Register                                            */
+    
+    struct {
+      __I  uint8_t   RBNF       :  1;               /*!< Receive Buffer not empty                                              */
+      __I  uint8_t   TB_UNLOCK  :  1;               /*!< Transmit Buffer is unlocked and not in transmitting                   */
+      __I  uint8_t   ERR        :  1;               /*!< Set on every change (set or clear) of either the Bus Status
+                                                         or Error Status bits (SR.7,SR.6)                                      */
+      __I  uint8_t   DO         :  1;               /*!< Data Overrun Status                                                   */
+      __I  uint8_t   WAKEUP     :  1;               /*!< wake-up                                                               */
+      __I  uint8_t   EP         :  1;               /*!< Set when the MCAN2 re-enters error active state after being
+                                                         in error passive state or when at least one error counter exceeds
+                                                          the protocol-defined level of 127                                    */
+      __I  uint8_t   AL         :  1;               /*!< Set when the MCAN2 loses arbitration and becomes a receiver           */
+      __I  uint8_t   BUS_ERR    :  1;               /*!< Set when the MCAN2 detects an error on the CAN-bus                    */
+    } INT_EN_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED4[7];
+  
+  union {
+    __IO uint8_t   BTR0;                            /*!< Bus Timing 0                                                          */
+    
+    struct {
+      __IO uint8_t   BRP        :  6;               /*!< TQ =2 x Txtal1 x (32 x BRP.5 + 16 x BRP.4 + 8 x BRP.3 + 4 x
+                                                         BRP.2 + 2 x BRP.1 + BRP.0 + 1)                                        */
+      __IO uint8_t   SJW        :  2;               /*!< the maximum number of time quanta of sync segment                     */
+    } BTR0_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED5[3];
+  
+  union {
+    __IO uint8_t   BTR1;                            /*!< Bus Timing 1                                                          */
+    
+    struct {
+      __IO uint8_t   TSEG1      :  4;               /*!< the maximum number of time quanta of propagation and 1st phase
+                                                         segment                                                               */
+      __IO uint8_t   TSEG2      :  3;               /*!< the maximum number of time quanta of 2nd phase segment                */
+      __IO uint8_t   SAM        :  1;               /*!< sample times. Sample 3 times if 1, once if 0                          */
+    } BTR1_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED6[3];
+  
+  union {
+    __IO uint8_t   OCR;                             /*!< Output Control Register                                               */
+    
+    struct {
+      __IO uint8_t   MODE       :  2;               /*!< output control mode                                                   */
+    } OCR_b;                                        /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED7[11];
+  
+  union {
+    __I  uint8_t   ALC;                             /*!< Arbitration Lost Capture                                              */
+    
+    struct {
+      __I  uint8_t   BIT        :  5;               /*!< the current position of the Bit Processor when bus arbitration
+                                                         lost, 1st bit (ID.28) if 0                                            */
+    } ALC_b;                                        /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED8[3];
+  
+  union {
+    __I  uint8_t   ECC;                             /*!< Error Code Capture                                                    */
+    
+    struct {
+      __I  uint8_t   SEGMENT    :  5;               /*!< segment code                                                          */
+      __I  uint8_t   DIRECTION  :  1;               /*!< If 1, the error occurred during reception. If 0, the error occurred
+                                                         during transmission                                                   */
+      __I  uint8_t   ERR        :  2;               /*!< error code                                                            */
+    } ECC_b;                                        /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED9[3];
+  __IO uint8_t   EWLR;                              /*!< Error Warning Limit                                                   */
+  __I  uint8_t   RESERVED10[3];
+  __IO uint8_t   RXERR;                             /*!< Receive Error Counter                                                 */
+  __I  uint8_t   RESERVED11[3];
+  __IO uint8_t   TXERR;                             /*!< Transmit Error Counter                                                */
+  __I  uint8_t   RESERVED12[3];
+  
+  union {
+    __IO uint8_t   FI_OR_ACR0;                      /*!< Transmit Frame Information if writting or Receive Frame Information
+                                                         if reading, ACR[0] if reset mode                                      */
+    
+    struct {
+      __IO uint8_t   DLC        :  4;               /*!< byte number in the data                                               */
+           uint8_t              :  2;
+      __IO uint8_t   RTR        :  1;               /*!< 1 indicates a remote frame; 0 indicates a data frame                  */
+      __IO uint8_t   FF         :  1;               /*!< 1 selects Extended Frame Format (EFF); 0 selects Standard Frame
+                                                         Format (SFF)                                                          */
+    } FI_OR_ACR0_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint8_t   RESERVED13[3];
+  __IO uint8_t   DI0_OR_ACR1;                       /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading, ACR[1] if reset mode                                      */
+  __I  uint8_t   RESERVED14[3];
+  __IO uint8_t   DI1_OR_ACR2;                       /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading, ACR[2] if reset mode                                      */
+  __I  uint8_t   RESERVED15[3];
+  __IO uint8_t   DI2_OR_ACR3;                       /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading, ACR[3] if reset mode                                      */
+  __I  uint8_t   RESERVED16[3];
+  __IO uint8_t   DI3_OR_AMR0;                       /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading, AMR[0] if reset mode                                      */
+  __I  uint8_t   RESERVED17[3];
+  __IO uint8_t   DI4_OR_AMR1;                       /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading, AMR[1] if reset mode                                      */
+  __I  uint8_t   RESERVED18[3];
+  __IO uint8_t   DI5_OR_AMR2;                       /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading, AMR[2] if reset mode                                      */
+  __I  uint8_t   RESERVED19[3];
+  __IO uint8_t   DI6_OR_AMR3;                       /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading, AMR[3] if reset mode                                      */
+  __I  uint8_t   RESERVED20[3];
+  __IO uint8_t   DI7;                               /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading                                                            */
+  __I  uint8_t   RESERVED21[3];
+  __IO uint8_t   DI8;                               /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading                                                            */
+  __I  uint8_t   RESERVED22[3];
+  __IO uint8_t   DI9;                               /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading                                                            */
+  __I  uint8_t   RESERVED23[3];
+  __IO uint8_t   DI10;                              /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading                                                            */
+  __I  uint8_t   RESERVED24[3];
+  __IO uint8_t   DI11;                              /*!< Transmit data Information if writting or Receive data Information
+                                                         if reading                                                            */
+  __I  uint8_t   RESERVED25[3];
+  __IO uint8_t   RMC;                               /*!< Receive Message Counter                                               */
+  __I  uint8_t   RESERVED26[7];
+  
+  union {
+    __IO uint8_t   CDR;                             /*!< Clock Divider Register                                                */
+    
+    struct {
+      __IO uint8_t   DIVIDER    :  3;               /*!< divider of XTAL1                                                      */
+      __IO uint8_t   OFF        :  1;               /*!< disable XTAL1                                                         */
+    } CDR_b;                                        /*!< BitSize                                                               */
+  };
+} CAN0_Type;
+
+
+/* ================================================================================ */
+/* ================                       DMA                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief DMA (DMA)
+  */
+
+typedef struct {                                    /*!< DMA Structure                                                         */
+  __IO uint32_t  SAR0;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED0;
+  __IO uint32_t  DAR0;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED1;
+  
+  union {
+    __IO uint32_t  LLP0;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP0_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED2;
+  
+  union {
+    __IO uint32_t  CTL_LOW0;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW0_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI0;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI0_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT0;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED3;
+  __IO uint32_t  DSTAT0;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED4;
+  __IO uint32_t  SSTATAR0;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED5;
+  __IO uint32_t  DSTATAR0;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED6;
+  
+  union {
+    __IO uint32_t  CFG_LOW0;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW0_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI0;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI0_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR0;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR0_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED7;
+  
+  union {
+    __IO uint32_t  DSR0;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR0_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED8;
+  __IO uint32_t  SAR1;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED9;
+  __IO uint32_t  DAR1;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED10;
+  
+  union {
+    __IO uint32_t  LLP1;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP1_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED11;
+  
+  union {
+    __IO uint32_t  CTL_LOW1;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW1_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI1;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI1_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT1;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED12;
+  __IO uint32_t  DSTAT1;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED13;
+  __IO uint32_t  SSTATAR1;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED14;
+  __IO uint32_t  DSTATAR1;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED15;
+  
+  union {
+    __IO uint32_t  CFG_LOW1;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW1_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI1;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI1_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR1;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR1_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED16;
+  
+  union {
+    __IO uint32_t  DSR1;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR1_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED17;
+  __IO uint32_t  SAR2;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED18;
+  __IO uint32_t  DAR2;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED19;
+  
+  union {
+    __IO uint32_t  LLP2;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP2_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED20;
+  
+  union {
+    __IO uint32_t  CTL_LOW2;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW2_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI2;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI2_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT2;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED21;
+  __IO uint32_t  DSTAT2;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED22;
+  __IO uint32_t  SSTATAR2;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED23;
+  __IO uint32_t  DSTATAR2;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED24;
+  
+  union {
+    __IO uint32_t  CFG_LOW2;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW2_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI2;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI2_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR2;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR2_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED25;
+  
+  union {
+    __IO uint32_t  DSR2;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR2_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED26;
+  __IO uint32_t  SAR3;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED27;
+  __IO uint32_t  DAR3;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED28;
+  
+  union {
+    __IO uint32_t  LLP3;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP3_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED29;
+  
+  union {
+    __IO uint32_t  CTL_LOW3;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW3_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI3;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI3_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT3;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED30;
+  __IO uint32_t  DSTAT3;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED31;
+  __IO uint32_t  SSTATAR3;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED32;
+  __IO uint32_t  DSTATAR3;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED33;
+  
+  union {
+    __IO uint32_t  CFG_LOW3;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW3_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI3;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI3_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR3;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR3_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED34;
+  
+  union {
+    __IO uint32_t  DSR3;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR3_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED35;
+  __IO uint32_t  SAR4;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED36;
+  __IO uint32_t  DAR4;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED37;
+  
+  union {
+    __IO uint32_t  LLP4;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP4_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED38;
+  
+  union {
+    __IO uint32_t  CTL_LOW4;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW4_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI4;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI4_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT4;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED39;
+  __IO uint32_t  DSTAT4;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED40;
+  __IO uint32_t  SSTATAR4;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED41;
+  __IO uint32_t  DSTATAR4;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED42;
+  
+  union {
+    __IO uint32_t  CFG_LOW4;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW4_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI4;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI4_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR4;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR4_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED43;
+  
+  union {
+    __IO uint32_t  DSR4;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR4_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED44;
+  __IO uint32_t  SAR5;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED45;
+  __IO uint32_t  DAR5;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED46;
+  
+  union {
+    __IO uint32_t  LLP5;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP5_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED47;
+  
+  union {
+    __IO uint32_t  CTL_LOW5;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW5_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI5;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI5_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT5;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED48;
+  __IO uint32_t  DSTAT5;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED49;
+  __IO uint32_t  SSTATAR5;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED50;
+  __IO uint32_t  DSTATAR5;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED51;
+  
+  union {
+    __IO uint32_t  CFG_LOW5;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW5_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI5;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI5_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR5;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR5_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED52;
+  
+  union {
+    __IO uint32_t  DSR5;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR5_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED53;
+  __IO uint32_t  SAR6;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED54;
+  __IO uint32_t  DAR6;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED55;
+  
+  union {
+    __IO uint32_t  LLP6;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP6_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED56;
+  
+  union {
+    __IO uint32_t  CTL_LOW6;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW6_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI6;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI6_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT6;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED57;
+  __IO uint32_t  DSTAT6;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED58;
+  __IO uint32_t  SSTATAR6;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED59;
+  __IO uint32_t  DSTATAR6;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED60;
+  
+  union {
+    __IO uint32_t  CFG_LOW6;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW6_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI6;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI6_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR6;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR6_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED61;
+  
+  union {
+    __IO uint32_t  DSR6;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR6_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED62;
+  __IO uint32_t  SAR7;                              /*!< Current Source Address of DMA transfer                                */
+  __I  uint32_t  RESERVED63;
+  __IO uint32_t  DAR7;                              /*!< Current Destination Address of DMA transfer                           */
+  __I  uint32_t  RESERVED64;
+  
+  union {
+    __IO uint32_t  LLP7;                            /*!< Linked List Pointer Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  LMS        :  2;               /*!< Identifies the AHB layer/interface where the memory device that
+                                                         stores the next linked list item resides.                             */
+      __IO uint32_t  LOC        : 30;               /*!< Starting Address In Memory of next LLI if block chaining is
+                                                         enabled                                                               */
+    } LLP7_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED65;
+  
+  union {
+    __IO uint32_t  CTL_LOW7;                        /*!< Lower 32-bits Control Register for Channel                            */
+    
+    struct {
+      __IO uint32_t  INT_EN     :  1;               /*!< Interrupt Enable Bit                                                  */
+      __IO uint32_t  DST_TR_WIDTH:  3;              /*!< Destination Transfer Width                                            */
+      __IO uint32_t  SRC_TR_WIDTH:  3;              /*!< Source Transfer Width                                                 */
+      __IO uint32_t  DINC       :  2;               /*!< Destination Address Increment                                         */
+      __IO uint32_t  SINC       :  2;               /*!< Source Address Increment                                              */
+      __IO uint32_t  DEST_MSIZE :  3;               /*!< Destination Burst Transaction Length                                  */
+      __IO uint32_t  SRC_MSIZE  :  3;               /*!< Source Burst Transaction Length                                       */
+      __IO uint32_t  SRC_GATHER_EN:  1;             /*!< Source gather enable bit                                              */
+      __IO uint32_t  DST_SCATTER_EN:  1;            /*!< Destination scatter enable bit                                        */
+           uint32_t             :  1;
+      __IO uint32_t  TT_FC      :  3;               /*!< Transfer Type and Flow Control                                        */
+      __IO uint32_t  DMS        :  2;               /*!< Destination Master Select                                             */
+      __IO uint32_t  SMS        :  2;               /*!< Source Master Select                                                  */
+      __IO uint32_t  LLP_DST_EN :  1;               /*!< Block chaining is enabled on the destination side                     */
+      __IO uint32_t  LLP_SRC_EN :  1;               /*!< Block chaining is enabled on the source side                          */
+    } CTL_LOW7_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CTL_HI7;                         /*!< Higher 32-bits Control Register for Channel                           */
+    
+    struct {
+      __IO uint32_t  BLOCK_TS   : 12;               /*!< indicates the total number of single transactions to perform
+                                                         for every block transfer                                              */
+      __IO uint32_t  DONE       :  1;               /*!< a block transfer is complete                                          */
+    } CTL_HI7_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  SSTAT7;                            /*!< Source Status Register for Channel                                    */
+  __I  uint32_t  RESERVED66;
+  __IO uint32_t  DSTAT7;                            /*!< Destination Status Register for Channel                               */
+  __I  uint32_t  RESERVED67;
+  __IO uint32_t  SSTATAR7;                          /*!< Source Status Address Register for Channel                            */
+  __I  uint32_t  RESERVED68;
+  __IO uint32_t  DSTATAR7;                          /*!< Destination Status Address Register for Channel                       */
+  __I  uint32_t  RESERVED69;
+  
+  union {
+    __IO uint32_t  CFG_LOW7;                        /*!< Lower 32-bit Configuration Register for Channel                       */
+    
+    struct {
+           uint32_t             :  5;
+      __IO uint32_t  CH_PRIOR   :  3;               /*!< Channel priority. A priority of 7 is the highest priority             */
+      __IO uint32_t  CH_SUSP    :  1;               /*!< Suspends all DMA data transfers from the source until this bit
+                                                         is cleared.                                                           */
+      __I  uint32_t  FIFO_EMPTY :  1;               /*!< Indicates if there is data left in the channel FIFO                   */
+      __IO uint32_t  HS_SEL_DST :  1;               /*!< If Destination Software handshaking interface                         */
+      __IO uint32_t  HS_SEL_SRC :  1;               /*!< If Source Software handshaking interface                              */
+      __IO uint32_t  LOCK_CH_L  :  2;               /*!< Indicates the duration over which CFGx.LOCK_CH bit applies.           */
+      __IO uint32_t  LOCK_B_L   :  2;               /*!< Indicates the duration over which CFGx.LOCK_B bit applies.            */
+      __IO uint32_t  LOCK_CH    :  1;               /*!< Channel Lock Bit                                                      */
+      __IO uint32_t  LOCK_B     :  1;               /*!< Bus Lock Bit                                                          */
+      __IO uint32_t  DST_HS_POL :  1;               /*!< Destination Handshaking Interface Polarity. 0: active high            */
+      __IO uint32_t  SRC_HS_POL :  1;               /*!< Source Handshaking Interface Polarity. 0: active high                 */
+      __IO uint32_t  MAX_ABRST  : 10;               /*!< Maximum AMBA Burst Length                                             */
+      __IO uint32_t  RELOAD_SRC :  1;               /*!< Automatic Source Reload                                               */
+      __IO uint32_t  RELOAD_DST :  1;               /*!< Automatic Destination Reload                                          */
+    } CFG_LOW7_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CFG_HI7;                         /*!< Higher 32-bit Configuration Register for Channel                      */
+    
+    struct {
+      __IO uint32_t  FCMODE     :  1;               /*!< if source transaction requests aren't serviced when the Destination
+                                                         Peripheral is the flow controller.                                    */
+      __IO uint32_t  FIFO_MODE  :  1;               /*!< Determines space or data needs to be available in the FIFO before
+                                                         a burst transaction request is serviced.                              */
+      __IO uint32_t  PROTCTL    :  3;               /*!< There is a one-to-one mapping of these register bits to the
+                                                         HPROT[3:1] master interface signals                                   */
+      __IO uint32_t  DS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+      __IO uint32_t  SS_UPD_EN  :  1;               /*!< STATx is only updated from STATARx                                    */
+    } CFG_HI7_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  SGR7;                            /*!< Source Gather Register for Channel                                    */
+    
+    struct {
+      __IO uint32_t  SGI        : 20;               /*!< Source gather interval                                                */
+      __IO uint32_t  SGC        : 12;               /*!< Specifies the number of contiguous source transfers of CTLx.SRC_TR_WIDTH */
+    } SGR7_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED70;
+  
+  union {
+    __IO uint32_t  DSR7;                            /*!< Destination Scatter Register for Channel                              */
+    
+    struct {
+      __IO uint32_t  DSI        : 20;               /*!< Destination scatter interval                                          */
+      __IO uint32_t  DSC        : 12;               /*!< Specifies the number of contiguous destination transfers of
+                                                         CTLx.DST_TR_WIDTH                                                     */
+    } DSR7_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED71[11];
+  __I  uint8_t   INT_TFR;                           /*!< DMA Transfer Complete                                                 */
+  __I  uint8_t   RESERVED72[7];
+  __I  uint8_t   INT_BLOCK;                         /*!< Block Transfer Complete                                               */
+  __I  uint8_t   RESERVED73[7];
+  __I  uint8_t   INT_SRC_TRAN;                      /*!< Source Transaction Complete                                           */
+  __I  uint8_t   RESERVED74[7];
+  __I  uint8_t   INT_DST_TRAN;                      /*!< Destination Transaction Complete                                      */
+  __I  uint8_t   RESERVED75[7];
+  __I  uint8_t   INT_ERR;                           /*!< Error                                                                 */
+  __I  uint8_t   RESERVED76[7];
+  
+  union {
+    __IO uint16_t  INT_EN_TFR;                      /*!< DMA Transfer Complete                                                 */
+    
+    struct {
+      __IO uint16_t  EN         :  8;               /*!< interrupt enable                                                      */
+      __IO uint16_t  WE         :  8;               /*!< interrupt enable write enable                                         */
+    } INT_EN_TFR_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED77[3];
+  
+  union {
+    __IO uint16_t  INT_EN_BLOCK;                    /*!< Block Transfer Complete                                               */
+    
+    struct {
+      __IO uint16_t  EN         :  8;               /*!< interrupt enable                                                      */
+      __IO uint16_t  WE         :  8;               /*!< interrupt enable write enable                                         */
+    } INT_EN_BLOCK_b;                               /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED78[3];
+  
+  union {
+    __IO uint16_t  INT_EN_SRC_TRAN;                 /*!< Source Transaction Complete                                           */
+    
+    struct {
+      __IO uint16_t  EN         :  8;               /*!< interrupt enable                                                      */
+      __IO uint16_t  WE         :  8;               /*!< interrupt enable write enable                                         */
+    } INT_EN_SRC_TRAN_b;                            /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED79[3];
+  
+  union {
+    __IO uint16_t  INT_EN_DST_TRAN;                 /*!< Destination Transaction Complete                                      */
+    
+    struct {
+      __IO uint16_t  EN         :  8;               /*!< interrupt enable                                                      */
+      __IO uint16_t  WE         :  8;               /*!< interrupt enable write enable                                         */
+    } INT_EN_DST_TRAN_b;                            /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED80[3];
+  
+  union {
+    __IO uint16_t  INT_EN_ERR;                      /*!< Error                                                                 */
+    
+    struct {
+      __IO uint16_t  EN         :  8;               /*!< interrupt enable                                                      */
+      __IO uint16_t  WE         :  8;               /*!< interrupt enable write enable                                         */
+    } INT_EN_ERR_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint16_t  RESERVED81[3];
+  __O  uint8_t   INT_CLEAR_TFR;                     /*!< DMA Transfer Complete                                                 */
+  __I  uint8_t   RESERVED82[7];
+  __O  uint8_t   INT_CLEAR_BLOCK;                   /*!< Block Transfer Complete                                               */
+  __I  uint8_t   RESERVED83[7];
+  __O  uint8_t   INT_CLEAR_SRC_TRAN;                /*!< Source Transaction Complete                                           */
+  __I  uint8_t   RESERVED84[7];
+  __O  uint8_t   INT_CLEAR_DST_TRAN;                /*!< Destination Transaction Complete                                      */
+  __I  uint8_t   RESERVED85[7];
+  __O  uint8_t   INT_CLEAR_ERR;                     /*!< Error                                                                 */
+  __I  uint8_t   RESERVED86[63];
+  
+  union {
+    __IO uint32_t  DMA_EN;                          /*!< DW_ahb_dmac Configuration Register                                    */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< enable                                                                */
+    } DMA_EN_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED87;
+  
+  union {
+    __IO uint32_t  CH_EN;                           /*!< DW_ahb_dmac Channel Enable Register                                   */
+    
+    struct {
+      __IO uint32_t  EN         :  8;               /*!< enable                                                                */
+      __IO uint32_t  WE         :  8;               /*!< enable write enable                                                   */
+    } CH_EN_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED88[10];
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_6_HI;            /*!< Component Parameters for channel 7                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_6_HI_b;                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_5_LOW;           /*!< Component Parameters for channel 6                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_5_LOW_b;                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_5_HI;            /*!< Component Parameters for channel 5                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_5_HI_b;                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_4_LOW;           /*!< Component Parameters for channel 4                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_4_LOW_b;                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_4_HI;            /*!< Component Parameters for channel 3                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_4_HI_b;                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_3_LOW;           /*!< Component Parameters for channel 2                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_3_LOW_b;                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_3_HI;            /*!< Component Parameters for channel 1                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_3_HI_b;                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_2_LOW;           /*!< Component Parameters for channel 0                                    */
+    
+    struct {
+      __I  uint32_t  DTW        :  3;               /*!< If this is not hardcoded, then software can program the destination
+                                                         transfer width.                                                       */
+      __I  uint32_t  STW        :  3;               /*!< If this is not hardcoded, then software can program the source
+                                                         transfer width.                                                       */
+      __I  uint32_t  STAT_DST   :  1;               /*!< If destination status load feature is on                              */
+      __I  uint32_t  STAT_SRC   :  1;               /*!< If source status load feature is on                                   */
+      __I  uint32_t  DST_SCA_EN :  1;               /*!< If destination scatter feature is on                                  */
+      __I  uint32_t  SRC_GAT_EN :  1;               /*!< If source gather feature is on                                        */
+      __I  uint32_t  LOCK_EN    :  1;               /*!< If channel lock feature is on                                         */
+      __I  uint32_t  MULTI_BLK_EN:  1;              /*!< If multi blocks transfer feature is on                                */
+      __I  uint32_t  CTL_WB_EN  :  1;               /*!< If write back initial values to relative registers feature is
+                                                         on                                                                    */
+      __I  uint32_t  HC_LLP     :  1;               /*!< If disable LLP feature is on                                          */
+           uint32_t             :  2;
+      __I  uint32_t  MAX_MULT_SIZE:  3;             /*!< Maximum value of burst transaction size (SRC_MSIZE and DEST_MSIZE).   */
+      __I  uint32_t  DMS        :  3;               /*!< Destination AHB dma interface                                         */
+      __I  uint32_t  LMS        :  3;               /*!< Linked list AHB dma interface                                         */
+      __I  uint32_t  SMS        :  3;               /*!< source AHB dma interface                                              */
+      __I  uint32_t  FIFO_DEPTH :  3;               /*!< FIFO depth in bytes                                                   */
+    } DMA_COMP_PARAMS_2_LOW_b;                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED89;
+  
+  union {
+    __I  uint32_t  DMA_COMP_PARAMS_1_LOW;           /*!< Maximum block size for channel                                        */
+    
+    struct {
+      __I  uint32_t  CH0_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 0.                                     */
+      __I  uint32_t  CH1_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 1                                      */
+      __I  uint32_t  CH2_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 2                                      */
+      __I  uint32_t  CH3_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 3                                      */
+      __I  uint32_t  CH4_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 4                                      */
+      __I  uint32_t  CH5_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 5                                      */
+      __I  uint32_t  CH6_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 6                                      */
+      __I  uint32_t  CH7_MAX_BLK_SIZE:  4;          /*!< Maximum block size for channel 7                                      */
+    } DMA_COMP_PARAMS_1_LOW_b;                      /*!< BitSize                                                               */
+  };
+} DMA_Type;
+
+
+/* ================================================================================ */
+/* ================                       ETH                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief ETH (ETH)
+  */
+
+typedef struct {                                    /*!< ETH Structure                                                         */
+  
+  union {
+    __IO uint32_t  CONFIG;                          /*!< MAC Configuration Register                                            */
+    
+    struct {
+      __IO uint32_t  PRELEN     :  2;               /*!< Preamble Length for Transmit frames                                   */
+      __IO uint32_t  RX_EN      :  1;               /*!< Receiver Enable                                                       */
+      __IO uint32_t  TX_EN      :  1;               /*!< Transmitter Enable                                                    */
+      __IO uint32_t  DC_EN      :  1;               /*!< Deferral Check Enable                                                 */
+           uint32_t             :  2;
+      __IO uint32_t  ACS        :  1;               /*!< Automatic Pad or CRC Stripping                                        */
+      __IO uint32_t  LUD        :  1;               /*!< Link Up or Down                                                       */
+           uint32_t             :  1;
+      __IO uint32_t  IPC        :  1;               /*!< Checksum Offload                                                      */
+      __IO uint32_t  DM         :  1;               /*!< Duplex Mode                                                           */
+      __IO uint32_t  LM         :  1;               /*!< Loopback Mode                                                         */
+           uint32_t             :  1;
+      __IO uint32_t  FES        :  1;               /*!< Speed in XMII interface                                               */
+      __IO uint32_t  PS         :  1;               /*!< the Ethernet line speed                                               */
+           uint32_t             :  4;
+      __IO uint32_t  JE         :  1;               /*!< Jumbo enable                                                          */
+           uint32_t             :  1;
+      __IO uint32_t  JD         :  1;               /*!< if 0, the MAC cuts off the transmitter if more than 2,048 bytes
+                                                         of data (10,240 if JE is set high)                                    */
+      __IO uint32_t  WD         :  1;               /*!< Watchdog Disable                                                      */
+      __IO uint32_t  TC         :  1;               /*!< If 1, this bit enables the transmission of duplex mode, link
+                                                         speed, and link up or down information to the PHY                     */
+      __IO uint32_t  CST        :  1;               /*!< CRC Stripping for Type Frames                                         */
+           uint32_t             :  1;
+      __IO uint32_t  TWOKPE     :  1;               /*!< If 0, 1518 bytes is considered as a giant frame, 1 is 2000 bytes.     */
+      __IO uint32_t  SARC       :  3;               /*!< Source Address Insertion or Replacement Control                       */
+    } CONFIG_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  FF;                              /*!< MAC Frame Filter                                                      */
+    
+    struct {
+      __IO uint32_t  PR         :  1;               /*!< Receive all frames in spite of source and destination address         */
+      __IO uint32_t  HUC        :  1;               /*!< if 1, don't compare DA field in destination address filtering
+                                                         of unicast frames with DA register                                    */
+      __IO uint32_t  HMC        :  1;               /*!< if 1, don't compare DA field in destination address filtering
+                                                         of multicast frames with DA register                                  */
+      __IO uint32_t  DAIF       :  1;               /*!< if set, the Address Check block operates in inverse filtering
+                                                         mode for the DA address comparison                                    */
+      __IO uint32_t  PM         :  1;               /*!< Pass All Multicast                                                    */
+      __IO uint32_t  DBF        :  1;               /*!< Disable Broadcast Frames                                              */
+      __IO uint32_t  PCF        :  2;               /*!< Pass Control Frames                                                   */
+      __IO uint32_t  SAIF       :  1;               /*!< If set, the frames whose SA matches the SA registers are marked
+                                                         as failing the SA Address filter                                      */
+      __IO uint32_t  SAF        :  1;               /*!< Source Address Filter Enable                                          */
+      __IO uint32_t  HPF        :  1;               /*!< Hash or Perfect Filter                                                */
+           uint32_t             :  5;
+      __IO uint32_t  VTFE       :  1;               /*!< VLAN Tag Filter Enable                                                */
+           uint32_t             :  3;
+      __IO uint32_t  IPFE       :  1;               /*!< Layer 3 and Layer 4 Filter Enable                                     */
+      __IO uint32_t  DNTU       :  1;               /*!< Drop non-TCP/UDP over IP Frames                                       */
+           uint32_t             :  9;
+      __IO uint32_t  RA         :  1;               /*!< Receive all                                                           */
+    } FF_b;                                         /*!< BitSize                                                               */
+  };
+  __IO uint32_t  HTH;                               /*!< Hash Table High Register                                              */
+  __IO uint32_t  HTL;                               /*!< Hash Table Low Register                                               */
+  
+  union {
+    __IO uint32_t  GMII_ADDR;                       /*!< GMII Address Register                                                 */
+    
+    struct {
+      __IO uint32_t  BUSY       :  1;               /*!< GMII Busy                                                             */
+      __IO uint32_t  GW         :  1;               /*!< GMII write or read                                                    */
+      __IO uint32_t  CR         :  4;               /*!< CSR Clock Range                                                       */
+      __IO uint32_t  GR         :  5;               /*!< These bits select the desired GMII register in the selected
+                                                         PHY device                                                            */
+      __IO uint32_t  PA         :  5;               /*!< This field indicates which of the 32 possible PHY devices are
+                                                         being accessed                                                        */
+    } GMII_ADDR_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  GMII_DATA;                         /*!< GMII Data Register                                                    */
+  
+  union {
+    __IO uint32_t  FC;                              /*!< Flow Control Register                                                 */
+    
+    struct {
+      __IO uint32_t  FCB        :  1;               /*!< This bit initiates a Pause frame in the full-duplex mode              */
+      __IO uint32_t  TFE        :  1;               /*!< MAC enables the flow control operation to transmit Pause frames       */
+      __IO uint32_t  RFE        :  1;               /*!< MAC enables the flow control operation to receive Pause frames        */
+      __IO uint32_t  UP         :  1;               /*!< MAC can detect Pause frames with unicast address of the station       */
+    } FC_b;                                         /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  VLAN_TAG;                        /*!< VLAN Tag Register                                                     */
+    
+    struct {
+      __IO uint32_t  VL         : 16;               /*!< VLAN Tag Identifier for Receive Frames                                */
+      __IO uint32_t  ETV        :  1;               /*!< Enable 12-Bit VLAN Tag Comparison                                     */
+      __IO uint32_t  VTIM       :  1;               /*!< If set, The frames that do not have matching VLAN Tag are marked
+                                                         as matched                                                            */
+      __IO uint32_t  ESVL       :  1;               /*!< If set, consider the S-VLAN (Type = 0x88A8) frames as valid
+                                                         VLAN tagged frames                                                    */
+      __IO uint32_t  VTHM       :  1;               /*!< When set, the most significant four bits of the VLAN tag's CRC
+                                                         are used to index the content                                         */
+    } VLAN_TAG_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED0[2];
+  __IO uint32_t  RWUFFR;                            /*!< Remote Wake-Up Frame Filter Register                                  */
+  
+  union {
+    __IO uint32_t  PMTCSR;                          /*!< PMT Control and Status Register                                       */
+    
+    struct {
+      __IO uint32_t  PWRDWN     :  1;               /*!< Power Down                                                            */
+      __IO uint32_t  MGKPKTEN   :  1;               /*!< Magic Packet Enable                                                   */
+      __IO uint32_t  RWKPKTEN   :  1;               /*!< Remote Wake-Up Frame Enable                                           */
+           uint32_t             :  2;
+      __IO uint32_t  MGKPRCVD   :  1;               /*!< the power management event is generated because of the reception
+                                                         of a magic packet                                                     */
+      __IO uint32_t  RWKPRCVD   :  1;               /*!< When set, this bit indicates the power management event is generated
+                                                         because of the reception of a remote wake-up frame                    */
+           uint32_t             :  2;
+      __IO uint32_t  GLBLUCAST  :  1;               /*!< When set, enables any unicast packet filtered by the MAC (DAF)address
+                                                         recognition to be a remote wake-up frame.                             */
+           uint32_t             : 14;
+      __IO uint32_t  RWKPTR     :  3;               /*!< Remote Wake-up FIFO Pointer                                           */
+           uint32_t             :  4;
+      __IO uint32_t  RWKFILTRST :  1;               /*!< Remote Wake-Up Frame Filter Register Pointer Reset.                   */
+    } PMTCSR_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED1[2];
+  __IO uint32_t  MACISR;                            /*!< Interrupt Status Register                                             */
+  __IO uint32_t  MACIMR;                            /*!< Interrupt Mask Register                                               */
+  __IO uint16_t  ADDR0_HIGH;                        /*!< MAC Address0 High Register                                            */
+  __I  uint16_t  RESERVED2;
+  __IO uint32_t  ADDR0_LOW;                         /*!< MAC Address0 LOW Register                                             */
+  
+  union {
+    __IO uint32_t  ADDR1_HIGH;                      /*!< MAC Address0 High Register                                            */
+    
+    struct {
+      __IO uint32_t  ADDR       : 16;               /*!< MAC Address1 [47:32]                                                  */
+           uint32_t             : 14;
+      __IO uint32_t  SA         :  1;               /*!< MAC address1 is source or destination address compared with
+                                                         received frame                                                        */
+      __IO uint32_t  AE         :  1;               /*!< the address filter module uses the MAC address1 for filtering         */
+    } ADDR1_HIGH_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  ADDR1_LOW;                         /*!< MAC Address1 LOW Register                                             */
+  __I  uint32_t  RESERVED3[44];
+  
+  union {
+    __IO uint32_t  MMCCR;                           /*!< MMC Control Register                                                  */
+    
+    struct {
+      __IO uint32_t  CNTRST     :  1;               /*!< Counters Reset                                                        */
+      __IO uint32_t  CNTSTOPRO  :  1;               /*!< Counter Stop Rollover                                                 */
+      __IO uint32_t  RSTONRD    :  1;               /*!< Reset on Read                                                         */
+      __IO uint32_t  CNTFREEZ   :  1;               /*!< MMC Counter Freeze                                                    */
+      __IO uint32_t  CNTPRST    :  1;               /*!< Counters Preset                                                       */
+      __IO uint32_t  CNTPRSTLVL :  1;               /*!< Counters Preset                                                       */
+           uint32_t             :  2;
+      __IO uint32_t  UCDBC      :  1;               /*!< Update MMC Counters for Dropped Broadcast Frames                      */
+    } MMCCR_b;                                      /*!< BitSize                                                               */
+  };
+  __IO uint32_t  MMCRIR;                            /*!< MMC Receive Interrupt Register                                        */
+  __IO uint32_t  MMCTIR;                            /*!< MMC Transmit Interrupt Register                                       */
+  __IO uint32_t  MMCRIMR;                           /*!< MMC Receive interrupt mask                                            */
+  __IO uint32_t  MMCTIMR;                           /*!< MMC Transmit Interrupt Mask                                           */
+  __I  uint32_t  RESERVED4[59];
+  __IO uint32_t  MMCIRCOIM;                         /*!< MMC IPC Receive Checksum Offload Interrupt Mask                       */
+  __I  uint32_t  RESERVED5[319];
+  
+  union {
+    __IO uint32_t  PTPTSCR;                         /*!< Timestamp Control Register                                            */
+    
+    struct {
+      __IO uint32_t  TSENA      :  1;               /*!< Timestamp Enable                                                      */
+      __IO uint32_t  TSCFUPDT   :  1;               /*!< Timestamp Fine or Coarse Update                                       */
+      __IO uint32_t  TSINIT     :  1;               /*!< Timestamp Initialize                                                  */
+      __IO uint32_t  TSUPDT     :  1;               /*!< Timestamp Update                                                      */
+      __IO uint32_t  TSTRIG     :  1;               /*!< Timestamp Interrupt Trigger Enable                                    */
+      __IO uint32_t  TSADDREG   :  1;               /*!< Addend Reg Update                                                     */
+    } PTPTSCR_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint32_t  PTPSSIR;                           /*!< Sub-Second Increment Register                                         */
+  __IO uint32_t  PTPTSHR;                           /*!< System Time Seconds Register                                          */
+  __IO uint32_t  PTPTSLR;                           /*!< System Time Nanoseconds Register                                      */
+  __IO uint32_t  PTPTSHUR;                          /*!< System Time Seconds Update Register                                   */
+  __IO uint32_t  PTPTSLUR;                          /*!< System Time Nanoseconds Update Register                               */
+  __IO uint32_t  PTPTSAR;                           /*!< Timestamp Addend Register                                             */
+  __IO uint32_t  PTPTTHR;                           /*!< Target Time Seconds Register                                          */
+  __IO uint32_t  PTPTTLR;                           /*!< Target Time Nanoseconds Register                                      */
+  __I  uint32_t  RESERVED6[567];
+  
+  union {
+    __IO uint32_t  BUS_MODE;                        /*!< Flow Control Register                                                 */
+    
+    struct {
+      __IO uint32_t  SWR        :  1;               /*!< Software Reset                                                        */
+      __IO uint32_t  DA         :  1;               /*!< This bit specifies the arbitration scheme between the transmit
+                                                         and receive paths of Channel                                          */
+      __IO uint32_t  DSL        :  5;               /*!< the byte number of bus width to skip between two unchained descriptors */
+      __IO uint32_t  ATDS       :  1;               /*!< When set, the size of the alternate descriptor increases to
+                                                         32 bytes                                                              */
+      __IO uint32_t  PBL        :  6;               /*!< These bits indicate the maximum number of beats to be transferred
+                                                         in one DMA transaction                                                */
+      __IO uint32_t  PR         :  2;               /*!< The Priority Ratio is (PR + 1) : 1                                    */
+      __IO uint32_t  FB         :  1;               /*!< performs fixed burst transfers or not                                 */
+      __IO uint32_t  RPBL       :  6;               /*!< This field indicates the maximum number of beats to be transferred
+                                                         in one Rx DMA transaction                                             */
+      __IO uint32_t  USP        :  1;               /*!< If set, RPBL is same as RPBL definition                               */
+      __IO uint32_t  PBLx8      :  1;               /*!< If set, all PBLs multiplies 8                                         */
+      __IO uint32_t  AAL        :  1;               /*!< If set, all bursts aligned to the start address LS bits               */
+      __IO uint32_t  MB         :  1;               /*!< When this bit is set high and the FB bit is low, the AHB master
+                                                         interface starts all bursts of length more than 16 with INCR          */
+      __IO uint32_t  TXPR       :  1;               /*!< When set, the transmit DMA has higher priority than the receive
+                                                         DMA                                                                   */
+      __IO uint32_t  PRWG       :  2;               /*!< The Priority weight is (PRWG + 1) : 1                                 */
+           uint32_t             :  1;
+      __IO uint32_t  RIB        :  1;               /*!< If set, rebuilds the pending beats of any burst transfer initiated
+                                                         with INCRx                                                            */
+    } BUS_MODE_b;                                   /*!< BitSize                                                               */
+  };
+  __IO uint32_t  TPD;                               /*!< Transmit Poll Demand                                                  */
+  __IO uint32_t  RPD;                               /*!< Receive Poll Demand                                                   */
+  __IO uint32_t  RDESLA;                            /*!< Receive Descriptor List Address                                       */
+  __IO uint32_t  TDESLA;                            /*!< Transmit Descriptor List Address                                      */
+  
+  union {
+    __IO uint32_t  STATUS;                          /*!< Status Register                                                       */
+    
+    struct {
+      __IO uint32_t  TI         :  1;               /*!< This bit indicates that the frame transmission is complete            */
+      __IO uint32_t  TPS        :  1;               /*!< Transmit Process Stopped                                              */
+      __IO uint32_t  TU         :  1;               /*!< the host owns the Next Descriptor in the Transmit List and the
+                                                         DMA cannot acquire it.                                                */
+      __IO uint32_t  TJT        :  1;               /*!< Transmit Jabber Timeout                                               */
+      __IO uint32_t  OVF        :  1;               /*!< Receive Overflow                                                      */
+      __IO uint32_t  UNF        :  1;               /*!< Transmit Underflow                                                    */
+      __IO uint32_t  RI         :  1;               /*!< the frame reception is complete                                       */
+      __IO uint32_t  RU         :  1;               /*!< Receive Buffer Unavailable                                            */
+      __IO uint32_t  RPS        :  1;               /*!< Receive Process Stopped                                               */
+      __IO uint32_t  RWT        :  1;               /*!< Receive Watchdog Timeout                                              */
+      __IO uint32_t  ETI        :  1;               /*!< the frame to be transmitted is fully transferred to the MTL
+                                                         Transmit FIFO                                                         */
+           uint32_t             :  2;
+      __IO uint32_t  FBI        :  1;               /*!< a bus error occurred, as described in EB.                             */
+      __IO uint32_t  ERI        :  1;               /*!< the DMA filled the first data buffer of the packet                    */
+      __IO uint32_t  AIS        :  1;               /*!< Abnormal Interrupt Summary, must be cleared by writting               */
+      __IO uint32_t  NIS        :  1;               /*!< Normal Interrupt Summary, must be cleared by writting                 */
+      __I  uint32_t  RS         :  3;               /*!< Receive DMA FSM state                                                 */
+      __I  uint32_t  TS         :  3;               /*!< Transmit DMA FSM state                                                */
+      __I  uint32_t  EB         :  3;               /*!< Error bit                                                             */
+      __I  uint32_t  GLI        :  1;               /*!< GMAC Line Interface Interrupt                                         */
+      __I  uint32_t  GMI        :  1;               /*!< GMAC MMC Interrupt                                                    */
+      __I  uint32_t  GPI        :  1;               /*!< GMAC PMT Interrupt                                                    */
+      __I  uint32_t  TTI        :  1;               /*!< Timestamp Trigger Interrupt                                           */
+    } STATUS_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  OPERATION;                       /*!< Operation Mode Register                                               */
+    
+    struct {
+           uint32_t             :  1;
+      __IO uint32_t  SR         :  1;               /*!< Start or Stop Receive                                                 */
+      __IO uint32_t  OSF        :  1;               /*!< Operate on Second Frame                                               */
+      __IO uint32_t  RT         :  2;               /*!< Receive Threshold Control                                             */
+      __IO uint32_t  DGF        :  1;               /*!< Drop Giant Frames                                                     */
+      __IO uint32_t  FUF        :  1;               /*!< Forward Undersized Good Frames                                        */
+      __IO uint32_t  FEF        :  1;               /*!< Forward Error Frames                                                  */
+           uint32_t             :  5;
+      __IO uint32_t  ST         :  1;               /*!< Start or Stop Transmission Command                                    */
+      __IO uint32_t  TT         :  3;               /*!< Transmit Threshold Control                                            */
+           uint32_t             :  3;
+      __IO uint32_t  FTF        :  1;               /*!< Flush Transmit FIFO                                                   */
+      __IO uint32_t  TSF        :  1;               /*!< If set, transmission starts when a full frame resides in Transmit
+                                                         FIFO                                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  DFF        :  1;               /*!< Disable Flushing of Received Frames                                   */
+      __IO uint32_t  RSF        :  1;               /*!< If set, the MTL reads a frame from the Rx FIFO while the complete
+                                                         frame has been written to it,                                         */
+    } OPERATION_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INT_EN;                          /*!< Interrupt Enable Register                                             */
+    
+    struct {
+      __IO uint32_t  TIE        :  1;               /*!< Transmit Interrupt Enable                                             */
+      __IO uint32_t  TSE        :  1;               /*!< Transmit Stopped Enable                                               */
+      __IO uint32_t  TUE        :  1;               /*!< Transmit Buffer Unavailable Enable                                    */
+      __IO uint32_t  TJE        :  1;               /*!< Transmit Jabber Timeout Enable                                        */
+      __IO uint32_t  OVE        :  1;               /*!< Overflow Interrupt Enable                                             */
+      __IO uint32_t  UNE        :  1;               /*!< Underflow Interrupt Enable                                            */
+      __IO uint32_t  RIE        :  1;               /*!< Receive Interrupt Enable                                              */
+      __IO uint32_t  RUE        :  1;               /*!< Receive Buffer Unavailable Enable                                     */
+      __IO uint32_t  RSE        :  1;               /*!< Receive Stopped Enable                                                */
+      __IO uint32_t  RWE        :  1;               /*!< Receive Watchdog Timeout Enable                                       */
+      __IO uint32_t  ETE        :  1;               /*!< Early Transmit Interrupt Enable                                       */
+           uint32_t             :  2;
+      __IO uint32_t  FBE        :  1;               /*!< Fatal Bus Error Enable                                                */
+      __IO uint32_t  ERE        :  1;               /*!< Early Receive Interrupt Enable                                        */
+      __IO uint32_t  AIE        :  1;               /*!< Abnormal Interrupt Summary Enable                                     */
+      __IO uint32_t  NIE        :  1;               /*!< Normal Interrupt Summary Enable                                       */
+    } INT_EN_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED7[3];
+  
+  union {
+    __IO uint32_t  AHB_STATUS;                      /*!< AHB Status Register                                                   */
+    
+    struct {
+      __IO uint32_t  BUSY       :  1;               /*!< If set, it indicates that the AHB master interface FSMs are
+                                                         in the non-idle state                                                 */
+    } AHB_STATUS_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED8[6];
+  __I  uint32_t  CURTDESAPTR;                       /*!< Current Host Transmit Descriptor Register                             */
+  __I  uint32_t  CURRDESAPTR;                       /*!< Current Host Receive Descriptor Register                              */
+  __I  uint32_t  CURTBUFAPTR;                       /*!< Current Host Transmit Buffer Address Register                         */
+  __I  uint32_t  CURRBUFAPTR;                       /*!< Current Host Receive Buffer Address Register                          */
+} ETH_Type;
+
+
+/* ================================================================================ */
+/* ================                       USB                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief USB (USB)
+  */
+
+typedef struct {                                    /*!< USB Structure                                                         */
+  
+  union {
+    __IO uint32_t  GOTGCTL;                         /*!< Control and Status register                                           */
+    
+    struct {
+      __I  uint32_t  SES_REQ_SCS:  1;               /*!< set when a session request initiation is successful as a device       */
+      __IO uint32_t  SES_SEQ    :  1;               /*!< set to initiate a session request on the USB as a device              */
+      __IO uint32_t  VB_VALID_OV_EN:  1;            /*!< enable/disable the software to override the Bvalid signal using
+                                                         the GOTGCTL.VbvalidOvVal as a host                                    */
+      __IO uint32_t  VB_VALID_OV_VAL:  1;           /*!< set Override value for vbusvalid signal when GOTGCTL.VbvalidOvEn
+                                                         is set as a host                                                      */
+      __IO uint32_t  A_VALID_OV_EN:  1;             /*!< enable/disable the software to override the Avalid signal using
+                                                         the GOTGCTL.AvalidOvVal as a host                                     */
+      __IO uint32_t  A_VALID_OV_VAL:  1;            /*!< set Override value for Avalid signal when GOTGCTL.AvalidOvEn
+                                                         is set as a host                                                      */
+      __IO uint32_t  B_VALID_OV_EN:  1;             /*!< enable/disable the software to override the Bvalid signal using
+                                                         the GOTGCTL.BvalidOvVal as a device.                                  */
+      __IO uint32_t  B_VALID_OV_VAL:  1;            /*!< set Override value for Bvalid signal when GOTGCTL.BvalidOvEn
+                                                         is set as a device.                                                   */
+      __I  uint32_t  HST_NEG_SCS:  1;               /*!< sets when host negotiation is successful as a device.                 */
+      __IO uint32_t  HNP_REQ    :  1;               /*!< sets this bit to initiate an HNP request to the connected USB
+                                                         host as a device                                                      */
+      __IO uint32_t  HST_SET_HNP_EN:  1;            /*!< Host Set HNP Enable as a host                                         */
+      __IO uint32_t  DEV_HNP_EN :  1;               /*!< Device HNP Enabled as a device                                        */
+           uint32_t             :  4;
+      __I  uint32_t  CON_ID_STS :  1;               /*!< Connector ID Status                                                   */
+      __I  uint32_t  DBNC_TIME  :  1;               /*!< the debounce time of a detected connection as a host                  */
+      __I  uint32_t  A_SES_VLD  :  1;               /*!< A-Session Valid as a host                                             */
+      __I  uint32_t  B_SES_VLD  :  1;               /*!< B-Session Valid as a host                                             */
+      __IO uint32_t  OTG_VER    :  1;               /*!< If 0, OTG Version 1.3. If 1, OTG Version 2.0.                         */
+    } GOTGCTL_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GOTGINT;                         /*!< OTG interrupt Register                                                */
+    
+    struct {
+           uint32_t             :  2;
+      __IO uint32_t  SES_END_DET:  1;               /*!< Set when the utmiotg_bvalid signal is deasserted                      */
+           uint32_t             :  5;
+      __IO uint32_t  SES_REQ_SUC_STS_CHNG:  1;      /*!< Session Request Success Status Change                                 */
+      __IO uint32_t  HST_NEG_SUC_STS_CHNG:  1;      /*!< Host Negotiation Success Status Change                                */
+           uint32_t             :  7;
+      __IO uint32_t  HST_NEG_DET:  1;               /*!< if set, detects a host negotiation request on the USB                 */
+      __IO uint32_t  A_DEV_TOUT_CHG:  1;            /*!< A-device has timed out while waiting for the B-device to connect      */
+      __IO uint32_t  DBNCE_DONE :  1;               /*!< debounce is completed after the device connect as a host              */
+    } GOTGINT_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GAHBCFG;                         /*!< AHB Configuration Register                                            */
+    
+    struct {
+      __IO uint32_t  GLBL_INTR_EN:  1;              /*!< Global Interrupt Enable                                               */
+      __IO uint32_t  BST_LEN    :  4;               /*!< Burst Length/Type                                                     */
+      __IO uint32_t  DMA_EN     :  1;               /*!< DMA enable                                                            */
+           uint32_t             : 15;
+      __IO uint32_t  REMOTE_MEM_SUPP:  1;           /*!< enable the functionality to wait for the system DMA Done Signal
+                                                         for the DMA Write Transfers                                           */
+      __IO uint32_t  NOTIFY_ALL_DMA_WRITE:  1;      /*!< enable the System DMA Done functionality for all the DMA write
+                                                         Transactions corresponding to the Channel/Endpoint                    */
+      __IO uint32_t  AHB_SINGLE :  1;               /*!< supports Single transfers for the remaining data in a transfer        */
+    } GAHBCFG_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GUSBCFG;                         /*!< USB Configuration Register                                            */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  PHY_IF     :  1;               /*!< PHY Interface                                                         */
+      __IO uint32_t  ULPI_UTMI_SEL:  1;             /*!< 1, ULPI. 0, UTMI+                                                     */
+      __IO uint32_t  FS_IF      :  1;               /*!< 1, 3-pin bidirectional. 0, 6-pin unidirectional                       */
+      __IO uint32_t  PHY_SEL    :  1;               /*!< 0, USB 2.0 High-Speed PHY. 1, USB 1.1 full-speed serial transceiver   */
+      __IO uint32_t  DDR_SEL    :  1;               /*!< 0, Single Data Rate ULPI Interface, with 8-bit-wide data bus.
+                                                         1, Double Data Rate ULPI Interface, with 4-bit-wide data bus          */
+      __IO uint32_t  SRP_CAP    :  1;               /*!< SRP-Capable                                                           */
+      __IO uint32_t  HNP_CAP    :  1;               /*!< HNP-Capable                                                           */
+      __IO uint32_t  USB_TRD_TIM:  4;               /*!< Specifies the response time for a MAC request to the Packet
+                                                         FIFO Controller (PFC) to fetch data from the DFIFO (SPRAM) as
+                                                          a device.                                                            */
+           uint32_t             :  1;
+      __IO uint32_t  PHY_LPWR_CLK_SEL:  1;          /*!< 0, 480-MHz Internal PLL clock. 1, 48-MHz External Clock               */
+           uint32_t             : 12;
+      __IO uint32_t  TX_END_DELAY:  1;              /*!< Tx End Delay as a device                                              */
+      __IO uint32_t  FORCE_HOST_MODE:  1;           /*!< Force Host Mode                                                       */
+      __IO uint32_t  FORCE_DEVICE_MODE:  1;         /*!< Force Device Mode                                                     */
+    } GUSBCFG_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GRSTCTL;                         /*!< Reset Register                                                        */
+    
+    struct {
+      __IO uint32_t  CORE_SOFT_RST:  1;             /*!< Core Soft Reset                                                       */
+           uint32_t             :  1;
+      __IO uint32_t  FRM_CNT_RST:  1;               /*!< Host Frame Counter Reset                                              */
+           uint32_t             :  1;
+      __IO uint32_t  RX_FIFO_FLUSH:  1;             /*!< RxFIFO Flush                                                          */
+      __IO uint32_t  TX_FIFO_FLUSH:  1;             /*!< TxFIFO Flush                                                          */
+      __IO uint32_t  TX_FIFO_FLUSH_NUM:  4;         /*!< This field indicates which of the 32 possible PHY devices are
+                                                         being accessed                                                        */
+      __IO uint32_t  TX_FIFO_ALL:  1;               /*!< TxFIFO flush all FIFOs                                                */
+           uint32_t             : 19;
+      __I  uint32_t  DMA_REQ    :  1;               /*!< Indicates that the DMA request is in progress                         */
+      __I  uint32_t  AHB_IDLE   :  1;               /*!< Indicates that the AHB Master State Machine is in the IDLE condition  */
+    } GRSTCTL_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GINTSTS;                         /*!< Interrupt Register                                                    */
+    
+    struct {
+      __I  uint32_t  CUR_MOD    :  1;               /*!< Current Mode of Operation                                             */
+      __IO uint32_t  MODE_MIS   :  1;               /*!< Mode Mismatch Interrupt                                               */
+      __I  uint32_t  OTG_INT    :  1;               /*!< OTG Interrupt                                                         */
+      __IO uint32_t  SOF        :  1;               /*!< Start of (micro)Frame                                                 */
+      __I  uint32_t  RFNE       :  1;               /*!< RxFIFO Non-Empty                                                      */
+      __I  uint32_t  NPTFE      :  1;               /*!< Non-periodic TxFIFO Empty                                             */
+      __I  uint32_t  GIN_NAK_EFF:  1;               /*!< Global IN Non-periodic NAK Effective as a device                      */
+      __I  uint32_t  GOUT_NAK_EFF:  1;              /*!< Global OUT NAK Effective as a device                                  */
+           uint32_t             :  2;
+      __IO uint32_t  EARLY_SUS  :  1;               /*!< an Idle state has been detected on the USB For 3 ms as a device       */
+      __IO uint32_t  USB_SUS    :  1;               /*!< A suspend was detected on the USB as a device                         */
+      __IO uint32_t  USB_RST    :  1;               /*!< A reset is detected on the USB as a device                            */
+      __IO uint32_t  ENUM_DONE  :  1;               /*!< speed enumeration is complete as a device                             */
+      __IO uint32_t  ISO_OUT_DROP:  1;              /*!< Drop an isochronous OUT packet while no space in RXFIFO as a
+                                                         device                                                                */
+      __IO uint32_t  EOPF       :  1;               /*!< End of Periodic Frame Interrupt as a device                           */
+           uint32_t             :  1;
+      __I  uint32_t  EP_MIS     :  1;               /*!< Endpoint Mismatch Interrupt as a device                               */
+      __I  uint32_t  IEP_INT    :  1;               /*!< IN Endpoints Interrupt as a device                                    */
+      __I  uint32_t  OEP_INT    :  1;               /*!< OUT Endpoints Interrupt as a device                                   */
+      __IO uint32_t  INCOMP_ISO_IN:  1;             /*!< Incomplete Isochronous IN Transfer as a device                        */
+      __IO uint32_t  IPT_IIOT   :  1;               /*!< OUT Incomplete Periodic Transfer as a host or Incomplete Isochronous
+                                                         OUT Transfer as a device                                              */
+      __IO uint32_t  DFS        :  1;               /*!< Data Fetch Suspended as a device                                      */
+      __IO uint32_t  RST_DET    :  1;               /*!< reset detect as a device                                              */
+      __I  uint32_t  HP         :  1;               /*!< a change in port status of one of the DWC_otg core ports as
+                                                         a host                                                                */
+      __I  uint32_t  HC         :  1;               /*!< an interrupt is pending on one of the channels of the core as
+                                                         a host                                                                */
+      __I  uint32_t  PTFE       :  1;               /*!< Periodic TxFIFO Empty as a host                                       */
+      __IO uint32_t  LPM        :  1;               /*!< LPM Transaction Received Interrupt                                    */
+      __IO uint32_t  CIDSC      :  1;               /*!< A change in connector ID status                                       */
+      __IO uint32_t  DD         :  1;               /*!< A change in connector ID status                                       */
+      __IO uint32_t  SR         :  1;               /*!< Session Request/New Session Detected Interrupt                        */
+      __IO uint32_t  WAKEUP     :  1;               /*!< Resume/Remote Wakeup Detected Interrupt                               */
+    } GINTSTS_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GINTEN;                          /*!< Interrupt enable Register                                             */
+    
+    struct {
+           uint32_t             :  1;
+      __IO uint32_t  MODE_MIS   :  1;               /*!< Mode Mismatch                                                         */
+      __IO uint32_t  OTG_INT    :  1;               /*!< OTG                                                                   */
+      __IO uint32_t  SOF        :  1;               /*!< Start of (micro)Frame                                                 */
+      __IO uint32_t  RFNE       :  1;               /*!< RxFIFO Non-Empty                                                      */
+      __IO uint32_t  NPTFE      :  1;               /*!< Non-periodic TxFIFO Empty                                             */
+      __IO uint32_t  GIN_NAK_EFF:  1;               /*!< Global IN Non-periodic NAK Effective as a device                      */
+      __IO uint32_t  GOUT_NAK_EFF:  1;              /*!< Global OUT NAK Effective as a device                                  */
+           uint32_t             :  2;
+      __IO uint32_t  EARLY_SUS  :  1;               /*!< an Idle state has been detected on the USB For 3 ms as a device       */
+      __IO uint32_t  USB_SUS    :  1;               /*!< A suspend was detected on the USB as a device                         */
+      __IO uint32_t  USB_RST    :  1;               /*!< A reset is detected on the USB as a device                            */
+      __IO uint32_t  ENUM_DONE  :  1;               /*!< speed enumeration is complete as a device                             */
+      __IO uint32_t  ISO_OUT_DROP:  1;              /*!< Drop an isochronous OUT packet while no space in RXFIFO as a
+                                                         device                                                                */
+      __IO uint32_t  EOPF       :  1;               /*!< End of Periodic Frame Interrupt as a device                           */
+           uint32_t             :  1;
+      __IO uint32_t  EP_MIS     :  1;               /*!< Endpoint Mismatch Interrupt as a device                               */
+      __IO uint32_t  IEP_INT    :  1;               /*!< IN Endpoints Interrupt as a device                                    */
+      __IO uint32_t  OEP_INT    :  1;               /*!< OUT Endpoints Interrupt as a device                                   */
+      __IO uint32_t  INCOMP_ISO_IN:  1;             /*!< Incomplete Isochronous IN Transfer as a device                        */
+      __IO uint32_t  IPT_IIOT   :  1;               /*!< OUT Incomplete Periodic Transfer as a host or Incomplete Isochronous
+                                                         OUT Transfer as a device                                              */
+      __IO uint32_t  DFS        :  1;               /*!< Data Fetch Suspended as a device                                      */
+      __IO uint32_t  RST_DET    :  1;               /*!< reset detect as a device                                              */
+      __IO uint32_t  HP         :  1;               /*!< a change in port status of one of the DWC_otg core ports as
+                                                         a host                                                                */
+      __IO uint32_t  HC         :  1;               /*!< an interrupt is pending on one of the channels of the core as
+                                                         a host                                                                */
+      __IO uint32_t  PTFE       :  1;               /*!< Periodic TxFIFO Empty as a host                                       */
+      __IO uint32_t  LPM        :  1;               /*!< LPM Transaction Received Interrupt                                    */
+      __IO uint32_t  CIDSC      :  1;               /*!< A change in connector ID status                                       */
+      __IO uint32_t  DD         :  1;               /*!< A change in connector ID status                                       */
+      __IO uint32_t  SR         :  1;               /*!< Session Request/New Session Detected Interrupt                        */
+      __IO uint32_t  WAKEUP     :  1;               /*!< Resume/Remote Wakeup Detected Interrupt                               */
+    } GINTEN_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  GRXSTSR;                         /*!< Returns the contents of the top of the Receive FIFO                   */
+    
+    struct {
+      __I  uint32_t  CH_EP_NUM  :  4;               /*!< channel number as a host or EP number as a device                     */
+      __I  uint32_t  BCNT       : 11;               /*!< byte count of the received packet                                     */
+      __I  uint32_t  DPID       :  2;               /*!< Data PID of the received packet                                       */
+      __I  uint32_t  PS         :  4;               /*!< the status of the received packet                                     */
+      __I  uint32_t  FN         :  4;               /*!< the least significant 4 bits of the (micro)frame number in which
+                                                         the packet is received on the USB                                     */
+    } GRXSTSR_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  GRXSTSP;                         /*!< Pop the contents of the top of the Receive FIFO                       */
+    
+    struct {
+      __I  uint32_t  CH_EP_NUM  :  4;               /*!< channel number as a host or EP number as a device                     */
+      __I  uint32_t  BCNT       : 11;               /*!< byte count of the received packet                                     */
+      __I  uint32_t  DPID       :  2;               /*!< Data PID of the received packet                                       */
+      __I  uint32_t  PS         :  4;               /*!< the status of the received packet                                     */
+      __I  uint32_t  FN         :  4;               /*!< the least significant 4 bits of the (micro)frame number in which
+                                                         the packet is received on the USB                                     */
+    } GRXSTSP_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint16_t  GRXFSIZ;                           /*!< This value is in terms of 32-bit words, 16 is minimize and 32768
+                                                         is max                                                                */
+  __I  uint16_t  RESERVED0;
+  
+  union {
+    __IO uint32_t  GNPTXFSIZ;                       /*!< Non-Periodic Transmit FIFO Size Register                              */
+    
+    struct {
+      __IO uint32_t  NTRSA_INEF0TRSA: 16;           /*!< start address for Non-periodic Transmit FIFO RAM as a host or
+                                                         IN Endpoint FIFO0 Transmit RAM as a device                            */
+      __IO uint32_t  NTD_INEF0TD: 16;               /*!< This value is in terms of 32-bit words, 16 is minimize and 32768
+                                                         is max. Non-periodic TxFIFO Depth as a host or IN Endpoint TxFIFO
+                                                          0 Depth as a device                                                  */
+    } GNPTXFSIZ_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  GNPTXSTS;                        /*!< Non-Periodic Transmit FIFO/Queue Status Register                      */
+    
+    struct {
+      __I  uint32_t  NTSA       : 16;               /*!< the amount of free space available in the Non-periodic TxFIFO,
+                                                         max is 32768.                                                         */
+      __I  uint32_t  NTRQSA     :  8;               /*!< the amount of free space available in the Non-periodic Transmit
+                                                         Request Queue, max is 8.                                              */
+      __I  uint32_t  TNTRQ_LAST :  1;               /*!< last Entry in the Non-periodic Tx Request Queue that is currently
+                                                         being processed by the MAC                                            */
+      __I  uint32_t  TNTRQ_TYPE :  2;               /*!< type in the Non-periodic Tx Request Queue that is currently
+                                                         being processed by the MAC                                            */
+      __I  uint32_t  TNTRQ_CH   :  4;               /*!< Channel of top of the Non-periodic Transmit Request Queue             */
+    } GNPTXSTS_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED1[5];
+  
+  union {
+    __I  uint32_t  GHWCFG1;                         /*!< User HW Config1 Register                                              */
+    
+    struct {
+      __I  uint32_t  EP0_DIR    :  2;               /*!< Endpoint 0 direction, always Bidirection                              */
+      __I  uint32_t  EP1_DIR    :  2;               /*!< Endpoint 1 direction                                                  */
+      __I  uint32_t  EP2_DIR    :  2;               /*!< Endpoint 2 direction                                                  */
+      __I  uint32_t  EP3_DIR    :  2;               /*!< Endpoint 3 direction                                                  */
+      __I  uint32_t  EP4_DIR    :  2;               /*!< Endpoint 4 direction                                                  */
+      __I  uint32_t  EP5_DIR    :  2;               /*!< Endpoint 5 direction                                                  */
+      __I  uint32_t  EP6_DIR    :  2;               /*!< Endpoint 6 direction                                                  */
+      __I  uint32_t  EP7_DIR    :  2;               /*!< Endpoint 7 direction                                                  */
+      __I  uint32_t  EP8_DIR    :  2;               /*!< Endpoint 8 direction                                                  */
+      __I  uint32_t  EP9_DIR    :  2;               /*!< Endpoint 9 direction                                                  */
+      __I  uint32_t  EP10_DIR   :  2;               /*!< Endpoint 10 direction                                                 */
+      __I  uint32_t  EP11_DIR   :  2;               /*!< Endpoint 11 direction                                                 */
+      __I  uint32_t  EP12_DIR   :  2;               /*!< Endpoint 12 direction                                                 */
+      __I  uint32_t  EP13_DIR   :  2;               /*!< Endpoint 13 direction                                                 */
+      __I  uint32_t  EP14_DIR   :  2;               /*!< Endpoint 14 direction                                                 */
+      __I  uint32_t  EP15_DIR   :  2;               /*!< Endpoint 15 direction                                                 */
+    } GHWCFG1_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED2[3];
+  
+  union {
+    __IO uint32_t  GLPMCFG;                         /*!< Core LPM Configuration Register                                       */
+    
+    struct {
+      __IO uint32_t  EP0_DIR    :  1;               /*!< LPM capability is enabled                                             */
+    } GLPMCFG_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GPWRDN;                          /*!< Global Power Down Register                                            */
+    
+    struct {
+           uint32_t             :  1;
+      __IO uint32_t  PMU_ACTIVE :  1;               /*!< PMU Active is enabled                                                 */
+           uint32_t             :  1;
+      __IO uint32_t  PDC        :  1;               /*!< Power Down Clamp is enabled                                           */
+      __IO uint32_t  PDR        :  1;               /*!< If clear, Reset DWC_otg                                               */
+      __IO uint32_t  PDS        :  1;               /*!< If 0, DWC_otg is in ON state, or OFF state                            */
+      __IO uint32_t  DIS_VBUS   :  1;               /*!< Disable VBUS                                                          */
+           uint32_t             :  8;
+      __IO uint32_t  SRP_DETECT_INT:  1;            /*!< SRP has been detected by the PMU as a host                            */
+      __IO uint32_t  SRP_DETECT_INT_EN:  1;         /*!< Enable For SRPDetect Interrupt as a host                              */
+      __IO uint32_t  STATE_CHN_INT:  1;             /*!< a status change in either the IDDIG or BSessVld signal                */
+      __IO uint32_t  STATE_CHN_INT_EN:  1;          /*!< Enable For Status Change Interrupt                                    */
+      __I  uint32_t  LINE_STATE :  2;               /*!< the current linestate on USB as seen by the PMU module                */
+      __I  uint32_t  IDDIG      :  1;               /*!< the status of the IDDIG signal. If 0, host mode. if 1, device
+                                                         mode                                                                  */
+      __I  uint32_t  B_SESS_VLD :  1;               /*!< B session valid status signal from the PHY                            */
+      __IO uint32_t  ADP_INT    :  1;               /*!< set whenever there is a ADP event                                     */
+    } GPWRDN_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  GDFIFOCFG;                       /*!< Global DFIFO Software Config Register                                 */
+    
+    struct {
+      __IO uint32_t  GDFIFOCFG  : 16;               /*!< This field is for dynamic programming of the DFIFO Size.              */
+      __IO uint32_t  EPIBA      : 16;               /*!< This field provides the start address of the EP info controller       */
+    } GDFIFOCFG_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED3[40];
+  
+  union {
+    __IO uint32_t  HPTXFSIZ;                        /*!< Host Periodic Transmit FIFO Size Register                             */
+    
+    struct {
+      __IO uint32_t  HPTSA      : 16;               /*!< start address of the Periodic TxFIFO                                  */
+      __IO uint32_t  EPIBA      : 16;               /*!< the size of the Periodic TxFIFO                                       */
+    } HPTXFSIZ_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF1;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF1_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF2;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF2_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF3;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF3_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF4;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF4_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF5;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF5_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF6;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF6_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF7;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF7_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF8;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF8_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF9;                        /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF9_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF10;                       /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF10_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF11;                       /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF11_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF12;                       /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF12_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF13;                       /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF13_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF14;                       /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF14_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DIEPTXF15;                       /*!< Device In Endpoint Transmit FIFO Size Register                        */
+    
+    struct {
+      __IO uint32_t  INEFTRSA   : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  INETFD     : 16;               /*!< IN Endpoint TxFIFO Depth                                              */
+    } DIEPTXF15_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED4[176];
+  
+  union {
+    __IO uint32_t  HCFG;                            /*!< Host Configuration Register                                           */
+    
+    struct {
+      __IO uint32_t  FS_LS_PCS  :  2;               /*!< FS/LS PHY Clock Select as a host                                      */
+      __IO uint32_t  FS_LS_SUPPORT:  1;             /*!< If set, FS/LS-only, even If the connected device can support
+                                                         HS                                                                    */
+           uint32_t             :  4;
+      __IO uint32_t  EN_32K_SUS :  1;               /*!< Enable 32 KHz Suspend mode                                            */
+      __IO uint32_t  RVP        :  8;               /*!< ResValid number of clock cycles to detect a valid resume              */
+           uint32_t             :  7;
+      __IO uint32_t  EN_SG_DMA  :  1;               /*!< Enable Scatter/gather DMA in Host mode                                */
+      __IO uint32_t  FLE        :  2;               /*!< the number of entries in the Frame list. 8 times of FLE               */
+      __IO uint32_t  EPS        :  1;               /*!< Enables periodic scheduling                                           */
+           uint32_t             :  4;
+      __IO uint32_t  MCRTE      :  1;               /*!< enable/disable the Host core to wait 200 PHY clock cycles at
+                                                         the end of Resume to change the opmode signal to the PHY to
+                                                          00 after Suspend or LPM.                                             */
+    } HCFG_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HFIR;                            /*!< Host Frame Interval Register                                          */
+    
+    struct {
+      __IO uint32_t  FI         : 16;               /*!< IN Endpoint FIFOn Transmit RAM Start Address                          */
+      __IO uint32_t  RC         :  1;               /*!< The HFIR can be dynamically reloaded during runtime if set            */
+    } HFIR_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  HFNUM;                           /*!< Host Frame Number/Frame Time Remaining Register                       */
+    
+    struct {
+      __I  uint32_t  FN         : 16;               /*!< This field increments when a new SOF is transmitted on the USB        */
+      __I  uint32_t  FTR        : 16;               /*!< amount of time remaining in the current microframe (HS) or Frame
+                                                         (FS/LS), in terms of PHY clocks                                       */
+    } HFNUM_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED5;
+  
+  union {
+    __I  uint32_t  HPTXSTS;                         /*!< Host Periodic Transmit FIFO/Queue Status Register                     */
+    
+    struct {
+      __I  uint32_t  PTDFSA     : 16;               /*!< Indicates the number of free locations available to be written
+                                                         to in the Periodic TxFIFO, max is 32768                               */
+      __I  uint32_t  PTRQSA     :  8;               /*!< Indicates the number of free locations available to be written
+                                                         in the Periodic Transmit Request Queue, max is 16                     */
+      __I  uint32_t  TPTRQ_LAST :  1;               /*!< last Entry in the periodic Tx Request Queue that is currently
+                                                         being processed by the MAC                                            */
+      __I  uint32_t  TPTRQ_TYPE :  2;               /*!< type in the periodic Tx Request Queue that is currently being
+                                                         processed by the MAC                                                  */
+      __I  uint32_t  TPTRQ_CH   :  4;               /*!< Channel of top of the periodic Transmit Request Queue                 */
+      __I  uint32_t  TPTRQ_ODD_FRAME:  1;           /*!< If set, send in odd (micro)Frame                                      */
+    } HPTXSTS_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  HAINT;                           /*!< Host All Channels Interrupt Register                                  */
+    
+    struct {
+      __I  uint32_t  INT        : 16;               /*!< Channel Interrupts, from 0 to 15.                                     */
+    } HAINT_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HAINT_EN;                        /*!< Host All Channels Interrupt Enable Register                           */
+    
+    struct {
+      __IO uint32_t  EN         : 16;               /*!< Channel Interrupts Enable, from 0 to 15.                              */
+    } HAINT_EN_b;                                   /*!< BitSize                                                               */
+  };
+  __IO uint32_t  HFLBA;                             /*!< The starting address of the Frame list                                */
+  __I  uint32_t  RESERVED6[8];
+  
+  union {
+    __IO uint32_t  __HPRT;                          /*!< Host Port Control and Status Register                                 */
+    
+    struct {
+      __I  uint32_t  PCS        :  1;               /*!< If a device is attached to the port                                   */
+      __IO uint32_t  PCD        :  1;               /*!< A device connection is detected                                       */
+      __IO uint32_t  PE         :  1;               /*!< Port Enable                                                           */
+      __IO uint32_t  PEDC       :  1;               /*!< Set if when the status of the Port Enable (bit 2) of this register
+                                                         changes                                                               */
+      __I  uint32_t  POA        :  1;               /*!< Indicates the overcurrent condition of the port                       */
+      __IO uint32_t  POC        :  1;               /*!< Set if when the status of the Port Overcurrent Active bit (bit
+                                                         4) in this register changes                                           */
+      __IO uint32_t  PR         :  1;               /*!< Application and Core all can perform resume by setting, then
+                                                         clear it whatever resume is success or not                            */
+      __IO uint32_t  PS         :  1;               /*!< Sets this bit to put this port in Suspend mode                        */
+      __IO uint32_t  PRESET     :  1;               /*!< sets this bit, a reset sequence is started on this port               */
+           uint32_t             :  1;
+      __IO uint32_t  PLSDP      :  1;               /*!< Logic level of D+                                                     */
+      __IO uint32_t  PLSDN      :  1;               /*!< Logic level of D-                                                     */
+      __IO uint32_t  PP         :  1;               /*!< this field to control power to this port. 1, power on                 */
+      __IO uint32_t  PTC        :  4;               /*!< The application writes a nonzero value to this field to put
+                                                         the port into a Test mode                                             */
+      __I  uint32_t  SPEED      :  2;               /*!< Indicates the speed of the device attached to this port               */
+    } __HPRT_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED7[47];
+  
+  union {
+    __IO uint32_t  HCC0;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC0_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED8;
+  
+  union {
+    __IO uint32_t  HCINT0;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT0_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN0;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN0_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ0;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ0_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA0;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA0_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED9;
+  __IO uint32_t  HCDMAB0;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC1;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC1_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED10;
+  
+  union {
+    __IO uint32_t  HCINT1;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT1_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN1;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN1_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ1;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ1_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA1;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA1_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED11;
+  __IO uint32_t  HCDMAB1;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC2;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC2_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED12;
+  
+  union {
+    __IO uint32_t  HCINT2;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT2_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN2;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN2_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ2;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ2_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA2;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA2_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED13;
+  __IO uint32_t  HCDMAB2;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC3;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC3_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED14;
+  
+  union {
+    __IO uint32_t  HCINT3;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT3_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN3;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN3_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ3;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ3_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA3;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA3_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED15;
+  __IO uint32_t  HCDMAB3;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC4;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC4_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED16;
+  
+  union {
+    __IO uint32_t  HCINT4;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT4_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN4;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN4_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ4;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ4_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA4;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA4_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED17;
+  __IO uint32_t  HCDMAB4;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC5;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC5_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED18;
+  
+  union {
+    __IO uint32_t  HCINT5;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT5_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN5;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN5_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ5;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ5_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA5;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA5_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED19;
+  __IO uint32_t  HCDMAB5;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC6;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC6_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED20;
+  
+  union {
+    __IO uint32_t  HCINT6;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT6_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN6;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN6_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ6;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ6_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA6;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA6_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED21;
+  __IO uint32_t  HCDMAB6;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC7;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC7_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED22;
+  
+  union {
+    __IO uint32_t  HCINT7;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT7_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN7;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN7_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ7;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ7_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA7;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA7_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED23;
+  __IO uint32_t  HCDMAB7;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC8;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC8_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED24;
+  
+  union {
+    __IO uint32_t  HCINT8;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT8_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN8;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN8_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ8;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ8_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA8;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA8_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED25;
+  __IO uint32_t  HCDMAB8;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC9;                            /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC9_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED26;
+  
+  union {
+    __IO uint32_t  HCINT9;                          /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT9_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN9;                       /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN9_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ9;                         /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ9_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA9;                          /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA9_b;                                     /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED27;
+  __IO uint32_t  HCDMAB9;                           /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC10;                           /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC10_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED28;
+  
+  union {
+    __IO uint32_t  HCINT10;                         /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT10_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN10;                      /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN10_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ10;                        /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ10_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA10;                         /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA10_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED29;
+  __IO uint32_t  HCDMAB10;                          /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC11;                           /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC11_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED30;
+  
+  union {
+    __IO uint32_t  HCINT11;                         /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT11_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN11;                      /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN11_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ11;                        /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ11_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA11;                         /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA11_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED31;
+  __IO uint32_t  HCDMAB11;                          /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC12;                           /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC12_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED32;
+  
+  union {
+    __IO uint32_t  HCINT12;                         /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT12_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN12;                      /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN12_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ12;                        /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ12_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA12;                         /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA12_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED33;
+  __IO uint32_t  HCDMAB12;                          /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC13;                           /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC13_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED34;
+  
+  union {
+    __IO uint32_t  HCINT13;                         /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT13_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN13;                      /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN13_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ13;                        /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ13_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA13;                         /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA13_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED35;
+  __IO uint32_t  HCDMAB13;                          /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC14;                           /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC14_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED36;
+  
+  union {
+    __IO uint32_t  HCINT14;                         /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT14_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN14;                      /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN14_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ14;                        /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ14_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA14;                         /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA14_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED37;
+  __IO uint32_t  HCDMAB14;                          /*!< Host Channel-n DMA Buffer Address Register                            */
+  
+  union {
+    __IO uint32_t  HCC15;                           /*!< Host Channel Characteristics Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+      __IO uint32_t  EP_NUM     :  4;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  EP_DIR     :  1;               /*!< Indicates whether the transaction is IN or OUT. 0, OUT. 1, IN         */
+           uint32_t             :  1;
+      __IO uint32_t  LSD        :  1;               /*!< indicate that this channel is communicating to a low-speed device.    */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  2;               /*!< Multi Count (MC) / Error Count (EC).                                  */
+      __IO uint32_t  DA         :  7;               /*!< This field selects the specific device serving as the data source
+                                                         or sink.                                                              */
+      __IO uint32_t  OF         :  1;               /*!< The frame is odd or even.                                             */
+      __IO uint32_t  CD         :  1;               /*!< sets this bit to stop transmitting/receiving data on a channel.       */
+      __IO uint32_t  CE         :  1;               /*!< If the descriptor structure and data buffer are ready or not
+                                                         yet.                                                                  */
+    } HCC15_b;                                      /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED38;
+  
+  union {
+    __IO uint32_t  HCINT15;                         /*!< Host Channel Interrupt Register                                       */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT15_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCINT_EN15;                      /*!< Host Channel Interrupt Enable Register                                */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  CH_HALT    :  1;               /*!< Indicates the endpoint number on the device serving as the data
+                                                         source or sink.                                                       */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+           uint32_t             :  8;
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+      __IO uint32_t  ETE        :  1;               /*!< 3 consecutive transaction errors occurred on the USB bus              */
+      __IO uint32_t  DR         :  1;               /*!< the corresponding channel's descriptor list rolls over                */
+    } HCINT_EN15_b;                                 /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCTSIZ15;                        /*!< Host Channel Transfer Size Register                                   */
+    
+    struct {
+      __IO uint32_t  SCHED_INFO :  8;               /*!< Every bit in this 8 bit register indicates scheduling for that
+                                                         microframe.Bit N indicates scheduling for Nth microframe scheduling
+                                                          for 8th microframe in that frame.                                    */
+      __IO uint32_t  NTD        :  8;               /*!< Number of Transfer Descriptors.                                       */
+           uint32_t             : 13;
+      __IO uint32_t  PID        :  2;               /*!< the type of PID to use for the initial transaction                    */
+      __IO uint32_t  PING       :  1;               /*!< Setting this field to 1 directs the host to do PING protocol          */
+    } HCTSIZ15_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  HCDMA15;                         /*!< Host Channel-n DMA Address Register                                   */
+    
+    struct {
+           uint32_t             :  3;
+      __IO uint32_t  CTD        :  6;               /*!< Number of Transfer Descriptors for Non-Isochronous                    */
+      __IO uint32_t  ADDR       : 23;               /*!< he start address of 512 bytes page for Non-Isochronous                */
+    } HCDMA15_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED39;
+  __IO uint32_t  HCDMAB15;                          /*!< Host Channel-n DMA Buffer Address Register                            */
+  __I  uint32_t  RESERVED40[64];
+  
+  union {
+    __IO uint32_t  DCFG;                            /*!< Device Configuration Register                                         */
+    
+    struct {
+      __IO uint32_t  DSPEED     :  2;               /*!< the maximum speed the application can support                         */
+      __IO uint32_t  NZLSOH     :  1;               /*!< select the handshake the core sends on receiving a non zero-length
+                                                         data packet during the OUT transaction of a control transfer's
+                                                          Status stage                                                         */
+      __IO uint32_t  EN_32K_SUS :  1;               /*!< Enable 32 KHz Suspend mode                                            */
+      __IO uint32_t  DEVICE_ADDR:  7;               /*!< The application must program this field after every SetAddress
+                                                         control command                                                       */
+      __IO uint32_t  PFI        :  2;               /*!< Indicates the time within a (micro)frame at which the application
+                                                         must be notified using the End Of Periodic Frame Interrupt            */
+      __IO uint32_t  EDON       :  1;               /*!< If set the core sets NAK after Bulk OUT transfer complete             */
+           uint32_t             :  9;
+      __IO uint32_t  EN_SG_DMA  :  1;               /*!< enable the Scatter/Gather DMA operation                               */
+      __IO uint32_t  PSI        :  2;               /*!< Periodic Scheduling Interval                                          */
+      __IO uint32_t  RVP        :  6;               /*!< It controls the resume period when the core resumes from suspend      */
+    } DCFG_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DCTL;                            /*!< Device Control Register                                               */
+    
+    struct {
+      __IO uint32_t  RWS        :  1;               /*!< If set, the core initiates remote signaling to wake the USB
+                                                         hosts                                                                 */
+      __IO uint32_t  SD         :  1;               /*!< If set, generates a device disconnect event to the USB host           */
+      __I  uint32_t  GNPINS     :  1;               /*!< A NAK handshake is sent out on all non-periodic IN endpoints,
+                                                         irrespective of the data availability in the transmit FIFO.           */
+      __I  uint32_t  GONS       :  1;               /*!< No data is written to the RxFIFO, irrespective of space availability.. */
+      __IO uint32_t  TC         :  3;               /*!< Test Control                                                          */
+      __O  uint32_t  SGNPIN     :  1;               /*!< A write to this field sets the Global Non-periodic IN NAK             */
+      __O  uint32_t  CGNPIN     :  1;               /*!< A write to this field clears the Global Non-periodic IN NAK           */
+      __O  uint32_t  SGON       :  1;               /*!< A write to this field sets the Global OUT NAK                         */
+      __O  uint32_t  CGON       :  1;               /*!< A write to this field sets the Global OUT NAK.                        */
+      __IO uint32_t  POPD       :  1;               /*!< Power-On Programming Done                                             */
+      __IO uint32_t  GMC        :  2;               /*!< GMC must be programmed only once after initialization. the number
+                                                         of packets to be serviced for that end point before moving to
+                                                          the next end point                                                   */
+           uint32_t             :  1;
+      __IO uint32_t  IFNIE      :  1;               /*!< Ignore frame number for isochronous endpoints                         */
+      __IO uint32_t  NBE        :  1;               /*!< Set NAK automatically on babble                                       */
+      __IO uint32_t  ECBNA      :  1;               /*!< After receiving BNA interrupt, the core disables the endpoint         */
+    } DCTL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DSTS;                            /*!< Device Status Register                                                */
+    
+    struct {
+      __I  uint32_t  SUSPEND    :  1;               /*!< this bit is set as long as a Suspend condition is detected on
+                                                         the USB                                                               */
+      __I  uint32_t  SPEED      :  2;               /*!< Indicates the speed at which the DWC_otg core has come up after
+                                                         speed detection through a chirp sequence                              */
+      __I  uint32_t  EE         :  1;               /*!< reason of suspend state                                               */
+           uint32_t             :  4;
+      __I  uint32_t  SOFFN      : 14;               /*!< Frame or Microframe Number of the Received SOF                        */
+      __I  uint32_t  DLSDP      :  1;               /*!< Logic level of D+                                                     */
+      __I  uint32_t  DLSDN      :  1;               /*!< Logic level of D-                                                     */
+    } DSTS_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED41;
+  
+  union {
+    __IO uint32_t  DIEPEN;                          /*!< Device IN Endpoint Common Interrupt Enable Register                   */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer Completed Interrupt                                          */
+      __IO uint32_t  ED         :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< AHB Error Interrupt                                                   */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< Timeout Condition(Non-isochronous endpoints)                          */
+      __IO uint32_t  ITRWTFE    :  1;               /*!< IN Token Received When TxFIFO Empty                                   */
+      __IO uint32_t  ITRWEPM    :  1;               /*!< IN Token received with EP Mismatch                                    */
+      __IO uint32_t  IENE       :  1;               /*!< IN Endpoint NAK Effective                                             */
+           uint32_t             :  1;
+      __IO uint32_t  FU         :  1;               /*!< Fifo Underrun                                                         */
+      __IO uint32_t  BNA        :  1;               /*!< BNA Interrupt                                                         */
+           uint32_t             :  3;
+      __IO uint32_t  NAK        :  1;               /*!< NAK interrupt                                                         */
+    } DIEPEN_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DOEPEN;                          /*!< Device OUT Endpoint Common Interrupt Enable Register                  */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer Completed Interrupt                                          */
+      __IO uint32_t  ED         :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< AHB Error Interrupt                                                   */
+      __IO uint32_t  SPD        :  1;               /*!< SETUP Phase Done, Applies to control endpoints only                   */
+      __IO uint32_t  OTRWED     :  1;               /*!< OUT Token Received when Endpoint Disabled, Applies to control
+                                                         OUT endpoints only                                                    */
+      __IO uint32_t  SPR        :  1;               /*!< Status Phase Received                                                 */
+      __IO uint32_t  BTBSPR     :  1;               /*!< Back-to-Back SETUP Packets Received, Applies to control OUT
+                                                         endpoints only                                                        */
+           uint32_t             :  1;
+      __IO uint32_t  OPE        :  1;               /*!< OUT Packet Error                                                      */
+      __IO uint32_t  BNA        :  1;               /*!< BNA Interrupt                                                         */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error interrupt                                                */
+      __IO uint32_t  NAK        :  1;               /*!< NAK interrupt                                                         */
+      __IO uint32_t  NYET       :  1;               /*!< NYET interrupt                                                        */
+    } DOEPEN_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  DAINT;                           /*!< Device All Channels Interrupt Register                                */
+    
+    struct {
+      __I  uint32_t  INT        : 16;               /*!< IN Endpoint Interrupt Bits, from 0 to 15.                             */
+      __I  uint32_t  OUT_INT    : 16;               /*!< OUT Endpoint Interrupt Bits, from 0 to 15.                            */
+    } DAINT_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DAINT_EN;                        /*!< Device All Channels Interrupt Enable Register                         */
+    
+    struct {
+      __IO uint32_t  IN_EN      : 16;               /*!< IN EP Interrupt Enable, from 0 to 15.                                 */
+      __IO uint32_t  OUT_EN     : 16;               /*!< OUT EP Interrupt Enable, from 0 to 15.                                */
+    } DAINT_EN_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED42[4];
+  
+  union {
+    __IO uint32_t  DTHRCTL;                         /*!< Device Threshold Control Register                                     */
+    
+    struct {
+      __IO uint32_t  NISOINETE  :  1;               /*!< Non-ISO IN Endpoints Threshold Enable                                 */
+      __IO uint32_t  ISOINETE   :  1;               /*!< ISO IN Endpoints Threshold Enable                                     */
+      __IO uint32_t  TTL        :  9;               /*!< This field specifies Transmit thresholding size in DWORDS             */
+      __IO uint32_t  ATR        :  2;               /*!< These bits define the ratio between the AHB threshold and the
+                                                         MAC threshold for the transmit path only.                             */
+           uint32_t             :  3;
+      __IO uint32_t  RTE        :  1;               /*!< If set, the core enables thresholding in the receive direction        */
+      __IO uint32_t  RTL        :  9;               /*!< This field specifies Receive thresholding size in DWORDS              */
+           uint32_t             :  1;
+      __IO uint32_t  APE        :  1;               /*!< This bit controls internal DMA arbiter parking for IN endpoints       */
+    } DTHRCTL_b;                                    /*!< BitSize                                                               */
+  };
+  __IO uint16_t  DIEPEMPEN;                         /*!< Device IN Endpoint FIFO Empty Interrupt Enable Register               */
+  __I  uint16_t  RESERVED43[101];
+  
+  union {
+    __IO uint32_t  DIEPCTL0;                        /*!< Device Control IN Endpoint 0 Control Register                         */
+    
+    struct {
+      __IO uint32_t  MPS        :  2;               /*!< Indicates the maximum packet size of the associated endpoint,
+                                                         applies to IN and OUT endpoints                                       */
+           uint32_t             : 13;
+      __I  uint32_t  USBAE      :  1;               /*!< Always 1, indicating that control endpoint 0 is always active
+                                                         in all configurations and interfaces                                  */
+           uint32_t             :  1;
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint              */
+      __I  uint32_t  EP_TYPE    :  2;               /*!< Hardcoded to 00 for control                                           */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< The application sets this bit, and the core clears it when a
+                                                         SETUP token is received for this endpoint                             */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+           uint32_t             :  2;
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL0_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED44;
+  
+  union {
+    __IO uint32_t  DIEPINT0;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT0_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED45;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ0;                       /*!< Device IN Endpoint 0 Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       :  7;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+           uint32_t             : 12;
+      __IO uint32_t  PACKET_CNT :  2;               /*!< the total number of USB packets                                       */
+    } DIEPTSIZ0_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA0;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA0;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED46;
+  __I  uint32_t  DIEPDMAB0;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL1;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL1_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED47;
+  
+  union {
+    __IO uint32_t  DIEPINT1;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT1_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED48;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ1;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ1_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA1;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA1;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED49;
+  __I  uint32_t  DIEPDMAB1;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL2;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL2_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED50;
+  
+  union {
+    __IO uint32_t  DIEPINT2;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT2_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED51;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ2;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ2_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA2;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA2;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED52;
+  __I  uint32_t  DIEPDMAB2;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL3;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL3_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED53;
+  
+  union {
+    __IO uint32_t  DIEPINT3;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT3_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED54;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ3;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ3_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA3;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA3;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED55;
+  __I  uint32_t  DIEPDMAB3;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL4;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL4_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED56;
+  
+  union {
+    __IO uint32_t  DIEPINT4;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT4_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED57;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ4;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ4_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA4;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA4;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED58;
+  __I  uint32_t  DIEPDMAB4;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL5;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL5_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED59;
+  
+  union {
+    __IO uint32_t  DIEPINT5;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT5_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED60;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ5;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ5_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA5;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA5;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED61;
+  __I  uint32_t  DIEPDMAB5;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL6;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL6_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED62;
+  
+  union {
+    __IO uint32_t  DIEPINT6;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT6_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED63;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ6;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ6_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA6;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA6;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED64;
+  __I  uint32_t  DIEPDMAB6;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL7;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL7_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED65;
+  
+  union {
+    __IO uint32_t  DIEPINT7;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT7_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED66;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ7;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ7_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA7;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA7;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED67;
+  __I  uint32_t  DIEPDMAB7;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL8;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL8_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED68;
+  
+  union {
+    __IO uint32_t  DIEPINT8;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT8_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED69;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ8;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ8_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA8;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA8;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED70;
+  __I  uint32_t  DIEPDMAB8;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL9;                        /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL9_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED71;
+  
+  union {
+    __IO uint32_t  DIEPINT9;                        /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT9_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED72;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ9;                       /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ9_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA9;                          /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA9;                           /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED73;
+  __I  uint32_t  DIEPDMAB9;                         /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL10;                       /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL10_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED74;
+  
+  union {
+    __IO uint32_t  DIEPINT10;                       /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT10_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED75;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ10;                      /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ10_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA10;                         /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA10;                          /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED76;
+  __I  uint32_t  DIEPDMAB10;                        /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL11;                       /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL11_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED77;
+  
+  union {
+    __IO uint32_t  DIEPINT11;                       /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT11_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED78;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ11;                      /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ11_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA11;                         /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA11;                          /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED79;
+  __I  uint32_t  DIEPDMAB11;                        /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL12;                       /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL12_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED80;
+  
+  union {
+    __IO uint32_t  DIEPINT12;                       /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT12_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED81;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ12;                      /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ12_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA12;                         /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA12;                          /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED82;
+  __I  uint32_t  DIEPDMAB12;                        /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL13;                       /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL13_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED83;
+  
+  union {
+    __IO uint32_t  DIEPINT13;                       /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT13_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED84;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ13;                      /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ13_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA13;                         /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA13;                          /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED85;
+  __I  uint32_t  DIEPDMAB13;                        /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL14;                       /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL14_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED86;
+  
+  union {
+    __IO uint32_t  DIEPINT14;                       /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT14_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED87;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ14;                      /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ14_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA14;                         /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA14;                          /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED88;
+  __I  uint32_t  DIEPDMAB14;                        /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DIEPCTL15;                       /*!< Device IN Endpoint N Control Register                                 */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+           uint32_t             :  1;
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous IN endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+      __IO uint32_t  TX_FIFO_NUM:  4;               /*!< TxFIFO Number                                                         */
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop transmitting data on an
+                                                         endpoint even before the transfer for that endpoint is complete       */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         transmit is setup                                                     */
+    } DIEPCTL15_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED89;
+  
+  union {
+    __IO uint32_t  DIEPINT15;                       /*!< Device IN Endpoint-n Interrupt Register                               */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  TIMEOUT    :  1;               /*!< a timeout condition on the USB for the last IN token on this
+                                                         endpoint                                                              */
+      __IO uint32_t  INTRWTFE   :  1;               /*!< IN Token Received When TxFIFO is Empty                                */
+      __IO uint32_t  INTRWEPM   :  1;               /*!< IN Token Received with EP Mismatch                                    */
+      __IO uint32_t  INEPNE     :  1;               /*!< IN Endpoint NAK Effective                                             */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  TFU        :  1;               /*!< Transmit FIFO Underrun                                                */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DIEPINT15_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED90;
+  
+  union {
+    __IO uint32_t  DIEPTSIZ15;                      /*!< Device IN Endpoint-n Transfer Size Register                           */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  MC         :  2;               /*!< the number of packets per microframe to periodic IN endpoints.
+                                                         The number of packets must be fetched per non-periodic IN endpoints   */
+    } DIEPTSIZ15_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DIEPDMA15;                         /*!< Device IN Endpoint-n DMA Address Register                             */
+  __IO uint16_t  DTXFSA15;                          /*!< Device IN Endpoint-n Transmit FIFO Space Avail Register               */
+  __I  uint16_t  RESERVED91;
+  __I  uint32_t  DIEPDMAB15;                        /*!< Device IN Endpoint-n DMA Buffer Address Register                      */
+  
+  union {
+    __IO uint32_t  DOEPCTL0;                        /*!< Device Control OUT Endpoint 0 Control Register                        */
+    
+    struct {
+      __IO uint32_t  MPS        :  2;               /*!< Indicates the maximum packet size of the associated endpoint,
+                                                         applies to IN and OUT endpoints                                       */
+           uint32_t             : 13;
+      __I  uint32_t  USBAE      :  1;               /*!< Always 1, indicating that control endpoint 0 is always active
+                                                         in all configurations and interfaces                                  */
+           uint32_t             :  1;
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint              */
+      __I  uint32_t  EP_TYPE    :  2;               /*!< Hardcoded to 00 for control                                           */
+      __IO uint32_t  SNOOP      :  1;               /*!< does not check if the OUT packets are correct before transferring     */
+      __IO uint32_t  STALL      :  1;               /*!< The application sets this bit, and the core clears it when a
+                                                         SETUP token is received for this endpoint                             */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+           uint32_t             :  2;
+      __I  uint32_t  EPD        :  1;               /*!< The application cannot disable control OUT endpoint 0                 */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL0_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED92;
+  
+  union {
+    __IO uint32_t  DOEPINT0;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT0_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED93;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ0;                       /*!< Device OUT Endpoint 0 Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       :  7;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+           uint32_t             : 12;
+      __IO uint32_t  PACKET_CNT :  1;               /*!< This field is decremented to zero after a packet is written
+                                                         into the RxFIFO                                                       */
+           uint32_t             :  9;
+      __IO uint32_t  SETUP_CNT  :  2;               /*!< the number of back-to-back SETUP data packets the endpoint can
+                                                         receive                                                               */
+    } DOEPTSIZ0_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA0;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED94;
+  __I  uint32_t  DOEPDMAB0;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL1;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL1_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED95;
+  
+  union {
+    __IO uint32_t  DOEPINT1;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT1_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED96;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ1;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ1_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA1;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED97;
+  __I  uint32_t  DOEPDMAB1;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL2;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL2_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED98;
+  
+  union {
+    __IO uint32_t  DOEPINT2;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT2_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED99;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ2;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ2_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA2;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED100;
+  __I  uint32_t  DOEPDMAB2;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL3;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL3_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED101;
+  
+  union {
+    __IO uint32_t  DOEPINT3;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT3_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED102;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ3;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ3_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA3;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED103;
+  __I  uint32_t  DOEPDMAB3;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL4;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL4_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED104;
+  
+  union {
+    __IO uint32_t  DOEPINT4;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT4_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED105;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ4;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ4_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA4;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED106;
+  __I  uint32_t  DOEPDMAB4;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL5;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL5_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED107;
+  
+  union {
+    __IO uint32_t  DOEPINT5;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT5_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED108;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ5;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ5_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA5;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED109;
+  __I  uint32_t  DOEPDMAB5;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL6;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL6_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED110;
+  
+  union {
+    __IO uint32_t  DOEPINT6;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT6_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED111;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ6;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ6_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA6;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED112;
+  __I  uint32_t  DOEPDMAB6;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL7;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL7_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED113;
+  
+  union {
+    __IO uint32_t  DOEPINT7;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT7_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED114;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ7;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ7_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA7;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED115;
+  __I  uint32_t  DOEPDMAB7;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL8;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL8_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED116;
+  
+  union {
+    __IO uint32_t  DOEPINT8;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT8_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED117;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ8;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ8_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA8;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED118;
+  __I  uint32_t  DOEPDMAB8;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL9;                        /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL9_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED119;
+  
+  union {
+    __IO uint32_t  DOEPINT9;                        /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT9_b;                                   /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED120;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ9;                       /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ9_b;                                  /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA9;                          /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED121;
+  __I  uint32_t  DOEPDMAB9;                         /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL10;                       /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL10_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED122;
+  
+  union {
+    __IO uint32_t  DOEPINT10;                       /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT10_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED123;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ10;                      /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ10_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA10;                         /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED124;
+  __I  uint32_t  DOEPDMAB10;                        /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL11;                       /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL11_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED125;
+  
+  union {
+    __IO uint32_t  DOEPINT11;                       /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT11_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED126;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ11;                      /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ11_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA11;                         /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED127;
+  __I  uint32_t  DOEPDMAB11;                        /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL12;                       /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL12_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED128;
+  
+  union {
+    __IO uint32_t  DOEPINT12;                       /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT12_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED129;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ12;                      /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ12_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA12;                         /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED130;
+  __I  uint32_t  DOEPDMAB12;                        /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL13;                       /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL13_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED131;
+  
+  union {
+    __IO uint32_t  DOEPINT13;                       /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT13_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED132;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ13;                      /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ13_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA13;                         /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED133;
+  __I  uint32_t  DOEPDMAB13;                        /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL14;                       /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL14_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED134;
+  
+  union {
+    __IO uint32_t  DOEPINT14;                       /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT14_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED135;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ14;                      /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ14_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA14;                         /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED136;
+  __I  uint32_t  DOEPDMAB14;                        /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+  
+  union {
+    __IO uint32_t  DOEPCTL15;                       /*!< Device OUT Endpoint N Control Register                                */
+    
+    struct {
+      __IO uint32_t  MPS        : 11;               /*!< Indicates the maximum packet size of the associated endpoint          */
+           uint32_t             :  4;
+      __IO uint32_t  UAE        :  1;               /*!< Indicates whether this endpoint is active                             */
+      __I  uint32_t  DPID       :  1;               /*!< Endpoint Data PID                                                     */
+      __I  uint32_t  NAK        :  1;               /*!< The core is transmitting NAK handshakes on this endpoint if
+                                                         set                                                                   */
+      __IO uint32_t  EP_TYPE    :  2;               /*!< Indicates the transfer type selected.                                 */
+      __IO uint32_t  EC         :  1;               /*!< Doesn't check the correctness of OUT packets before transferring      */
+      __IO uint32_t  STALL      :  1;               /*!< To non-control, non-isochronous OUT endpoints, stall all tokens.
+                                                         To control endpoints, response an ACK                                 */
+           uint32_t             :  4;
+      __O  uint32_t  CNAK       :  1;               /*!< A write to this bit clears the NAK bit for the endpoint               */
+      __O  uint32_t  SNAK       :  1;               /*!< A write to this bit sets the NAK bit for the endpoint                 */
+      __O  uint32_t  SET_D0_PID :  1;               /*!< Set DATA0 PID                                                         */
+      __O  uint32_t  SET_D1_PID :  1;               /*!< Set DATA1 PID                                                         */
+      __IO uint32_t  EPD        :  1;               /*!< The application sets this bit to stop receiving data on an endpoint
+                                                         even before the transfer for that endpoint is complete                */
+      __IO uint32_t  EPE        :  1;               /*!< the descriptor structure and data buffer with data ready to
+                                                         receive data is setup                                                 */
+    } DOEPCTL15_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED137;
+  
+  union {
+    __IO uint32_t  DOEPINT15;                       /*!< Device OUT Endpoint-n Interrupt Register                              */
+    
+    struct {
+      __IO uint32_t  TC         :  1;               /*!< Transfer completed normally without any errors                        */
+      __IO uint32_t  EPD        :  1;               /*!< Endpoint Disabled Interrupt                                           */
+      __IO uint32_t  AHB_ERR    :  1;               /*!< there is an AHB error during AHB read/write                           */
+      __IO uint32_t  SETUP      :  1;               /*!< Only for Control OUT endpoints, the SETUP phase for the control
+                                                         endpoint is complete                                                  */
+      __IO uint32_t  OUTTRWEPD  :  1;               /*!< OUT Token Received When Endpoint Disabled                             */
+      __IO uint32_t  SPRFCW     :  1;               /*!< Only for Control OUT endpoints, the host has switched from data
+                                                         phase to the status phase of a Control Write transfer                 */
+      __IO uint32_t  B2BSETUPPR :  1;               /*!< to Control OUT endpoints only, received more than three back-to-back
+                                                         SETUP packets for this particular endpoint                            */
+      __I  uint32_t  TFE        :  1;               /*!< either half or completely empty depending on GAHBCFG.NPTxFEmpLvl      */
+      __IO uint32_t  OUTPE      :  1;               /*!< an overflow or a CRC error for an OUT packet                          */
+      __IO uint32_t  BNA        :  1;               /*!< Buffer Not Available                                                  */
+           uint32_t             :  2;
+      __IO uint32_t  BE         :  1;               /*!< Babble Error                                                          */
+      __IO uint32_t  NAK        :  1;               /*!< a NAK is transmitted                                                  */
+      __IO uint32_t  NYET       :  1;               /*!< a NYET response is transmitted                                        */
+    } DOEPINT15_b;                                  /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED138;
+  
+  union {
+    __IO uint32_t  DOEPTSIZ15;                      /*!< Device OUT Endpoint-n Transfer Size Register                          */
+    
+    struct {
+      __IO uint32_t  SIZE       : 19;               /*!< Indicates the transfer size in bytes for endpoint 0                   */
+      __IO uint32_t  PACKET_CNT : 10;               /*!< the total number of USB packets                                       */
+      __IO uint32_t  SETUPCNT_PID:  2;              /*!< To control OUT Endpoints only, back-to-back SETUP data packets.
+                                                         To isochronous OUT endpoints, data PID received in the last
+                                                          packet                                                               */
+    } DOEPTSIZ15_b;                                 /*!< BitSize                                                               */
+  };
+  __IO uint32_t  DOEPDMA15;                         /*!< Device OUT Endpoint-n DMA Address Register                            */
+  __I  uint32_t  RESERVED139;
+  __I  uint32_t  DOEPDMAB15;                        /*!< Device OUT Endpoint-n DMA Buffer Address Register                     */
+} USB_Type;
+
+
+/* ================================================================================ */
+/* ================                   GLOBAL_CTRL                  ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief GLOBAL_CTRL (GLOBAL_CTRL)
+  */
+
+typedef struct {                                    /*!< GLOBAL_CTRL Structure                                                 */
+  
+  union {
+    __I  uint32_t  AES_STATUS;                      /*!< AES status                                                            */
+    
+    struct {
+      __I  uint32_t  RD_ALMOST_EMPTY:  1;           /*!< FIFO read almost empty                                                */
+      __I  uint32_t  RD_EMPTY   :  1;               /*!< FIFO read empty                                                       */
+      __I  uint32_t  WR_FULL_ALMOST:  1;            /*!< FIFO write almost full                                                */
+      __I  uint32_t  WR_FULL    :  1;               /*!< FIFO write full                                                       */
+      __I  uint32_t  IDLE       :  1;               /*!< decryption finish                                                     */
+    } AES_STATUS_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED0[253];
+  
+  union {
+    __IO uint32_t  CLK_SEL_0;                       /*!< clock select 0                                                        */
+    
+    struct {
+      __IO uint32_t  CAN1_CLK   :  2;               /*!< CAN1 clock frequency dividor based on system clock, which should
+                                                         be 1/32, 1/4, 1/8, 1/16 from 0 to 3                                   */
+      __IO uint32_t  CAN0_CLK   :  2;               /*!< CAN0 clock frequency dividor based on system clock, which should
+                                                         be 1/32, 1/4, 1/8, 1/16 from 0 to 3                                   */
+      __IO uint32_t  I2C1_CLK   :  2;               /*!< I2C1 clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  I2C0_CLK   :  2;               /*!< I2C0 clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  SPI1_CLK   :  2;               /*!< SPI1 clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  SPI0_CLK   :  2;               /*!< SPI0 clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  UART1_CLK  :  2;               /*!< UART1 clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  UART0_CLK  :  2;               /*!< UART0 clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  RTC_CLK    :  2;               /*!< RTC clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  GPIO_CLK   :  2;               /*!< GPIO clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  TIMER_CLK  :  2;               /*!< TIMER clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  WDG_CLK    :  2;               /*!< watchdog clock frequency dividor based on system clock, which
+                                                         should be 1/2, 1/4, 1/8, 1/16 from 0 to 3                             */
+           uint32_t             :  2;
+      __IO uint32_t  FLASH_CLK  :  2;               /*!< FLASH clock frequency dividor based on system clock, which should
+                                                         be 1/1, 1/2, 1/4, 1/8 from 0 to 3                                     */
+      __IO uint32_t  DMA_AHB_CLK:  2;               /*!< DMA AHB bus clock frequency dividor based on system clock, which
+                                                         should be 1/1, 1/2, 1/4, 1/8 from 0 to 3                              */
+      __IO uint32_t  USB_AHB_CLK:  2;               /*!< USB AHB bus clock frequency dividor based on system clock, which
+                                                         should be 1/1, 1/2, 1/4, 1/8 from 0 to 3                              */
+    } CLK_SEL_0_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CLK_SEL_1;                       /*!< clock select 1                                                        */
+    
+    struct {
+      __IO uint32_t  ETH_AHB_CLK:  2;               /*!< ETH_AHB clock frequency dividor based on system clock, which
+                                                         should be 1/1, 1/2, 1/4, 1/8 from 0 to 3                              */
+      __IO uint32_t  DDR_CLK    :  2;               /*!< DDR clock frequency dividor based on system clock, which should
+                                                         be 1/1, 1/2, 1/4, 1/8 from 0 to 3                                     */
+           uint32_t             :  4;
+      __IO uint32_t  ADC_CLK    :  2;               /*!< ADC clock frequency dividor based on system clock, which should
+                                                         be 1/8, 1/16, 1/32, external from 0 to 3                              */
+      __IO uint32_t  EFUSE_CLK  :  2;               /*!< EFUSE clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  SYS_CLK    :  4;               /*!< system clock clock frequency dividor based on system clock,
+                                                         which should be oscillator(0), DLL(1), crystal(2), external(3),
+                                                          JTAG(4), PS(8)                                                       */
+      __IO uint32_t  UART2_CLK  :  2;               /*!< UART2 clock frequency dividor based on system clock, which should
+                                                         be 1/2, 1/4, 1/8, 1/16 from 0 to 3                                    */
+      __IO uint32_t  UTMI_CLK   :  1;               /*!< UTMI clock came from on-chip usb phy(0) or off-chip usb phy(1)        */
+    } CLK_SEL_1_b;                                  /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  USB_PHY_CTRL;                    /*!< USB Phy Control Register                                              */
+    
+    struct {
+      __IO uint32_t  BITSTUFF   :  1;               /*!< 0: No bit stuff                                                       */
+      __IO uint32_t  XTLSEL     :  1;               /*!< 0: 12MHz                                                              */
+      __IO uint32_t  PLL        :  1;               /*!< PLL mode                                                              */
+      __IO uint32_t  VOLDET     :  1;               /*!< Voltage Detector Enable, 0: Disable                                   */
+      __IO uint32_t  IDUP       :  1;               /*!< 0: ID is uplled up through 33k Ohm resister                           */
+      __IO uint32_t  CKISEL     :  1;               /*!< Clock selection, 0: Crystal, 1: Internal Clock                        */
+      __IO uint32_t  FMOD       :  1;               /*!< 1: Normal                                                             */
+      __IO uint32_t  SQUELCH    :  3;               /*!< Squelch Reference Voltage, 000: 27.5mV, 001: 137.5mV, 111: 220mV      */
+      __IO uint32_t  HDISCDT    :  3;               /*!< Host Disconnect Detection Reference Voltage, 000: 500mV, 100:
+                                                         588mV, 111: 654mV                                                     */
+      __IO uint32_t  PRTSEL     :  1;               /*!< 0: Internal OTG PHY, 1: UTMI to External PHY                          */
+      __IO uint32_t  RSTPRT     :  1;               /*!< 0: The reverse of usb_rst_n will reset, 1: Reset OTG PHY              */
+    } USB_PHY_CTRL_b;                               /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RTC_INT_EN;                      /*!< RTC interrupt enable Register                                         */
+    
+    struct {
+      __IO uint32_t  SECOND     :  1;               /*!< 1s interrupt enable                                                   */
+      __IO uint32_t  MILLSECOND :  1;               /*!< 1ms interrupt enable                                                  */
+    } RTC_INT_EN_b;                                 /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED1;
+  
+  union {
+    __IO uint32_t  NMI_SEL;                         /*!< nmi interrupt selection                                               */
+    
+    struct {
+      __IO uint32_t  NMI        :  7;               /*!< NMI interrupt ID                                                      */
+    } NMI_SEL_b;                                    /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED2;
+  __IO uint32_t  AES_TARGET_ADDR;                   /*!< AES target address, default is frame decoder address(0x41800000)      */
+  
+  union {
+    __IO uint32_t  AES_BURST_TYPE;                  /*!< AES burst type                                                        */
+    
+    struct {
+      __IO uint32_t  TYPE       :  2;               /*!< burst type, fixed(0), incr(1)                                         */
+    } AES_BURST_TYPE_b;                             /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED3[3];
+  
+  union {
+    __IO uint32_t  ICACHE;                          /*!< ICACHE Enable                                                         */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< ICACHE Enable                                                         */
+    } ICACHE_b;                                     /*!< BitSize                                                               */
+  };
+  __IO uint32_t  IBUSOFF;                           /*!< Code Bus Offset                                                       */
+  __IO uint32_t  DBUSOFF;                           /*!< Data Bus Offset                                                       */
+  __IO uint32_t  EXTADDR;                           /*!< Bus Ext Addr                                                          */
+} GLOBAL_CTRL_Type;
+
+
+/* ================================================================================ */
+/* ================                       AES                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief AES (AES)
+  */
+
+typedef struct {                                    /*!< AES Structure                                                         */
+  __IO uint32_t  FIFO;                              /*!< data FIFO to be decoded                                               */
+  
+  union {
+    __O  uint32_t  FIFO_CLEAR;                      /*!< clear data FIFO                                                       */
+    
+    struct {
+      __O  uint32_t  CLEAR      :  1;               /*!< clear after write 1 and write 0                                       */
+    } FIFO_CLEAR_b;                                 /*!< BitSize                                                               */
+  };
+} AES_Type;
+
+
+/* ================================================================================ */
+/* ================                      DDRC                      ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief DDR_CFG (DDRC)
+  */
+
+typedef struct {                                    /*!< DDRC Structure                                                        */
+  __IO uint32_t  CMD;                               /*!< DDR commands to program                                               */
+  
+  union {
+    __IO uint32_t  CTRL;                            /*!< DDR Control                                                           */
+    
+    struct {
+      __IO uint32_t  TO         :  1;               /*!< Take over DDRC siggen                                                 */
+      __IO uint32_t  CLR        :  1;               /*!< Clear commands in FIFO                                                */
+      __O  uint32_t  STR        :  1;               /*!< Start to execute the commands in FIFO                                 */
+    } CTRL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  MODE;                            /*!< DDR mode                                                              */
+    
+    struct {
+      __IO uint32_t  MODE       :  6;               /*!< DDRC Mode                                                             */
+           uint32_t             :  2;
+      __IO uint32_t  LANE       :  1;               /*!< LANE synchronization logic bypass                                     */
+           uint32_t             :  3;
+      __IO uint32_t  ADEC       :  1;               /*!< address decoder mapping                                               */
+           uint32_t             :  3;
+      __IO uint32_t  B16        :  2;               /*!< Active 16 bit DQ position when the unmber of DQ IO is 16              */
+           uint32_t             :  6;
+      __IO uint32_t  CLKPOL     :  2;               /*!< DQS clkpol set by user on the PHY                                     */
+    } MODE_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  QUE;                             /*!< DDRC queue depth                                                      */
+    
+    struct {
+      __IO uint32_t  DEPTH      :  1;               /*!< DDRC queue depth                                                      */
+    } QUE_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  REF;                             /*!< Refresh control                                                       */
+    
+    struct {
+      __IO uint32_t  THRD       :  5;               /*!< Number of refresh requests which can be postponed                     */
+           uint32_t             :  3;
+      __IO uint32_t  TRIG       :  4;               /*!< Number of refresh requests every dl_refi                              */
+           uint32_t             :  4;
+      __IO uint32_t  TIME       : 16;               /*!< Refresh interval time                                                 */
+    } REF_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  REF_TRIG;                        /*!< Refresh trigger                                                       */
+    
+    struct {
+      __O  uint32_t  GO         :  1;               /*!< Write 1 to trigger one refresh request by cbus                        */
+    } REF_TRIG_b;                                   /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  ZQ_TRIG;                         /*!< ZQCTL trigger                                                         */
+    
+    struct {
+      __O  uint32_t  CS         :  1;               /*!< Write 1 to trigger one ZQCS request by cbus                           */
+      __O  uint32_t  CL         :  1;               /*!< Write 1 to trigger one ZQCL request by cbus                           */
+    } ZQ_TRIG_b;                                    /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ZQCSR;                           /*!< ZQCSR                                                                 */
+    
+    struct {
+      __IO uint32_t  EN         :  1;               /*!< Enable ZQCS request                                                   */
+      __IO uint32_t  PRI        :  1;               /*!< 0: DMA access prior to ZQCS, 1: ZQCS prior to DMA access              */
+    } ZQCSR_b;                                      /*!< BitSize                                                               */
+  };
+  __IO uint32_t  ZQCSI;                             /*!< ZQCS interval time                                                    */
+  
+  union {
+    __IO uint32_t  RCD;                             /*!< t(RCD)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  5;               /*!< t(RCD), delay from ACT command to RW command of same bank             */
+    } RCD_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RAS;                             /*!< t(RAS)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  6;               /*!< t(RAS), delay from ACT command to PRE command of same bank            */
+    } RAS_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RP;                              /*!< t(RP)                                                                 */
+    
+    struct {
+      __IO uint32_t  DI         :  5;               /*!< t(RP), delay from PRE command to ACT/REF/ZQ command                   */
+           uint32_t             :  3;
+      __IO uint32_t  RPA        :  1;               /*!< 0: t(RP) delay for PREA command; 1: t(RP)+1 delay for PREA command    */
+    } RP_b;                                         /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RC;                              /*!< t(RC)                                                                 */
+    
+    struct {
+      __IO uint32_t  DI         :  7;               /*!< t(RC), delay from ACT command to ACT command of same bank             */
+    } RC_b;                                         /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RRD;                             /*!< t(RRD)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  4;               /*!< t(RRD), delay from ACT command to ACT command                         */
+    } RRD_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  CCD;                             /*!< t(CCD)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  3;               /*!< t(CCD), delay from RW command to RW command                           */
+    } CCD_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RTW;                             /*!< t(RTW)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  5;               /*!< t(RTW), delay from RD command to WR command                           */
+    } RTW_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  WTR;                             /*!< t(WTR)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  5;               /*!< t(WTR), delay from WR command to RD command                           */
+    } WTR_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RTP;                             /*!< t(RTP)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  3;               /*!< t(RTP), delay from RD command to PRE command of same bank             */
+    } RTP_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  WTP;                             /*!< t(WTP)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  6;               /*!< t(WTP), delay from WR command to PRE command of same bank             */
+    } WTP_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RFC;                             /*!< t(RFC)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  8;               /*!< t(WTP), delay from WR command to PRE command of same bank             */
+    } RFC_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ZQCL;                            /*!< t(ZQoper)                                                             */
+    
+    struct {
+      __IO uint32_t  DI         :  9;               /*!< t(ZQoper), delay from ZQCL command to REF/ZQ/ACT command              */
+    } ZQCL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ZQCS;                            /*!< t(ZQCS)                                                               */
+    
+    struct {
+      __IO uint32_t  DI         :  7;               /*!< t(ZQCS), delay from ZQCS command to REF/ZQ/ACT command                */
+    } ZQCS_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  FAW;                             /*!< t(FAW)                                                                */
+    
+    struct {
+      __IO uint32_t  DI         :  6;               /*!< t(FAW), 4 act command window time                                     */
+    } FAW_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  BURST;                           /*!< BURST                                                                 */
+    
+    struct {
+      __IO uint32_t  LEN        :  1;               /*!< 0: length 8, 1: length 4                                              */
+    } BURST_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  PHUNG;                           /*!< PHUNG                                                                 */
+    
+    struct {
+      __IO uint32_t  MODE       :  1;               /*!< 0: normal mode, 1: prevent read hang mode                             */
+      __IO uint32_t  LPM        :  1;               /*!< 1: stop the IO clk                                                    */
+    } PHUNG_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RL;                              /*!< READ Latency                                                          */
+    
+    struct {
+      __IO uint32_t  VAL        :  5;               /*!< READ Latency                                                          */
+    } RL_b;                                         /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  WL;                              /*!< WRITE Latency                                                         */
+    
+    struct {
+      __IO uint32_t  VAL        :  5;               /*!< WRITE Latency                                                         */
+    } WL_b;                                         /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TRAIN;                           /*!< TRAIN                                                                 */
+    
+    struct {
+      __IO uint32_t  EN         :  4;               /*!< Enable lane N training mode                                           */
+    } TRAIN_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DQSEN0;                          /*!< Delay cycles of dqsen of byte lane 0                                  */
+    
+    struct {
+      __IO uint32_t  DL         :  3;               /*!< Delay cycles of dqsen of byte lane 0                                  */
+    } DQSEN0_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DQSEN1;                          /*!< Delay cycles of dqsen of byte lane 1                                  */
+    
+    struct {
+      __IO uint32_t  DL         :  3;               /*!< Delay cycles of dqsen of byte lane 1                                  */
+    } DQSEN1_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DQSEN2;                          /*!< Delay cycles of dqsen of byte lane 2                                  */
+    
+    struct {
+      __IO uint32_t  DL         :  3;               /*!< Delay cycles of dqsen of byte lane 2                                  */
+    } DQSEN2_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  DQSEN3;                          /*!< Delay cycles of dqsen of byte lane 0                                  */
+    
+    struct {
+      __IO uint32_t  DL         :  3;               /*!< Delay cycles of dqsen of byte lane 3                                  */
+    } DQSEN3_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ODTH;                            /*!< Delay from WR command to odt high transition                          */
+    
+    struct {
+      __IO uint32_t  DL         :  5;               /*!< Delay from WR command to odt high transition                          */
+    } ODTH_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ODTL;                            /*!< Delay from WR command to odt low transition                           */
+    
+    struct {
+      __IO uint32_t  DL         :  5;               /*!< Delay from WR command to odt low transition                           */
+    } ODTL_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  ODT;                             /*!< Used in write leveling mode                                           */
+    
+    struct {
+      __O  uint32_t  TRIG       :  1;               /*!< 0: trigger odt low, 1: trigger odt high                               */
+    } ODT_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __O  uint32_t  DQS;                             /*!< Used in write leveling mode                                           */
+    
+    struct {
+      __O  uint32_t  TRIG       :  1;               /*!< Writing 1 to this register triggers a dqs pulse                       */
+    } DQS_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  STA;                             /*!< Commands FIFO                                                         */
+    
+    struct {
+      __I  uint32_t  MODE       :  1;               /*!< DDRC in sw_proc mode                                                  */
+      __I  uint32_t  EMPTY      :  1;               /*!< Sw_proc command fifo empty                                            */
+      __I  uint32_t  FULL       :  1;               /*!< Sw_proc command fifo full                                             */
+    } STA_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INTCTL;                          /*!< Interrupt Control                                                     */
+    
+    struct {
+      __IO uint32_t  DONE       :  1;               /*!< 0: the sw_proc_done int will not be masked, 1: the sw_proc_done
+                                                         int will be masked                                                    */
+      __IO uint32_t  ERR        :  1;               /*!< mask of the lane_sync_error interrupt                                 */
+           uint32_t             : 14;
+      __IO uint32_t  MODE       :  1;               /*!< Interrupt mode: 0: int level active, write 1 to clear; 1: int
+                                                         edge active                                                           */
+    } INTCTL_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INTRAW;                          /*!< Interrupt RAW                                                         */
+    
+    struct {
+      __IO uint32_t  DONE       :  1;               /*!< Int register of sw_proc_done before mask                              */
+      __IO uint32_t  ERR        :  1;               /*!< int reg of the lane sync error before masked                          */
+    } INTRAW_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  INTSTA;                          /*!< Interrupt STA                                                         */
+    
+    struct {
+      __IO uint32_t  DONE       :  1;               /*!< Int register of sw_proc_done after mask                               */
+      __IO uint32_t  ERR        :  1;               /*!< int register of lane sync error after masked                          */
+    } INTSTA_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  PHY;                             /*!< PHY                                                                   */
+    
+    struct {
+      __IO uint32_t  RST        :  1;               /*!< FPGA version, reset read dq fifo. Low active                          */
+    } PHY_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RDQ;                             /*!< FPGA version, read dq delay of byte lane N                            */
+    
+    struct {
+      __IO uint32_t  L3         :  6;               /*!< FPGA version, read dq delay of byte lane3                             */
+           uint32_t             :  2;
+      __IO uint32_t  L2         :  6;               /*!< FPGA version, read dq delay of byte lane2                             */
+           uint32_t             :  2;
+      __IO uint32_t  L1         :  6;               /*!< FPGA version, read dq delay of byte lane3                             */
+           uint32_t             :  2;
+      __IO uint32_t  L0         :  7;               /*!< FPGA version, read dq delay of byte lane0                             */
+    } RDQ_b;                                        /*!< BitSize                                                               */
+  };
+  
+  union {
+    __I  uint32_t  CALIB;                           /*!< calibration                                                           */
+    
+    struct {
+      __I  uint32_t  TPU        :  8;               /*!< calibration result values, if fail then 0x40                          */
+      __I  uint32_t  TPD        :  8;               /*!< calibration result values, if fail then 0x40                          */
+      __I  uint32_t  PDR        :  5;               /*!< calibration result values, if fail then 0x40                          */
+      __I  uint32_t  NDR        :  5;               /*!< calibration result values, if fail then 0x40                          */
+           uint32_t             :  5;
+      __IO uint32_t  EN         :  1;               /*!< trigger the calibration processing which is sensitive to the
+                                                         positive edge                                                         */
+    } CALIB_b;                                      /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  ITMDLY;                          /*!< "itmdly" is the fine delay trim to the read path "dq", "itmsdly"
+                                                         is to the read path of "dqs". From 000 to 111 increasingly,
+                                                          each step is about 40ps                                              */
+    
+    struct {
+      __IO uint32_t  I0         :  4;               /*!< itmdly0                                                               */
+      __IO uint32_t  IS0        :  4;               /*!< itmsdly0                                                              */
+      __IO uint32_t  I1         :  4;               /*!< itmdly1                                                               */
+      __IO uint32_t  IS1        :  4;               /*!< itmsdly1                                                              */
+      __IO uint32_t  I2         :  4;               /*!< itmdly2                                                               */
+      __IO uint32_t  IS2        :  4;               /*!< itmsdly2                                                              */
+      __IO uint32_t  I3         :  4;               /*!< itmdly3                                                               */
+      __IO uint32_t  IS3        :  4;               /*!< itmsdly3                                                              */
+    } ITMDLY_b;                                     /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  TUNE;                            /*!< CALIB_TUNE                                                            */
+    
+    struct {
+      __IO uint32_t  TPU        :  4;               /*!< tpu_tune, finial val = tune[3] ? val - tune : val + tune              */
+      __IO uint32_t  TPD        :  4;               /*!< tpd_tune, tune[3:0] for TPD/TPU, [2:0] is the tune val                */
+      __IO uint32_t  PDR        :  4;               /*!< pdr_tune, inial val = tune[2] ? val - tune : val + tune               */
+      __IO uint32_t  NDR        :  4;               /*!< ndr_tune, tune[2:0] for NDR/PDR, [1:0] is the tune val                */
+    } TUNE_b;                                       /*!< BitSize                                                               */
+  };
+  
+  union {
+    __IO uint32_t  RD_SEL;                          /*!< RD_WINDOWS_SEL                                                        */
+    
+    struct {
+      __IO uint32_t  PHY_SEL    :  3;               /*!< To fix the phy read valid issue, this is to adjust the read
+                                                         data valid window to match the phy read valid by cycle level          */
+    } RD_SEL_b;                                     /*!< BitSize                                                               */
+  };
+} DDRC_Type;
+
+
+/* ================================================================================ */
+/* ================                     PDLOCK                     ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief PLL DLL LOCK (PDLOCK)
+  */
+
+typedef struct {                                    /*!< PDLOCK Structure                                                      */
+  
+  union {
+    __I  uint32_t  GCLK;                            /*!< GCLK                                                                  */
+    
+    struct {
+      __I  uint32_t  C1R2P      :  1;               /*!< gclk_c1r2_pll_lock                                                    */
+      __I  uint32_t  C1R1P      :  1;               /*!< gclk_c1r1_pll_lock                                                    */
+      __I  uint32_t  C2R1P      :  1;               /*!< gclk_c2r1_pll_lock                                                    */
+      __I  uint32_t  C2R2P      :  1;               /*!< gclk_c2r2_pll_lock                                                    */
+      __I  uint32_t  C1R2D      :  1;               /*!< gclk_c1r2_dll_lock                                                    */
+      __I  uint32_t  C1R1D      :  1;               /*!< gclk_c1r1_dll_lock                                                    */
+      __I  uint32_t  C2R1D      :  1;               /*!< gclk_c2r1_dll_lock                                                    */
+      __I  uint32_t  C2R2D      :  1;               /*!< gclk_c2r2_dll_lock                                                    */
+    } GCLK_b;                                       /*!< BitSize                                                               */
+  };
+} PDLOCK_Type;
+
+
+/* ================================================================================ */
+/* ================                     PDPROT                     ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief PLL DLL PROTECT (PDPROT)
+  */
+
+typedef struct {                                    /*!< PDPROT Structure                                                      */
+  
+  union {
+    __O  uint32_t  LOCK;                            /*!< LOCK                                                                  */
+    
+    struct {
+      __O  uint32_t  EN         :  1;               /*!< Enable the PLL DLL Lock to Protect it                                 */
+    } LOCK_b;                                       /*!< BitSize                                                               */
+  };
+} PDPROT_Type;
+
+
+/* ================================================================================ */
+/* ================                    CFG_CTRL                    ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief CFG_CTRL (CFG_CTRL)
+  */
+
+typedef struct {                                    /*!< CFG_CTRL Structure                                                    */
+  __I  uint32_t  RESERVED0[3];
+  
+  union {
+    __IO uint32_t  DONE;                            /*!< DONE CFG                                                              */
+    
+    struct {
+      __IO uint32_t  CMD        :  1;               /*!< Write 1 indicate all chain data write over                            */
+      __IO uint32_t  STA        :  1;               /*!< 1= all chain config process over, chip is in user mode                */
+    } DONE_b;                                       /*!< BitSize                                                               */
+  };
+  __I  uint32_t  RESERVED1[34];
+  
+  union {
+    __IO uint32_t  PDLLSTR;                         /*!< PLL DLL RESET                                                         */
+    
+    struct {
+      __IO uint32_t  C1R1P      :  1;               /*!< C1r1_rstpll_n, low active                                             */
+      __IO uint32_t  C1R2P      :  1;               /*!< C1r2_rstpll_n, low active                                             */
+      __IO uint32_t  C2R1P      :  1;               /*!< C2r1_rstpll_n, low active                                             */
+      __IO uint32_t  C2R2P      :  1;               /*!< C2r2_rstpll_n, low active                                             */
+      __IO uint32_t  C1R1D      :  1;               /*!< C1r1_rstdll_n, low active                                             */
+      __IO uint32_t  C1R2D      :  1;               /*!< C1r2_rstdll_n, low active                                             */
+      __IO uint32_t  C2R1D      :  1;               /*!< C2r1_rstdll_n, low active                                             */
+      __IO uint32_t  C2R2D      :  1;               /*!< C2r2_rstdll_n, low active                                             */
+    } PDLLSTR_b;                                    /*!< BitSize                                                               */
+  };
+} CFG_CTRL_Type;
+
+
+/* ================================================================================ */
+/* ================                   SOFT_RESET                   ================ */
+/* ================================================================================ */
+
+
+/**
+  * @brief SUB SOFT RESET (SOFT_RESET)
+  */
+
+typedef struct {                                    /*!< SOFT_RESET Structure                                                  */
+  
+  union {
+    __IO uint32_t  SOFTRST;                         /*!< SOFTRST                                                               */
+    
+    struct {
+      __IO uint32_t  CAN1_n     :  1;               /*!< soft_rst_can1_n                                                       */
+      __IO uint32_t  CAN0_n     :  1;               /*!< soft_rst_can0_n                                                       */
+      __IO uint32_t  I2C1_n     :  1;               /*!< soft_rst_i2c1_n                                                       */
+      __IO uint32_t  I2C0_n     :  1;               /*!< soft_rst_i2c0_n                                                       */
+      __IO uint32_t  SPI1_n     :  1;               /*!< soft_rst_spi1_n                                                       */
+      __IO uint32_t  SPI0_n     :  1;               /*!< soft_rst_spi0_n                                                       */
+      __IO uint32_t  UART1_n    :  1;               /*!< soft_rst_uart1_n                                                      */
+      __IO uint32_t  UART0_n    :  1;               /*!< soft_rst_uart0_n                                                      */
+      __IO uint32_t  RTC_n      :  1;               /*!< soft_rst_rtc_n                                                        */
+      __IO uint32_t  GPIO_n     :  1;               /*!< soft_rst_gpio_n                                                       */
+      __IO uint32_t  TIMER_n    :  1;               /*!< soft_rst_timer_n                                                      */
+      __IO uint32_t  WDT_n      :  1;               /*!< soft_rst_wdt_n                                                        */
+      __IO uint32_t  LVDS_n     :  1;               /*!< soft_rst_lvds_n                                                       */
+      __IO uint32_t  FLS_n      :  1;               /*!< soft_rst_fls_n                                                        */
+      __IO uint32_t  DMAC_AHB_n :  1;               /*!< soft_rst_dmac_ahb_n                                                   */
+      __IO uint32_t  USB_AHB_n  :  1;               /*!< soft_rst_usb_ahb_n                                                    */
+      __IO uint32_t  ETH_AHB_n  :  1;               /*!< soft_rst_eth_ahb_n                                                    */
+      __IO uint32_t  DDRC_n     :  1;               /*!< soft_rst_ddrc_n                                                       */
+      __IO uint32_t  ARM_HCLK_n :  1;               /*!< soft_rst_arm_HCLK_n                                                   */
+      __IO uint32_t  _48_n      :  1;               /*!< soft_rst_48_n                                                         */
+      __IO uint32_t  UTM_n      :  1;               /*!< soft_rst_utmi_n                                                       */
+      __IO uint32_t  CACHE_n    :  1;               /*!< soft_rst_cache_n                                                      */
+      __IO uint32_t  USB_n      :  1;               /*!< soft_rst_cache_n                                                      */
+      __IO uint32_t  ETH_RX_n   :  1;               /*!< soft_rst_eth_rx_i_n                                                   */
+      __IO uint32_t  ETH_TX_n   :  1;               /*!< soft_rst_eth_tx_i_n                                                   */
+      __IO uint32_t  ADC_n      :  1;               /*!< soft_rst_adc_n                                                        */
+      __IO uint32_t  EFUSE_n    :  1;               /*!< soft_rst_efuse_n                                                      */
+      __IO uint32_t  Reserved1_n:  1;               /*!< Reserved11                                                            */
+      __IO uint32_t  AES_n      :  1;               /*!< soft_rst_aes_n                                                        */
+      __IO uint32_t  UART2_n    :  1;               /*!< soft_rst_uart2_n                                                      */
+      __IO uint32_t  AS_n       :  1;               /*!< soft_rst_as_n                                                         */
+      __IO uint32_t  FDCD_n     :  1;               /*!< soft_rst_fdcd_n                                                       */
+    } SOFTRST_b;                                    /*!< BitSize                                                               */
+  };
+} SOFT_RESET_Type;
+
+
+/* --------------------  End of section using anonymous unions  ------------------- */
+#if defined(__CC_ARM)
+  #pragma pop
+#elif defined(__ICCARM__)
+  /* leave anonymous unions enabled */
+#elif defined(__GNUC__)
+  /* anonymous unions are enabled by default */
+#elif defined(__TMS470__)
+  /* anonymous unions are enabled by default */
+#elif defined(__TASKING__)
+  #pragma warning restore
+#else
+  #warning Not supported compiler type
+#endif
+
+
+
+
+/* ================================================================================ */
+/* ================              Peripheral memory map             ================ */
+/* ================================================================================ */
+
+#define UART0_BASE                      0x41005000UL
+#define UART1_BASE                      0x4100C000UL
+#define UART2_BASE                      0x4100E000UL
+#define WDG_BASE                        0x41001000UL
+#define TIMER0_BASE                     0x41000000UL
+#define TIMER1_BASE                     0x41000020UL
+#define TIMER2_BASE                     0x41000040UL
+#define TIMER3_BASE                     0x41000060UL
+#define SPI0_BASE                       0x41004000UL
+#define SPI1_BASE                       0x4100B000UL
+#define I2C0_BASE                       0x41003000UL
+#define I2C1_BASE                       0x4100A000UL
+#define RTC_BASE                        0x41007004UL
+#define GPIO_BASE                       0x41002000UL
+#define NOR_FLASH_BASE                  0x40800000UL
+#define ADC_BASE                        0x41006000UL
+#define EFUSE_BASE                      0x41008000UL
+#define CAN0_BASE                       0x41009000UL
+#define CAN1_BASE                       0x4100D000UL
+#define DMA_BASE                        0x41500000UL
+#define ETH_BASE                        0x41200000UL
+#define USB_BASE                        0x41300000UL
+#define GLOBAL_CTRL_BASE                0x41007010UL
+#define AES_BASE                        0x41600000UL
+#define DDRC_BASE                       0x41400000UL
+#define PDLOCK_BASE                     0x41007000UL
+#define PDPROT_BASE                     0x41007C00UL
+#define CFG_CTRL_BASE                   0x41700000UL
+#define SOFT_RESET_BASE                 0x41007400UL
+
+
+/* ================================================================================ */
+/* ================             Peripheral declaration             ================ */
+/* ================================================================================ */
+
+#define UART0                           ((UART0_Type              *) UART0_BASE)
+#define UART1                           ((UART0_Type              *) UART1_BASE)
+#define UART2                           ((UART0_Type              *) UART2_BASE)
+#define WDG                             ((WDG_Type                *) WDG_BASE)
+#define TIMER0                          ((TIMER0_Type             *) TIMER0_BASE)
+#define TIMER1                          ((TIMER0_Type             *) TIMER1_BASE)
+#define TIMER2                          ((TIMER0_Type             *) TIMER2_BASE)
+#define TIMER3                          ((TIMER0_Type             *) TIMER3_BASE)
+#define SPI0                            ((SPI0_Type               *) SPI0_BASE)
+#define SPI1                            ((SPI0_Type               *) SPI1_BASE)
+#define I2C0                            ((I2C0_Type               *) I2C0_BASE)
+#define I2C1                            ((I2C0_Type               *) I2C1_BASE)
+#define RTC                             ((RTC_Type                *) RTC_BASE)
+#define GPIO                            ((GPIO_Type               *) GPIO_BASE)
+#define NOR_FLASH                       ((NOR_FLASH_Type          *) NOR_FLASH_BASE)
+#define ADC                             ((ADC_Type                *) ADC_BASE)
+#define EFUSE                           ((EFUSE_Type              *) EFUSE_BASE)
+#define CAN0                            ((CAN0_Type               *) CAN0_BASE)
+#define CAN1                            ((CAN0_Type               *) CAN1_BASE)
+#define DMA                             ((DMA_Type                *) DMA_BASE)
+#define ETH                             ((ETH_Type                *) ETH_BASE)
+#define USB                             ((USB_Type                *) USB_BASE)
+#define GLOBAL_CTRL                     ((GLOBAL_CTRL_Type        *) GLOBAL_CTRL_BASE)
+#define AES                             ((AES_Type                *) AES_BASE)
+#define DDRC                            ((DDRC_Type               *) DDRC_BASE)
+#define PDLOCK                          ((PDLOCK_Type             *) PDLOCK_BASE)
+#define PDPROT                          ((PDPROT_Type             *) PDPROT_BASE)
+#define CFG_CTRL                        ((CFG_CTRL_Type           *) CFG_CTRL_BASE)
+#define SOFT_RESET                      ((SOFT_RESET_Type         *) SOFT_RESET_BASE)
+
+
+/** @} */ /* End of group Device_Peripheral_Registers */
+/** @} */ /* End of group cmem7 */
+/** @} */ /* End of group (null) */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* cmem7_H */
+

+ 269 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_adc.h

@@ -0,0 +1,269 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_adc.h
+	*
+	* @brief    CMEM7 ADC header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_ADC_H
+#define __CMEM7_ADC_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup ADC_PERIPH
+  * @{
+  */
+typedef enum {
+	ADC_PERIPH_1,
+	ADC_PERIPH_2,
+} ADC_PERIPH;
+
+#define IS_ADC_ALL_PERIPH(PERIPH)         (((PERIPH) == ADC_PERIPH_1) || \
+                                           ((PERIPH) == ADC_PERIPH_2))
+
+/**
+  * @}
+  */
+
+/** @defgroup ADC_VSEN
+  * @{
+  */
+#define ADC_VSEN_VDDCORE                  1
+#define ADC_VSEN_VDDIO                    2
+#define ADC_VSEN_VDDIO2                   4
+
+#define IS_ADC_VSEN(VSEN)                 (((VSEN) == ADC_VSEN_VDDCORE) || \
+                                           ((VSEN) == ADC_VSEN_VDDIO) || \
+                                           ((VSEN) == ADC_VSEN_VDDIO2))
+
+/**
+  * @}
+  */
+
+/** @defgroup ADC_PHASE_CTRL
+  * @{
+  */
+#define ADC_PHASE_CTRL_0DEG_RISE_EDGE     0         /* ADC-1 and ADC-2 CLK are 0DEG Phase Difference(Rising Edge) */                                               
+#define ADC_PHASE_CTRL_90DEG_AHEAD        1         /* ADC-1 90DEG ahead of ADC-2 */
+#define ADC_PHASE_CTRL_90DEG_LAG          2         /* ADC-1 90DEG lag of ADC-2 */
+#define ADC_PHASE_CTRL_0DEG_FALL_EDGE     3         /* ADC-1 and ADC-2 CLK are 0DEG Phase Difference(falling Edge) */
+
+#define IS_ADC_PHASE_CTRL(CTRL)           (((CTRL) == ADC_PHASE_CTRL_0DEG_RISE_EDGE) || \
+                                           ((CTRL) == ADC_PHASE_CTRL_90DEG_AHEAD) || \
+                                           ((CTRL) == ADC_PHASE_CTRL_90DEG_LAG) || \
+                                           ((CTRL) == ADC_PHASE_CTRL_0DEG_FALL_EDGE))
+/**
+  * @}
+  */
+
+/** @defgroup ADC_CONVERSION
+  * @{
+  */
+#define ADC_SYSTEM_MODE_SINGLE_CONV       1
+#define ADC_SYSTEM_MODE_CONTINUOUS_CONV   2	
+
+#define IS_ADC_CONVERSION(CONV)           (((CONV) == ADC_SYSTEM_MODE_SINGLE_CONV) || \
+                                           ((CONV) == ADC_SYSTEM_MODE_CONTINUOUS_CONV))
+																					 
+/**
+  * @}
+  */
+
+/** @defgroup ADC_CALIBRATION
+  * @{
+  */
+#define ADC_CALIBRATION_OFFSET            3
+#define ADC_CALIBRATION_NEGTIVE_GAIN      4
+#define ADC_CALIBRATION_POSTIVE_GAIN      5
+
+#define IS_ADC_CALIBRATION(CALIB)         (((CALIB) == ADC_CALIBRATION_OFFSET) || \
+                                           ((CALIB) == ADC_CALIBRATION_NEGTIVE_GAIN) || \
+                                           ((CALIB) == ADC_CALIBRATION_POSTIVE_GAIN))
+/**
+  * @}
+  */
+
+/** @defgroup ADC_CHANNEL
+  * @{
+  */
+#define ADC_CHANNEL_CALIBRATION           0x0
+
+/**
+  * @}
+  */
+
+/** @defgroup ADC1_CHANNEL
+  * @{
+  */
+#define ADC1_CHANNEL_VIP                  0x1		
+#define ADC1_CHANNEL_VSEN                 0x2
+#define ADC1_CHANNEL_VADIO_0              0x4
+#define ADC1_CHANNEL_VADIO_1              0x8
+#define ADC1_CHANNEL_VADIO_2              0x10
+#define ADC1_CHANNEL_VADIO_3              0x20
+#define ADC1_CHANNEL_VADIO_4              0x40
+#define ADC1_CHANNEL_VADIO_5              0x80
+#define ADC1_CHANNEL_ALL                  0xFF
+
+#define IS_ADC1_CHANNEL(CHANNEL)          (((CHANNEL) != 0) && ((CHANNEL) & ~ADC1_CHANNEL_ALL) == 0)
+/**
+  * @}
+  */
+
+/** @defgroup ADC2_CHANNEL
+  * @{
+  */																																										 
+#define ADC2_CHANNEL_VIN                  0x1		
+#define ADC2_CHANNEL_VTMP                 0x2
+#define ADC2_CHANNEL_VADIO_6              0x4
+#define ADC2_CHANNEL_VADIO_7              0x8
+#define ADC2_CHANNEL_VADIO_8              0x10
+#define ADC2_CHANNEL_VADIO_9              0x20
+#define ADC2_CHANNEL_VADIO_10             0x40
+#define ADC2_CHANNEL_VADIO_11             0x80
+#define ADC2_CHANNEL_ALL                  0xFF
+
+#define IS_ADC2_CHANNEL(CHANNEL)          (((CHANNEL) != 0) && ((CHANNEL) & ~ADC2_CHANNEL_ALL) == 0)                                          																 
+/**
+  * @}
+  */
+
+/** @defgroup ADC_INT
+  * @{
+  */																					 
+#define ADC1_INT_ALMOST_FULL              0x1 
+#define ADC2_INT_ALMOST_FULL              0x8
+#define ADC_INT_ALL              					0x9
+
+#define IS_ADC_INT(INT)        						(((INT) != 0) && (((INT) & ~ADC_INT_ALL) == 0))
+/**
+  * @}
+  */
+
+/**
+  * @brief  ADC collection data structure
+	*/ 
+typedef struct {
+	uint8_t channel;												/*!< The channel of collected data, is a value of 
+																							 @ref ADC_CHANNEL, @ref ADC1_CHANNEL or @ref ADC2_CHANNEL */
+	uint16_t data;													/*!< collected data                    												*/
+} ADC_Data;
+
+/**
+  * @brief  ADC initialization structure
+	*/ 
+typedef struct
+{
+	uint8_t ADC_PhaseCtrl;                  /*!< Phase between ADC1 and ADC2, is a value of @ref ADC_PHASE_CTRL */
+	uint8_t ADC_VsenSelection;              /*!< ADC1 VSEN selection, is a value of @ref ADC_VSEN					*/
+} ADC_InitTypeDef;
+
+/**
+  * @brief  ADC initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] init A pointer to structure ADC_InitTypeDef
+  * @retval None
+	*/ 
+void ADC_Init(ADC_InitTypeDef* init);
+
+/**
+  * @brief  Enable or disable ADC. 
+	* @param[in] adc ADC peripheral, which is a value of @ref ADC_PERIPH
+	* @param[in] Enable The bit indicates if the specific ADC is enable or not
+  * @retval None
+	*/ 
+void ADC_Enable(uint8_t adc, BOOL enable);
+
+/**
+  * @brief  Enable or disable ADC interrupt. 
+	* @param[in] Int interrupt mask bits, which can be a combination of @ref ADC_INT
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void ADC_EnableInt(uint32_t Int, BOOL enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] Int interrupt mask bits, which can be a combination of @ref ADC_INT
+	* @retval BOOL The bit indicates if the specific interrupts are set or not
+	*/
+BOOL ADC_GetIntStatus(uint32_t Int);
+
+/**
+  * @brief  Clear specific interrupts
+	* @param[in] Int interrupt mask bits, which can be a value of @ref ADC_INT
+  * @retval None
+	*/
+void ADC_ClearInt(uint32_t Int);
+
+/**
+  * @brief  ADC starts to convert data 
+	* @param[in] adc ADC peripheral, which is a value of @ref ADC_PERIPH
+	* @param[in] convMode It should be a value of @ref ADC_CONVERSION
+	* @param[in] channel It should be the value of @ref ADC1_CHANNEL 
+	* 					 or @ref ADC2_CHANNEL according to parameter 'adc'
+  * @retval BOOL The bit indicates if the specific ADC starts to convert data
+	*/ 
+BOOL ADC_StartConversion(uint8_t adc, uint8_t convMode, uint32_t channel);
+
+/**
+  * @brief  ADC starts to calibrate and produces one sample
+	* @param[in] adc ADC peripheral, which is a value of @ref ADC_PERIPH
+	* @param[in] convMode It should be a value of @ref ADC_CALIBRATION
+  * @retval BOOL The bit indicates if the specific ADC starts to convert data
+	*/ 
+BOOL ADC_StartCalibration(uint8_t adc, uint8_t calibration);
+
+/**
+  * @brief  ADC stops conversion or calibration
+	* @param[in] adc ADC peripheral, which is a value of @ref ADC_PERIPH
+	* @retval NULL
+	*/ 
+void ADC_Stop(uint8_t adc);
+
+/**
+  * @brief  Check if ADC is busy or not
+	* @param[in] adc ADC peripheral, which is a value of @ref ADC_PERIPH
+	* @retval BOOL The bit indicates if the specific ADC is busy or not
+	*/ 
+BOOL ADC_IsBusy(uint8_t adc);
+
+/**
+  * @brief  Read data from ADC
+	* @param[in] adc ADC peripheral, which is a value of @ref ADC_PERIPH
+	* @param[in] Size Expected data size to be read
+	* @param[out] data A user-allocated buffer to fetch data to be read
+  * @retval uint8_t Actual read data size
+	*/
+uint8_t ADC_Read(uint8_t adc, uint8_t size, ADC_Data* data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__CMEM7_ADC_H */
+

+ 52 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_aes.h

@@ -0,0 +1,52 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_aes.h
+	*
+	* @brief    CMEM7 AES header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_AES_H
+#define __CMEM7_AES_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/**
+  * @brief  AES decryption
+	* @param[in] src A pointer to data to be decrypted
+	* @param[out] dst A user-allocated buffer to fetch decrypted data
+  * @param[in] len Expected data size to be decrypted, which should
+	*						 be multiply times of 16
+	* @retval BOOL True if succeed, or flase
+	*/
+BOOL AES_Decrypt(const void *src, void *dst, uint32_t len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_AES_H */
+

+ 237 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_can.h

@@ -0,0 +1,237 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_can.h
+	*
+	* @brief    CMEM7 CAN header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_CAN_H
+#define __CMEM7_CAN_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+	 
+#define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN0) || \
+                                   ((PERIPH) == CAN1))
+
+/** @defgroup CAN_FLT
+  * @{
+  */																
+#define CAN_FLT_STANDARD_SINGLE    0x00000000
+#define CAN_FLT_STANDARD_DUAL      0x00000001
+#define CAN_FLT_EXTENDED_SINGLE    0x00000002
+#define CAN_FLT_EXTENDED_DUAL      0x00000003
+
+#define IS_CAN_FLT_TYPE(FILTER)    (((FILTER) == CAN_FLT_STANDARD_SINGLE) || \
+                                    ((FILTER) == CAN_FLT_STANDARD_DUAL) || \
+																		((FILTER) == CAN_FLT_EXTENDED_SINGLE) || \
+                                    ((FILTER) == CAN_FLT_EXTENDED_DUAL))	
+																		
+#define IS_CAN_FLT_SINGLE(FILTER)  (((FILTER) == CAN_FLT_STANDARD_SINGLE) || \
+                                    ((FILTER) == CAN_FLT_EXTENDED_SINGLE))
+
+#define IS_CAN_FLT_DUAL(FILTER)    (IS_CAN_FLT_TYPE(FILTER) && \
+                                    !IS_CAN_FLT_SINGLE(FILTER))
+																		
+/**
+  * @}
+  */
+
+/** @defgroup CAN_CDR_DIV
+  * @{
+  */
+#define CAN_CDR_DIV_1_2            0x0
+#define CAN_CDR_DIV_1_4            0x1
+#define CAN_CDR_DIV_1_6            0x2
+#define CAN_CDR_DIV_1_8            0x3
+#define CAN_CDR_DIV_1_10           0x4
+#define CAN_CDR_DIV_1_12           0x5
+#define CAN_CDR_DIV_1_14           0x6
+#define CAN_CDR_DIV_1_1            0x7
+
+#define IS_CAN_CDR_DIV(DIV)        (((DIV) == CAN_CDR_DIV_1_2) || \
+                                    ((DIV) == CAN_CDR_DIV_1_4) || \
+																		((DIV) == CAN_CDR_DIV_1_6) || \
+																		((DIV) == CAN_CDR_DIV_1_8) || \
+																		((DIV) == CAN_CDR_DIV_1_10) || \
+																		((DIV) == CAN_CDR_DIV_1_12) || \
+																		((DIV) == CAN_CDR_DIV_1_14) || \
+																		((DIV) == CAN_CDR_DIV_1_1))		
+/**
+  * @}
+  */
+
+/** @defgroup CAN_INT
+  * @{
+  */
+#define CAN_INT_RBNF               0x01
+#define CAN_INT_TB_UNLOCK          0x02
+#define CAN_INT_ERR                0x04
+#define CAN_INT_DATA_OVERRUN       0x08
+#define CAN_INT_WAKEUP             0x10
+#define CAN_INT_ERR_PASSIVE        0x20
+#define CAN_INT_ARBITRATION_LOST   0x40
+#define CAN_INT_BUS_ERR            0x80
+#define CAN_INT_All                0xFF
+
+#define IS_CAN_INT(INT)            (((INT) != 0) && (((INT) & ~CAN_INT_All) == 0))                                  
+/**
+  * @}
+  */
+
+/**
+  * @brief  CAN standard filter structure
+	*/ 
+typedef struct {
+	uint16_t  ID28_18;               /*!< 11 bits                                      */
+  BOOL      RTR;                   /*!< if remote frame                              */
+	uint8_t   data1;                 /*!< data byte 1, if not 2nd CAN_FLT_STANDARD_DUAL*/
+	uint8_t   data2;                 /*!< data byte 2, if CAN_FLT_STANDARD_SINGLE      */
+} CAN_STANDARD_FILTER;
+
+/**
+  * @brief  CAN extended filter structure
+	*/
+typedef struct {
+	uint16_t  ID28_13;               /*!< 16 bits                                      */
+	uint16_t  ID12_0;                /*!< 13 bits, if CAN_FLT_EXTENDED_SINGLE          */
+  BOOL      RTR;                   /*!< if remote frame, if CAN_FLT_EXTENDED_SINGLE  */
+} CAN_EXTENDED_FILTER;
+
+/**
+  * @brief  CAN filter structure
+	*/
+typedef struct {
+	uint8_t   type;                  /*!< Filter type, which is a value of @ref CAN_FLT */
+	
+	/**
+  * @brief  accepted filter
+	*/
+	union {
+		CAN_STANDARD_FILTER sf;				 
+		CAN_EXTENDED_FILTER ef;				 
+	} ACCEPT;												 
+	
+	/**
+  * @brief  filter mask 
+	*/
+	union {
+		CAN_STANDARD_FILTER sf;        
+		CAN_EXTENDED_FILTER ef;				 
+	} MASK;													 
+} CAN_FILTER;
+
+/**
+  * @brief  CAN initialization structure
+	*/
+typedef struct {	
+	BOOL CAN_TxEn;            			 /*!< if transmission is enable 										*/
+	BOOL CAN_Loopback;        			 /*!< loop back mode without phy						 				*/
+  uint8_t CAN_ClockDiv;     			 /*!< input clock divider, ref as @ref CAN_CDR_DIV  */                               
+	uint16_t CAN_Prescaler;   			 /*!< Specifies the length of a time quantum. 
+																				Time quantum = (CAN_Prescaler + 1) * 2 * input clock */ 
+  uint8_t CAN_SJW;          			 /*!< Specifies the maximum number of time quanta 
+																				the CAN hardware is allowed to lengthen or 
+																				shorten a bit to perform resynchronization.		*/
+	uint8_t CAN_TSEG1;        			 /*!< the maximum number of time quanta of 
+																				propagation and 1st phase segment 						*/
+  uint8_t CAN_TSEG2;        			 /*!< the maximum number of time quanta of 2nd 
+																				phase segment																	*/	
+  BOOL CAN_HighSpeed;       			 /*!< if CAN is running on high speed bus (class C) */
+} CAN_InitTypeDef;
+
+/**
+  * @brief  CAN frame structure
+	*/
+typedef struct
+{
+  BOOL SFF;        								 /*!< If standard or extended frame format 					*/ 
+	uint32_t Id;     								 /*!< Specifies the identifier.This parameter can 
+																				be a value between 0 to 0x1FFFFFFF. 					*/
+  BOOL RTR;        								 /*!< Specifies if the frame is a remote frame      */
+  uint8_t DLC;     								 /*!< Specifies the length of the frame, which is 
+																				a value between  0 to 8 											*/
+  uint8_t Data[8]; 								 /*!< Frame data																		*/
+} CAN_Frame;
+
+/**
+  * @brief  CAN initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] CANx CAN peripheral, which is CAN0 or CAN1
+	* @param[in] Init A pointer to structure CAN_InitTypeDef
+	* @param[in] f1 A pointer to structure CAN_FILTER
+	* @param[in] f2 NULL if single filter, or a pointer to second filter while dual filters
+  * @retval BOOL The bit indicates if specific CAN is initialized or not
+	*/ 
+BOOL CAN_Init(CAN0_Type* CANx, CAN_InitTypeDef* Init, 
+  CAN_FILTER *f1, CAN_FILTER *f2);
+
+/**
+  * @brief  CAN is set to sleep or wake up
+  * @param[in] CANx CAN peripheral, which is CAN0 or CAN1
+	* @param[in] Enable The bit indicates if sleep mode is enable or not
+	* @retval None
+	*/
+void CAN_SetSleepMode(CAN0_Type* CANx, BOOL enable);
+
+/**
+  * @brief  Enable or disable UART interrupt. 
+	* @param[in] CANx CAN peripheral, which is CAN0 or CAN1
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref CAN_INT
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void CAN_EnableInt(CAN0_Type* CANx, uint32_t Int, BOOL enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @note   All interrupts except for receive int are cleared after call this func.
+	* @param[in] CANx CAN peripheral, which is CAN0 or CAN1
+	* @retval uint8_t CAN interrupt bits, which can be the combination of @ref CAN_INT
+	*/
+uint8_t CAN_GetIntStatus(CAN0_Type* CANx);
+
+/**
+  * @brief  CAN perform to transmit data
+	* @param[in] CANx CAN peripheral, which is CAN0 or CAN1
+	* @param[in] frame A pointer to the CAN_Frame to be transmitted
+	* @retval BOOL The bit indicates if data is transmitted or not
+	*/ 
+BOOL CAN_Transmit(CAN0_Type* CANx, CAN_Frame* frame);
+
+/**
+  * @brief  CAN perform to receive data
+	* @param[in] CANx CAN peripheral, which is CAN0 or CAN1
+	* @param[out] frame A user-allocated buffer to fetch received frame
+	* @retval BOOL The bit indicates if data is recieved or not
+	*/
+BOOL CAN_Receive(CAN0_Type* CANx, CAN_Frame* frame);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_CAN_H */

+ 115 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_conf.h

@@ -0,0 +1,115 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_conf.h
+	*
+	* @brief    CMEM7 config file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#ifndef __CMEM7_CONF_H
+#define __CMEM7_CONF_H
+
+#define _ADC
+#define _AES
+#define _CAN
+#define _DDR
+#define _DMA
+#define _EFUSE
+#define _ETH
+#define _FLASH
+#define _GPIO
+#define _I2C
+#define _MISC
+#define _RTC
+#define _SPI
+#define _TIM
+#define _UART
+#define _USB
+#define _WDG
+
+//#define _MARVELL
+//#define _IP1826D
+#define _M7NORFLASH
+#define _ME_6095_F
+
+#define USE_FULL_ASSERT    1 
+
+#ifdef  USE_FULL_ASSERT
+/**
+  * @brief  The assert_param macro is used for function's parameters check.
+  * @param  expr: If expr is false, it calls assert_failed function which reports
+  *         the name of the source file and the source line number of the call
+  *         that failed. If expr is true, it returns no value.
+  * @retval None
+  */
+  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((unsigned char *)__FILE__, __LINE__))
+
+	static void assert_failed(unsigned char* file, unsigned long line) {
+		while (1) {
+			;
+		}
+	}
+#else
+  #define assert_param(expr) ((void)0)
+#endif /* USE_FULL_ASSERT */
+
+typedef enum _BOOL {FALSE = 0, TRUE = 1} BOOL;
+
+/**
+  * System clock frequency, unit is Hz.
+  */
+#define SYSTEM_CLOCK_FREQ        300000000 
+//250000000
+//300000000
+
+/**
+  * @brief  usecond delay 
+	* @note 	It can't delay in an accurate time
+	* @param[in] usec usecond to be delay
+	* @retval None
+	*/
+static void udelay(unsigned long usec) {
+  unsigned long count = 0;
+  unsigned long utime = SYSTEM_CLOCK_FREQ / 1000000 * usec;
+
+  while(++count < utime) ;
+}
+
+/**
+  * UART definition for print
+	*/
+#define PRINT_UART							UART2
+
+/**
+  * DDR type definition
+  */
+#define DDR_TYPE				3	// 2 for DDR2, 3 for DDR3
+
+#if (DDR_TYPE == 3)
+# define DDR_SIZE				(256 << 20)
+#elif (DDR_TYPE == 2)
+# define DDR_SIZE				(128 << 20)
+#else
+# error
+#endif
+
+#endif /* __CMEM7_CONF_H */
+

+ 185 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_ddr.h

@@ -0,0 +1,185 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_ddr.h
+	*
+	* @brief    CMEM7 AES header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_DDR_H
+#define __CMEM7_DDR_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+/** @defgroup _MEM_TYPE
+  * @{
+  */
+enum _MEM_TYPE 
+{
+	MEM_DDR2=1,
+	MEM_DDR3		
+} ;	
+/**
+  * @}
+  */
+
+/** @defgroup _BUS_WIDTH
+  * @{
+  */
+enum _BUS_WIDTH
+{
+	BUS_WIDTH_8,
+	BUS_WIDTH_16,
+	BUS_WIDTH_MAX
+};
+/**
+  * @}
+  */
+/** @defgroup _CHIP_TYPE
+  * @{
+  */  
+enum _CHIP_TYPE
+{
+	_32Mbx8,
+	_64Mbx8,
+	_128Mbx8,
+	_256Mbx8,
+	_512Mbx8,
+	_16Mbx16,
+	_32Mbx16,
+	_64Mbx16,
+	_128Mbx16,
+	_256Mbx16,
+	_512Mbx16,
+	CHIP_TYPE_MAX
+};
+/**
+  * @}
+  */
+
+/** @defgroup _CHIP_NUM
+  * @{
+  */  
+enum _CHIP_NUM
+{
+	CHIP_NUM_x1,
+	CHIP_NUM_x2,
+	CHIP_NUM_MAX
+};
+/**
+  * @}
+  */
+  
+/** @defgroup MEM_CHIP_INFO
+  * @{
+  */
+typedef struct {
+	uint8_t mem_type;     /*!< ddr type @ref _MEM_TYPE*/
+	uint8_t Bus_width;	/*!< ddr qs bus width @ref _BUS_WIDTH*/
+	uint8_t Chip_type;	/*!< chip type @ref _CHIP_TYPE*/
+	uint8_t Chip_num;	/*!< chip number @ref _CHIP_NUM*/
+	uint8_t Chip_bank;      /*!< chip bank number*/		
+} MEM_CHIP_INFO;								
+/**
+  * @}
+  */
+
+
+/** @defgroup DDR2MEM
+  * @{
+  */
+typedef struct {
+	uint32_t tCK;       		/*!< Period of clock(ps), not data period */ 
+	uint32_t tCL;						/*!< tCL */
+	uint32_t tRCD;						/*!< tRCD */
+	uint32_t tRP;						/*!< tRP */
+	uint32_t tRC;						/*!< tRC */
+	uint32_t tRAS;						/*!< tRAS */
+	uint32_t tWR;						/*!< tWR */
+	uint32_t tRRD;						/*!< tRRD */
+	uint32_t tWTR;						/*!< tWTR */
+	uint32_t tRTP;						/*!< tRTP */
+	uint32_t tFAW;						/*!< tFAW */
+} DDR2MEM;								/*!< DDR2ʱÐò¶¨Òå */
+/**
+  * @}
+  */
+
+/** @defgroup DDR3MEM
+  * @{
+  */
+typedef struct {
+	uint32_t tCK;       		/*!< Period of clock(ps), not data period */ 
+	uint32_t tCL;						/*!< tCL */
+	uint32_t tWCL;						/*!< tWCL */
+	uint32_t tRCD;						/*!< tRCD */
+	uint32_t tRAS;						/*!< tRAS */
+	uint32_t tRP;						/*!< tRP */
+	uint32_t tRC;						/*!< tRC */
+	uint32_t tRRD;						/*!< tRRD */
+	uint32_t tFAW;						/*!< tFAW */
+	uint32_t tWR;						/*!< tWR */
+	uint32_t tRTP;						/*!< tRTP */
+	uint32_t tZQoper;					/*!< tZQCL */
+	uint32_t tZQCS;						/*!< tZQCS */
+} DDR3MEM;								/*!< DDR3ʱÐò¶¨Òå */
+/**
+  * @}
+  */
+
+/** @defgroup DDR2PREDEF
+  * @{
+  */
+extern const DDR2MEM DDR2PREDEF[];		/*!< Pre-defined DDR2 Timing in library */
+#define DDR2_400C			0			/*!< sg5E: DDR2-400C CL=4, tCK=5000ps */
+
+/**
+  * @}
+  */
+
+/** @defgroup DDR3PREDEF
+  * @{
+  */
+extern const DDR3MEM DDR3PREDEF[];		/*!< Pre-defined DDR3 Timing in library */
+#define DDR3_400		  	0
+#define DDR3_667        1
+
+/**
+  * @}
+  */
+
+/**
+ * @brief DDR Timing Configuration
+   * @param[in] chip information ,A pointer to struct @ref MEM_CHIP_INFO
+   * @param[in] ddr A pointer to struct @ref DDR2MEM or @ref DDR3MEM that specified DDR Timing. Some typital DDR2/3 Timings are defined in arrays @ref DDR2PREDEF and @ref DDR3PREDEF.
+ * @retval void
+   */
+BOOL  DDR_Init(const MEM_CHIP_INFO *chip_info, const void *ddr);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_DDR_H */
+

+ 116 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_dma.h

@@ -0,0 +1,116 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_dma.h
+	*
+	* @brief    CMEM7 DMA header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_DMA_H
+#define __CMEM7_DMA_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup DMA_Int
+  * @{
+  */
+#define DMA_Int_TfrComplete                0x00000001    
+#define DMA_Int_Err                        0x00000002
+#define DMA_Int_All                        0x00000003
+
+#define IS_DMA_INT(INT)        (((INT) != 0) && (((INT) & ~DMA_Int_All) == 0))
+/**
+  * @}
+  */ 
+
+/**
+  * @brief  Descriptor structure
+	*	@note		DMA requires users provides a list of descriptors to operation.
+	*					Meanwhile, memory occupied by descriptors should be in physical
+	*					memory and keep valid during DMA transfer.
+	*/ 
+typedef struct {                      
+	uint32_t srcAddr;                  /*!< source address 														*/		
+	uint32_t dstAddr;                  /*!< destination address 											*/	
+	uint32_t number;                   /*!< block byte number, no more than 2K Bytes 	*/
+	uint32_t nextBlock;                /*!< next block descriptor 										*/
+	uint32_t padding;                  /*!< Nonsense, only used to fill 							*/
+} BLOCK_DESC;
+	
+/**
+  * @brief  DMA initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param  None
+	* @retval None
+	*/ 
+void DMA_Init(void);
+
+/**
+  * @brief  Enable or disable DMA interrupt. 
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref DMA_Int
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void DMA_EnableInt(uint32_t Int, BOOL enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref DMA_Int
+  * @retval BOOL The bit indicates if specific interrupts are set or not
+	*/
+BOOL DMA_GetIntStatus(uint32_t Int);
+
+/**
+  * @brief  Clear specific interrupts
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref DMA_Int
+  * @retval None
+	*/
+void DMA_ClearInt(uint32_t Int);
+
+/**
+  * @brief  DMA transfer
+	* @note		Make sure that memory occupied by descriptors should be in physical
+	*					memory and keep valid before DMA transfer is finished (Return false by
+	*					calling DMA_IsBusy after DMA transfer started).
+	* @param[in] blockList A pointer to header of list of BLOCK_DESC
+  * @retval BOOL The bit indicates if DMA begins to transfer
+	* @see		DMA_IsBusy
+	*/
+BOOL DMA_Transfer(BLOCK_DESC *blockList);
+
+/**
+  * @brief  DMA is busy or not
+  * @param  None
+	* @retval BOOL The bit indicates if DMA is busy or not
+	*/ 
+BOOL DMA_IsBusy(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_DMA_H */
+

+ 114 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_efuse.h

@@ -0,0 +1,114 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_efuse.h
+	*
+	* @brief    CMEM7 EFUSE header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_EFUSE_H
+#define __CMEM7_EFUSE_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup EFUSE_TMRF_R
+  * @{
+  */
+#define EFUSE_TMRF_R_3000                0
+#define EFUSE_TMRF_R_1200                1
+#define EFUSE_TMRF_R_750                 2
+
+#define IS_EFUSE_TMRF(R)                 (((R) == EFUSE_TMRF_R_3000) || \
+                                          ((R) == EFUSE_TMRF_R_1200) || \
+                                          ((R) == EFUSE_TMRF_R_750))
+/**
+  * @}
+  */
+
+/**
+  * @brief  EFUSE timing structure
+	*/
+typedef struct
+{
+	uint32_t EFUSE_Tpwph;                  /*!< Nano second                                    */
+  uint32_t EFUSE_Trac;                   /*!< Nano second                                    */
+	uint32_t EFUSE_Trah;                   /*!< Nano second                                    */
+	uint32_t EFUSE_Trpw;                   /*!< Nano second                                    */
+	uint32_t EFUSE_Trc;                    /*!< Nano second                                    */
+	uint32_t EFUSE_Tesr;                   /*!< Nano second                                    */
+	uint32_t EFUSE_Tprs;                   /*!< Nano second                                    */
+	uint32_t EFUSE_Tpi;                    /*!< Nano second                                    */
+	uint32_t EFUSE_Tpp;                    /*!< Nano second                                    */
+	uint32_t EFUSE_Teps;                   /*!< Nano second                                    */
+	uint32_t EFUSE_Tpwps;                  /*!< Nano second                                    */
+} EFUSE_Timing;
+
+/**
+  * @brief  EFUSE initialization structure
+	*/
+typedef struct
+{
+	uint8_t EFUSE_ClockDividor;       		 /*!< EFUSE clock dividor, 2 in n times */
+	uint8_t EFUSE_TMRF;                    /*!< EFUSE reference resistor select, @ref EFUSE_TMRF_R */
+  EFUSE_Timing* timing;                  /*!< Timing configuration, null if default           */
+} EFUSE_InitTypeDef;
+
+/**
+  * @brief  EFUSE key structure
+	*/
+typedef struct
+{
+	uint32_t key0;                         /*!< EFUSE AES key [31:0]                            */
+  uint32_t key1;                         /*!< EFUSE AES key [63:32]                           */
+	uint32_t key2;                         /*!< EFUSE AES key [95:64]                           */
+	uint32_t key3;                         /*!< EFUSE AES key [127:96]                          */
+	uint32_t key4;                         /*!< EFUSE AES key [159:128]                         */
+  uint32_t key5;                         /*!< EFUSE AES key [191:160]                         */
+	uint32_t key6;                         /*!< EFUSE AES key [223:192]                         */
+	uint32_t key7;                         /*!< EFUSE AES key [255:224]                         */
+} EFUSE_AesKey;
+
+/**
+  * @brief  EFUSE initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] init A pointer to structure EFUSE_InitTypeDef
+  * @retval None
+	*/ 
+void EFUSE_Init(EFUSE_InitTypeDef* init);
+
+/**
+  * @brief  EFUSE initialization
+  * @param[in] key A pointer to EFUSE_AesKey to be compared
+  * @retval BOOL True if equal, or false if different
+	*/ 
+BOOL EFUSE_Compare(EFUSE_AesKey* key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_EFUSE_H */
+

+ 417 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_eth.h

@@ -0,0 +1,417 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_eth.h
+	*
+	* @brief    CMEM7 ethernet header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_ETH_H
+#define __CMEM7_ETH_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup ETH_SPEED
+  * @{
+  */
+#define ETH_SPEED_10M               0x0
+#define ETH_SPEED_100M              0x1
+#define ETH_SPEED_1000M             0x2
+
+#define IS_ETH_SPEED(SPEED)    			(((SPEED) == ETH_SPEED_10M)  || \
+                                     ((SPEED) == ETH_SPEED_100M) || \
+																		 ((SPEED) == ETH_SPEED_1000M))
+/**
+  * @}
+  */
+
+/** @defgroup ETH_DUPLEX
+  * @{
+  */
+#define ETH_DUPLEX_HALF             0x0
+#define ETH_DUPLEX_FULL             0x1
+
+#define IS_ETH_DUPLEX(DUPLEX)  			(((DUPLEX) == ETH_DUPLEX_HALF) || \
+																		 ((DUPLEX) == ETH_DUPLEX_FULL))
+/**
+  * @}
+  */
+
+/** @defgroup ETH_INT
+  * @{
+  */																			
+#define ETH_INT_TX_COMPLETE_FRAME		0x0001
+#define ETH_INT_TX_STOP             0x0002
+#define ETH_INT_TX_BUF_UNAVAI       0x0004
+#define ETH_INT_RX_OVERFLOW					0x0010
+#define ETH_INT_TX_UNDERFLOW				0x0020
+#define ETH_INT_RX_COMPLETE_FRAME   0x0040
+#define ETH_INT_RX_BUF_UNAVAI       0x0080
+#define ETH_INT_RX_STOP             0x0100
+#define ETH_INT_BUS_FATAL_ERROR     0x2000
+#define ETH_INT_ALL                 (ETH_INT_TX_COMPLETE_FRAME | \
+                                     ETH_INT_TX_STOP           | \
+																		 ETH_INT_TX_BUF_UNAVAI     | \
+																		 ETH_INT_RX_OVERFLOW       | \
+																		 ETH_INT_TX_UNDERFLOW      | \
+																		 ETH_INT_RX_COMPLETE_FRAME | \
+																		 ETH_INT_RX_BUF_UNAVAI     | \
+																		 ETH_INT_RX_STOP           | \
+																		 ETH_INT_BUS_FATAL_ERROR)
+
+#define IS_ETH_INT(INT)             (((INT) != 0) && (((INT) & ~ETH_INT_ALL) == 0))
+/**
+  * @}
+  */
+/**
+  * @brief  EFUSE receive filter structure
+	*/
+typedef struct
+{
+	BOOL ETH_BroadcastFilterEnable;   /*!< Broadcast is dropped or passed								        */ 
+	BOOL ETH_OwnFilterEnable;	        /*!< source address filter is on or off     							*/
+	BOOL ETH_SelfDrop;				  			/*!< Only own address is dropped or passed								*/
+	BOOL ETH_SourceFilterEnable;	    /*!< source address filter is on or off     							*/
+	BOOL ETH_SourceDrop;				      /*!< Only specific source address is dropped or passed  	*/
+	uint8_t ETH_SourceMacAddr[6];     /*!< Source MAC address                                   */
+} ETH_FrameFilter;
+
+/**
+  * @brief  Ethernet initialization structure
+	*/ 
+typedef struct
+{
+    BOOL ETH_LinkUp;                   /*!< If ETH is linked up and it can be retrieved from PHY */																	  
+	uint8_t ETH_Speed;                 /*!< speed of ETH, refer as @ref ETH_SPEED                */
+    uint8_t ETH_Duplex;                /*!< duplex mode of ETH, refer as @ref ETH_DUPLEX				 */
+	BOOL ETH_RxEn;                     /*!< Rx enable                                            */
+	BOOL ETH_TxEn;                     /*!< Tx enable                                            */
+	BOOL ETH_ChecksumOffload;          /*!< Checksum offload enable                              */
+	BOOL ETH_JumboFrame;               /*!< Jumbo Frame Enable                                   */
+	uint8_t ETH_MacAddr[6];            /*!< MAC address                                          */ 
+    ETH_FrameFilter *ETH_Filter;       /*!< Received frame address filter, receive all if null   */
+} ETH_InitTypeDef;
+
+/**
+  * @brief  Ethernet Tx descriptor structure
+	*/ 
+typedef struct { 
+	union {
+    uint32_t  TX0;
+		
+		struct {
+			uint32_t 								:  1;
+			uint32_t UNDERFLOW_ERR  :  1; 	 /*!< [OUT] Underflow error            											*/
+			uint32_t 								:  1;
+			uint32_t COLLISION_CNT	:  4;		 /*!< [OUT] Collision count				                          */
+			uint32_t 								:  1;
+			uint32_t EX_COLLISION 	:  1;		 /*!< [OUT] Excessive collision error	                      */
+			uint32_t LATE_COLLISION :  1;		 /*!< [OUT] Late collision error	                          */
+			uint32_t NO_CARRIER     :  1;		 /*!< [OUT] No carrier error                          			*/
+			uint32_t LOSS_CARRIER   :  1;		 /*!< [OUT] loss of carrier error                          	*/
+			uint32_t PAYLOAD_ERR 		:  1;		 /*!< [OUT] IP payload error                          			*/
+			uint32_t 								:  2;
+			uint32_t ERR_SUM 				:  1;		 /*!< [OUT] Error summary		                          			*/
+			uint32_t HEADER_ERR 		:  1;		 /*!< [OUT] IP header error                          				*/
+			uint32_t 								:  8;
+			uint32_t TTSE           :  1; 	 /*!< enables IEEE1588 hardware timestamping in first segment */
+			uint32_t 								:  2;
+			uint32_t FS           	:  1; 	 /*!< first segment flag                                    */
+			uint32_t LS           	:  1; 	 /*!< last segment flag                                     */
+			uint32_t 								:  2;
+		} TX0_b;
+	} TX_0;
+	
+	union {
+    uint32_t  TX1;
+		
+		struct {
+			uint32_t SIZE						: 13; 	 	/*!< buffer size                                       */
+			uint32_t                : 19;
+		} TX1_b;
+	} TX_1;
+	
+	uint32_t bufAddr;											/*!< address of buffer						                     */
+	uint32_t nextDescAddr;								/*!< address of next descriptor		                     */
+  uint64_t reserved;
+	uint64_t timeStamp;									 	/*!< time stamp while last segment                     */
+} ETH_TX_DESC;
+
+/**
+  * @brief  Ethernet Rx descriptor structure
+	*/ 
+typedef struct { 
+	union {
+    uint32_t  RX0;
+		
+		struct {
+			uint32_t 								:  1;
+			uint32_t CRC_ERR        :  1; 	 /*!< [OUT] CRC error while last segment                		*/
+			uint32_t 								:  5;
+			uint32_t TTSE           :  1; 	 /*!< timestamp available while last segment                */
+			uint32_t LS           	:  1; 	 /*!< [OUT] last segment flag                               */
+			uint32_t FS           	:  1; 	 /*!< [OUT] first segment flag                              */
+			uint32_t 								:  1;
+			uint32_t OVERFLOW_ERR   :  1; 	 /*!< [OUT] FIFO overflow while last segment                */
+			uint32_t LENGTH_ERR     :  1; 	 /*!< [OUT] length error while last segment                	*/
+			uint32_t 								:  2;
+			uint32_t ERR_SUM        :  1; 	 /*!< [OUT] Error summary while last segment              	*/
+			uint32_t FL           	: 14; 	 /*!< [OUT] frame length while last segment                 */
+			uint32_t 		           	:  2;
+		} RX0_b;
+	} RX_0;
+	
+	union {
+    uint32_t  RX1;
+		
+		struct {
+			uint32_t SIZE						: 13; 	 	/*!< buffer size                                       */
+			uint32_t                : 19;
+		} RX1_b;
+	} RX_1;
+	
+	uint32_t bufAddr;											/*!< buffer address                                    */
+	uint32_t nextDescAddr;								/*!< address of next descriptor                        */
+  uint64_t reserved;
+	uint64_t timeStamp;									 	/*!< time stamp while the last segment                 */
+} ETH_RX_DESC;
+
+/**
+  * @brief  Read data from phy chip
+	* @param[in] phyAddr Address of phy chip
+	* @param[in] phyReg Address of phy's register to be read
+  * @retval uint32_t value of phy's register
+	*/
+uint32_t ETH_PhyRead(uint32_t phyAddr, uint32_t phyReg);
+
+/**
+  * @brief  Write data to phy chip
+	* @param[in] phyAddr Address of phy chip
+	* @param[in] phyReg Address of phy's register to be written
+	* @param[in] data Data to be written
+  * @retval None
+	*/
+void ETH_PhyWrite(uint32_t phyAddr, uint32_t phyReg, uint32_t data);
+/**
+  * @brief  Fills each ETH_InitStruct member with its default value.
+  * @param ETH_InitStruct: pointer to a ETH_InitTypeDef structure
+  *   which will be initialized.
+  * @retval : None
+  */
+void ETH_StructInit(ETH_InitTypeDef* init);
+/**
+  * @brief  Ethernet initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] init A pointer to structure ETH_InitTypeDef
+  * @retval BOOL The bit indicates if ethernet is initialized successfully
+	*/ 
+BOOL ETH_Init(ETH_InitTypeDef *init);
+
+/**
+  * @brief  Enable or disable ethernet interrupt. 
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref ETH_INT
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void ETH_ITConfig(uint32_t Int, BOOL enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref ETH_INT
+  * @retval BOOL The bit indicates if specific interrupts are set or not
+	*/
+BOOL ETH_GetITStatus(uint32_t Int);
+
+/**
+  * @brief  Clear specific interrupts
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref ETH_INT
+  * @retval None
+	*/
+void ETH_ClearITPendingBit(uint32_t Int);
+
+/**
+  * @brief  Get ethernte MAC address
+	* @param[in] mac A user-allocated buffer to fetch MAC to be read, 6 bytes.
+	* @retval None
+	*/
+void ETH_GetMacAddr(uint8_t *mac);
+
+/**
+  * @brief  Set ethernet transmission descriptor ring 
+	* @note		Make sure that memory occupied by descriptors should be in physical
+	*					memory and keep valid before ethernet transmission is finished.
+	* @param[in] ring A pointer to header of ETH_TX_DESC ring, whose last node 
+	*					has a 'nextDescAddr' pointed to first node.
+  * @retval BOOL The bit indicates if valid ring is set
+	*/
+BOOL ETH_SetTxDescRing(ETH_TX_DESC *ring);
+
+/**
+  * @brief  Start ethernet transmission
+	* @param	None
+  * @retval None
+	*/
+void ETH_StartTx(void);
+
+/**
+  * @brief  Stop ethernet transmission
+	* @param	None
+  * @retval None
+	*/
+void ETH_StopTx(void);
+
+/**
+  * @brief  Resume ethernet transmission\n
+	* 				While ethernet doesn't have enough buffer to transmit data, it will
+	*					pause and inform users by interrupt 'ETH_INT_TX_BUF_UNAVAI'. Users
+	*					must call this function to start ethernet again after new buffer 
+	*					prepared.
+	* @param	None
+  * @retval None
+	*/
+void ETH_ResumeTx(void);
+
+/**
+  * @brief  Get free transmission descriptor\n
+	* @param	None
+  * @retval ETH_TX_DESC* A pointer of free transmission descriptor, 
+	*					NULL if no free descriptor
+	*/
+ETH_TX_DESC *ETH_AcquireFreeTxDesc(void);
+
+/**
+  * @brief  Check if a transmission descriptor is free or not
+	* @param[in] desc A pointer of a transmission descriptor
+  * @retval BOOL True if the transmission descriptor is free, or flase.
+	*/
+BOOL ETH_IsFreeTxDesc(ETH_TX_DESC *desc);
+
+/**
+  * @brief  Release a transmission descriptor to ethernet\n
+	*					After users prepared data in the buffer of a free descriptor,
+	*					They must call this function to change ownership of the 
+	*					descriptor to hardware.
+	* @param[in] desc A pointer of a transmission descriptor
+  * @retval None
+	*/
+void ETH_ReleaseTxDesc(ETH_TX_DESC *desc);
+
+/**
+  * @brief  Set buffer address of the specific TX descriptor
+	* @param[in] desc A pointer of a transmission descriptor
+  * @param[in] bufAddr buffer address to be sent
+  * @retval None
+	*/
+void ETH_SetTxDescBufAddr(ETH_TX_DESC *desc, uint32_t bufAddr);
+
+/**
+  * @brief  Get buffer address of the specific TX descriptor
+	* @param[in] desc A pointer of a transmission descriptor
+  * @retval uint32_t buffer address to be gotten
+	*/
+uint32_t ETH_GetTxDescBufAddr(ETH_TX_DESC *desc);
+
+/**
+  * @brief  Set ethernet receive descriptor ring
+	* @note		Make sure that memory occupied by descriptors should be in physical
+	*					memory and keep valid before ethernet receive is finished.
+	* @param[in] ring A pointer to header of ETH_TX_DESC ring, whose last node 
+	*					has a 'nextDescAddr' pointed to first node.
+  * @retval BOOL The bit indicates if valid ring is set
+	*/
+BOOL ETH_SetRxDescRing(ETH_RX_DESC *ring);
+
+/**
+  * @brief  Start ethernet receive
+	* @param	None
+  * @retval None
+	*/
+void ETH_StartRx(void);
+
+/**
+  * @brief  Stop ethernet receive
+	* @param	None
+  * @retval None
+	*/
+void ETH_StopRx(void);
+
+/**
+  * @brief  Resume ethernet receive\n
+	* 				While ethernet doesn't have enough buffer to receive data, it will
+	*					pause and inform users by interrupt 'ETH_INT_RX_BUF_UNAVAI'. Users
+	*					must call this function to start ethernet again after new buffer 
+	*					prepared.
+	* @param	None
+  * @retval None
+	*/
+void ETH_ResumeRx(void);
+
+/**
+  * @brief  Get the free descriptor which contains received data\n
+	* @param	None
+  * @retval ETH_RX_DESC* A pointer of free receive descriptor, 
+	*					NULL if no free descriptor
+	*/
+ETH_RX_DESC *ETH_AcquireFreeRxDesc(void);
+
+/**
+  * @brief  Check if a receive descriptor is free or not
+	* @param[in] desc A pointer of a receive descriptor
+  * @retval BOOL True if the receive descriptor is free, or flase.
+	*/
+BOOL ETH_IsFreeRxDesc(ETH_RX_DESC *desc);
+
+/**
+  * @brief  Release a receive descriptor to ethernet\n
+	*					After users handled data in the buffer of a free descriptor,
+	*					They must call this function to change ownership of the 
+	*					descriptor to hardware.
+	* @param[in] desc A pointer of a transmission descriptor
+  * @retval None
+	*/
+void ETH_ReleaseRxDesc(ETH_RX_DESC *desc);
+
+/**
+  * @brief  Set buffer address of the specific RX descriptor
+	* @param[in] desc A pointer of a receive descriptor
+  * @param[in] bufAddr buffer address to be received
+  * @retval None
+	*/
+void ETH_SetRxDescBufAddr(ETH_RX_DESC *desc, uint32_t bufAddr);
+
+/**
+  * @brief  Get buffer address of the specific RX descriptor
+	* @param[in] desc A pointer of a receive descriptor
+  * @retval uint32_t buffer address to be gotten
+	*/
+uint32_t ETH_GetRxDescBufAddr(ETH_RX_DESC *desc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_ETH_H */
+

+ 218 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_flash.h

@@ -0,0 +1,218 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_flash.h
+	*
+	* @brief    CMEM7 flash controller source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_FLASH_H
+#define __CMEM7_FLASH_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup FLASH_PROTECT_MODE
+  * @{
+  */
+#define FLASH_PROTECT_MODE_SW           0       /*!< The Status Register can be written to after a Write 
+                                                     Enable command.(Default) */
+#define FLASH_PROTECT_MODE_HW           1       /*!< WP pin decides if the Status Register can be written 
+                                                     WP#=0, the Status Register locked
+																									   WP#=1, the Status Register is unlocked and can be written to
+                                                     after a Write Enable command */
+#define FLASH_PROTECT_MODE_POWERDOWN    2				/*!< Status Register is protected and can not be written to again
+                                                     until the next Power-Down, Power-Up cycle */	
+#define FLASH_PROTECT_MODE_OTP          3       /*!< Status Register is permanently protected */	
+
+#define IS_FLASH_PROTECT_MODE(MODE)     (((MODE) == FLASH_PROTECT_MODE_SW) || \
+                                         ((MODE) == FLASH_PROTECT_MODE_HW) || \
+                                         ((MODE) == FLASH_PROTECT_MODE_POWERDOWN) || \
+                                         ((MODE) == FLASH_PROTECT_MODE_OTP))
+/**
+  * @}
+  */
+
+/** @defgroup FLASH_PROTECT_REGION
+  * @{
+  */
+#define FLASH_PROTECT_REGION_NONE       0x00    /*!< no region is protected */
+#define FLASH_PROTECT_REGION_UP_64K     0x01    /*!< region(0F0000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_UP_128K    0x02    /*!< region(0E0000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_UP_256K    0x03    /*!< region(0C0000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_UP_512K    0x04    /*!< region(080000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_64K    0x09    /*!< region(000000H-00FFFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_128K   0x0A    /*!< region(000000H-01FFFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_256K   0x0B    /*!< region(000000H-03FFFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_512K   0x0C    /*!< region(000000H-07FFFFH) is protected */
+#define FLASH_PROTECT_REGION_ALL        0x0D    /*!< region(000000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_UP_4K      0x11    /*!< region(0FF000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_UP_8K      0x12    /*!< region(0FE000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_UP_16K     0x13    /*!< region(0FC000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_UP_32K     0x14    /*!< region(0F8000H-0FFFFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_4K     0x19    /*!< region(000000H-000FFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_8K     0x1A    /*!< region(000000H-001FFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_16K    0x1B    /*!< region(000000H-003FFFH) is protected */
+#define FLASH_PROTECT_REGION_LOW_32K    0x1C    /*!< region(000000H-007FFFH) is protected */
+
+#define IS_FLASH_PROTECT_REGION(REGION) (((REGION) == FLASH_PROTECT_REGION_NONE) || \
+                                         ((REGION) == FLASH_PROTECT_REGION_UP_64K) || \
+                                         ((REGION) == FLASH_PROTECT_REGION_UP_128K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_UP_256K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_UP_512K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_LOW_64K) || \
+                                         ((REGION) == FLASH_PROTECT_REGION_LOW_128K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_LOW_256K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_LOW_512K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_ALL) || \
+                                         ((REGION) == FLASH_PROTECT_REGION_UP_4K) || \
+                                         ((REGION) == FLASH_PROTECT_REGION_UP_8K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_UP_16K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_UP_32K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_LOW_4K) || \
+                                         ((REGION) == FLASH_PROTECT_REGION_LOW_8K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_LOW_16K) || \
+																				 ((REGION) == FLASH_PROTECT_REGION_LOW_32K))
+/**
+  * @}
+  */
+
+/** @defgroup FLASH_READ_MODE
+  * @{
+  */
+#define FLASH_READ_MODE_NORMAL         0        /*!< normal read, 1 bitwidth, highest freqency is 90MHz */
+#define FLASH_READ_MODE_FAST           1        /*!< fast read, 1 bitwidth, highest freqency is 120MHz */
+#define FLASH_READ_MODE_FAST_DUAL      2        /*!< fast read, 2 bitwidth, highest freqency is 120MHz */
+#define FLASH_READ_MODE_FAST_QUAD      3        /*!< fast read, 4 bitwidth, highest freqency is 90MHz */
+
+#define IS_FLASH_READ_MODE(MODE)       (((MODE) == FLASH_READ_MODE_NORMAL) || \
+                                        ((MODE) == FLASH_READ_MODE_FAST) || \
+                                        ((MODE) == FLASH_READ_MODE_FAST_DUAL) || \
+																				((MODE) == FLASH_READ_MODE_FAST_QUAD))																								
+/**
+  * @}
+  */
+
+/**
+  * @brief  UART initialization structure
+	*/ 
+typedef struct
+{
+  uint8_t FLASH_ClockDividor;       /*!< flash clock dividor, 2 in n times */
+	uint8_t FLASH_ProtectMode;        /*!< Status Register protection mode */
+	uint8_t FLASH_ProtectRegion;      /*!< flash protection region */
+	BOOL FLASH_QuadEnable;            /*!< if allows Quad operation */
+	void (*FLASH_Wait)(void);         /*!< When the former read or write operation is excuting, 
+	                                       Flash has to call a callback to wait it finish. 
+	                                       If null, Flash will wait forever until finish */
+} FLASH_InitTypeDef;
+
+/**
+  * @brief  flash initialization
+  * @note   This function should be called at first before any other interfaces.
+	*					Users should make sure that doesn't erase or write data in a 
+	*					write-protected region.
+	* @param[in] init A pointer to structure FLASH_InitTypeDef
+  * @retval None
+	*/ 
+void FLASH_Init(FLASH_InitTypeDef* init);
+
+/**
+  * @brief  Get flash status 
+  * @param[out] ProtectMode flash protect mode, ref as @ref FLASH_PROTECT_MODE
+  * @param[out] ProtectRegion flash protect region, ref as @ref FLASH_PROTECT_REGION
+	* @param[out] QuadEnable quad speed mode enable bit
+	* @retval None
+	*/ 
+void FLASH_GetStatus(uint8_t* ProtectMode, uint8_t* ProtectRegion, BOOL* QuadEnable);
+
+/**
+  * @brief  Erase a sector, which is 4K bytes large.
+  * @param[in] addr Start address of a sector
+	* @retval None
+	*/
+void FLASH_EraseSector(uint32_t addr);
+
+/**
+  * @brief  Erase a block, which is 32K bytes large.
+  * @param[in] addr Start address of a block
+	* @retval None
+	*/
+void FLASH_Erase32kBlock(uint32_t addr);
+
+/**
+  * @brief  Erase a block, which is 64K bytes large.
+  * @param[in] addr Start address of a block
+	* @retval None
+	*/
+void FLASH_Erase64kBlock(uint32_t addr);
+
+/**
+  * @brief  Erase all chip
+  * @param	None
+	* @retval None
+	*/
+void FLASH_EraseChip(void);
+
+/**
+  * @brief  Enable flash power down mode or not
+  * @param[in] enable The bit indicates if flash power down mode is enable or not
+	* @retval None
+	*/
+void FLASH_EnableDeepPowerDown(BOOL enable);
+
+/**
+  * @brief  Read data from flash
+	* @param[in] ReadMode Normal or fast read, ref as @ref FLASH_READ_MODE
+	* @param[in] addr Start address to be read
+	* @param[in] size Expected data size to be read
+	* @param[out] data A user-allocated buffer to fetch data to be read
+  * @retval None
+	*/
+void FLASH_Read(uint8_t ReadMode, uint32_t addr, uint16_t size, uint8_t* data);
+
+/**
+  * @brief  Write data to flash
+	* @param[in] addr Start address to be read
+	* @param[in] size Expected data size to be read
+	* @param[out] data A pointer to the data to be written
+  * @retval None
+	*/
+void FLASH_Write(uint32_t addr, uint16_t size, uint8_t* data);
+
+
+void flash_WaitInWritting(void) ;
+
+void flash_WaitReadFifoNotEmpty(void);
+
+uint16_t flash_ReadFifo(uint16_t size, uint8_t* data) ;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_FLASH_H */
+

+ 159 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_gpio.h

@@ -0,0 +1,159 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_gpio.h
+	*
+	* @brief    CMEM7 GPIO header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_GPIO_H
+#define __CMEM7_GPIO_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup GPIO_GROUP
+  * @{
+  */
+typedef enum {
+	GPIO_GROUP_GPIO,
+} GPIO_GROUP;
+
+#define IS_GPIO_GROUP(GROUP)  (((GROUP) == GPIO_GROUP_GPIO))
+/**
+  * @}
+  */
+
+/** @defgroup GPIO_PWM_CHANNEL
+  * @{
+  */
+typedef enum {
+	GPIO_PWM_CHANNEL_GPIO_31,
+} GPIO_PWM_CHANNEL;
+        
+#define IS_GPIO_PWM_CHANNEL(CHANNEL)  (((CHANNEL) == GPIO_PWM_CHANNEL_GPIO_31))
+/**
+  * @}
+  */
+	
+/**
+  * @brief  GPIO initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] Group GPIO group, which is a value of @ref GPIO_GROUP
+	* @param[in] PositiveTrigger Positive edge interrupt trigger if true, or negative edge
+  * @retval None
+	*/ 	
+void GPIO_Init(uint8_t Group, uint32_t PositiveTrigger);
+
+/**
+  * @brief  Enable or disable GPIO output in the specific group. 
+	* @param[in] Group GPIO group, which is a value of @ref GPIO_GROUP
+	* @param[in] Enable each bit indicates if the corresponding GPIO pin 
+	*						in the specific GPIO group is enable or not
+  * @retval None
+	*/ 
+void GPIO_EnableOutput(uint8_t Group, uint32_t Enable);
+
+/**
+  * @brief  Enable or disable GPIO interrupt in the specific group. 
+	* @param[in] Group GPIO group, which is a value of @ref GPIO_GROUP
+	* @param[in] Enable each bit indicates if the corresponding GPIO pin interrupt 
+	*						in the specific GPIO group is enable or not
+  * @retval None
+	*/ 
+void GPIO_EnableInt(uint8_t Group, uint32_t Enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] Group GPIO group, which is a value of @ref GPIO_GROUP
+	* @retval uint32_t each bit indicates if the corresponding GPIO pin interrupt 
+	*					in the specific GPIO group is set or not
+	*/
+uint32_t GPIO_GetIntStatus(uint8_t Group);
+
+/**
+  * @brief  Clear GPIO interrupt in the specific group. 
+	* @param[in] Group GPIO group, which is a value of @ref GPIO_GROUP
+	* @param[in] Clear each bit indicates if the corresponding GPIO pin interrupt 
+	*						in the specific GPIO group is clear or not
+  * @retval None
+	*/ 
+void GPIO_ClearInt(uint8_t Group, uint32_t Clear);
+
+/**
+  * @brief  Get value of each GPIO pin in the specific group
+	* @param[in] Group GPIO group, which is a value of @ref GPIO_GROUP
+	* @retval uint32_t each bit indicates value of the corresponding GPIO pin 
+	*					in the specific GPIO group
+	*/
+uint32_t GPIO_Read(uint8_t Group);
+
+/**
+  * @brief  Set value of each GPIO pin in the specific group
+	* @param[in] Group GPIO group, which is a value of @ref GPIO_GROUP
+	* @param[in] Unmask each bit indicates value of the corresponding GPIO pin 
+	*						 in the specific GPIO group is set or not
+	* @param[in] data each bit indicates value of the corresponding GPIO pin
+	*						 in the specific GPIO group to be set
+  * @retval None
+	*/ 
+void GPIO_Write(uint8_t Group, uint32_t Unmask, uint32_t data);
+
+/**
+  * @brief  Initialize PWM for the specific GPIO pin
+	* @note		It can work before call GPIO_EnableOutput for the specific GPIO pin
+	* @param[in] Channel PWM channel, which is a value of @ref GPIO_PWM_CHANNEL
+	* @param[in] HighLevelNanoSecond Nanosecond which high level lasts 
+	* @param[in] LowLevelNanoSecond Nanosecond which low level lasts 
+  * @retval None
+	* @see		GPIO_EnableOutput
+	*/ 
+void GPIO_InitPwm(uint8_t Channel, uint32_t HighLevelNanoSecond, uint32_t LowLevelNanoSecond);
+
+/**
+  * @brief  Enable or disable GPIO PWM in the specific channel. 
+	*	@param[in] Channel PWM channel, which is a value of @ref GPIO_PWM_CHANNEL
+	* @param[in] Enable The bit indicates if the specific channel is enable or not
+  * @retval None
+	*/ 
+void GPIO_EnablePwm(uint8_t Channel, BOOL Enable);
+
+
+
+/**
+  xjf 20150324
+  
+**/
+void GPIO_SetBits(uint32_t mask);
+void GPIO_clrBits(uint32_t mask);
+uint32_t GPIO_getBits(uint32_t mask); 
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_GPIO_H */
+

+ 247 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_i2c.h

@@ -0,0 +1,247 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_i2c.h
+	*
+	* @brief    CMEM7 I2C header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_I2C_H
+#define __CMEM7_I2C_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+
+#define IS_I2C_ALL_PERIPH(PERIPH) (((PERIPH) == I2C0) || \
+                                   ((PERIPH) == I2C1))
+
+/** @defgroup I2C_Mode
+  * @{
+  */
+#define I2C_Mode_Slave                  0
+#define I2C_Mode_Master                 1
+#define IS_I2C_MODE(MODE) (((MODE) == I2C_Mode_Slave) || \
+                           ((MODE) == I2C_Mode_Master))
+/**
+  * @}
+  */
+
+/** @defgroup I2C_ADDR_WIDTH
+  * @{
+  */
+#define I2C_ADDR_WIDTH_7BIT                  0
+#define I2C_ADDR_WIDTH_10BIT                 1
+#define IS_I2C_ADDR_WIDTH(WIDTH) (((WIDTH) == I2C_ADDR_WIDTH_7BIT) || \
+                                  ((WIDTH) == I2C_ADDR_WIDTH_10BIT))
+/**
+  * @}
+  */
+
+/** @defgroup I2C_INT
+  * @{
+  */			
+#define I2C_INT_RX_FIFO_NOT_EMPTY      0x00000004 		/*!< Can't be clear but read FIFO */
+#define I2C_INT_RD_REQUEST             0x00000020     /*!< Slave was requested to send data */
+#define I2C_INT_TX_ABORT               0x00000040     /*!< Error while sending data */
+#define I2C_INT_RX_DONE                0x00000080     /*!< Slave sent all requested data */
+#define I2C_INT_TX_DONE                0x00000100     /*!< Master accomplish to send all data */
+
+#define I2C_INT_ALL                    (I2C_INT_RX_FIFO_NOT_EMPTY | \
+																				I2C_INT_RD_REQUEST | \
+																				I2C_INT_TX_ABORT | \
+																				I2C_INT_RX_DONE | \
+																				I2C_INT_TX_DONE)
+
+#define IS_I2C_INT(INT)                (((INT) != 0) && (((INT) & ~I2C_INT_ALL) == 0))
+/**
+  * @}
+  */
+
+/** @defgroup I2C_STATUS
+  * @{
+  */
+#define I2C_STATUS_RX_FIFO_NOT_EMPTY   0x00200000 		/*!< Can't be clear but read FIFO */
+#define I2C_STATUS_RD_REQUEST          0x01000000     /*!< Slave was requested to send data */
+#define I2C_STATUS_TX_ABORT            0x02000000     /*!< Error while sending data */
+#define I2C_STATUS_RX_DONE             0x04000000     /*!< Slave sent all requested data */
+#define I2C_STATUS_TX_DONE             0x08000000     /*!< Master accomplish to send all data */
+
+#define I2C_STATUS_ALL                 (I2C_STATUS_RX_FIFO_NOT_EMPTY | \
+																				I2C_STATUS_RD_REQUEST | \
+																				I2C_STATUS_TX_ABORT | \
+																				I2C_STATUS_RX_DONE | \
+																				I2C_STATUS_TX_DONE)
+
+#define IS_I2C_STATUS(STATUS)          (((STATUS) != 0) && (((STATUS) & ~I2C_STATUS_ALL) == 0))
+/**
+  * @}
+  */
+
+/**
+  * @brief  I2C timing structure
+	*/
+typedef struct
+{
+  uint32_t I2C_Freq;                /*!< I2C frquency */
+
+	uint16_t I2C_TsuDat;              /*!< nano second of TSU:DAT */
+  uint16_t I2C_Tsetup;              /*!< nano second of THD:STA and TSU:STO */ 
+  uint16_t I2C_Tbuf;                /*!< nano second of TBUF */       	
+	uint16_t I2C_TsuSta;              /*!< nano second of TSU:STA */ 
+	
+	BOOL I2C_SdaFilterEn;             /*!< enabled flag of SDA filter */
+	uint8_t I2C_SdaFilterSpike;       /*!< spikes of SDA filter */
+	BOOL I2C_SclFilterEn;             /*!< enabled flag of SCL filter */
+	uint8_t I2C_SclFilterSpike;       /*!< spikes of SCL filter */
+	
+} I2C_InitTimingDef;
+
+/**
+  * @brief  I2C initialization structure
+	*/
+typedef struct
+{
+  uint8_t I2C_Mode;                 /*!< Specifies the I2C mode.
+                                         This parameter can be a value of @ref I2C_mode */
+	uint8_t I2C_AddressWidth;         /*!< 7- or 10-bits width address, ref as @ref I2C_ADDR_WIDTH */
+	uint8_t I2C_Address;              /*!< 7- or 10-bits address */
+	I2C_InitTimingDef* timing;        /*!< timing structure, null if don't set */		
+} I2C_InitTypeDef;
+
+/**
+  * @brief  I2C initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] init A pointer to structure I2C_InitTypeDef
+  * @retval None
+	*/ 
+void I2C_Init(I2C0_Type* I2Cx, I2C_InitTypeDef* I2C_Init);
+
+/**
+  * @brief  Enable or disable I2C. 
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] Enable The bit indicates if the specific I2C is enable or not
+  * @retval None
+	*/ 
+void I2C_Enable(I2C0_Type* I2Cx, BOOL enable);
+
+/**
+  * @brief  Enable or disable I2C interrupt. 
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref I2C_Int
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void I2C_EnableInt(I2C0_Type* I2Cx, uint32_t Int, BOOL enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref I2C_Int
+  * @retval BOOL The bit indicates if specific interrupts are enable or not
+	*/
+BOOL I2C_GetIntStatus(I2C0_Type* I2Cx, uint32_t Int);
+
+/**
+  * @brief  Clear specific interrupts
+	* @note   Specific interrupt clear will clear correspective status as well
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref I2C_Int
+  * @retval None
+	*/
+void I2C_ClearInt(I2C0_Type* I2Cx, uint32_t Int);
+
+/**
+  * @brief  Check specific status are set or not 
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] Status Status mask bits, which can be the combination of @ref I2C_STATUS
+  * @retval BOOL The bit indicates if specific status are set or not
+	*/
+BOOL I2C_GetStatus(I2C0_Type* I2Cx, uint32_t Status);
+
+/**
+  * @brief  Clear specific status
+	* @note   Specific status clear will clear correspective interrupt as well
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] Status Status mask bits, which can be the combination of @ref I2C_STATUS
+  * @retval None
+	*/
+void I2C_ClearStatus(I2C0_Type* I2Cx, uint32_t Status);
+
+/**
+  * @brief  I2C send read request in master mode
+	* @note   Users must call I2C_StopReq between 2 requests
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] size Expected data size to be read
+  * @retval BOOL The bit indicates if read request to be sent is valid
+	* @see		I2C_StopReq
+	*/
+BOOL I2C_MasterReadReq(I2C0_Type* I2Cx, uint8_t size);
+
+/**
+  * @brief  Read data from I2C
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] size Expected data size to be read
+	* @param[out] Data A user-allocated buffer to fetch data to be read
+  * @retval uint8_t Actual read data size
+	*/
+uint8_t I2C_ReadFifo(I2C0_Type* I2Cx, uint8_t size, uint8_t* data);
+
+/**
+  * @brief  I2C send write request in master or slave mode
+	* @note   Users must call I2C_StopReq between 2 requests
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] size Expected data size to be written, includes the first data
+	* @param[in] firstData The first data to be written
+  * @retval BOOL The bit indicates if write request to be sent is valid
+	* @see		I2C_StopReq
+	*/
+BOOL I2C_WriteReq(I2C0_Type* I2Cx, uint8_t size, uint8_t firstData);
+
+/**
+  * @brief  Write data to I2C
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @param[in] size Expected data size to be written
+	* @param[in] Data A pointer to the data to be written
+  * @retval uint8_t Actual written data size
+	*/
+uint8_t I2C_WriteFifo(I2C0_Type* I2Cx, uint8_t size, uint8_t* data);
+
+/**
+  * @brief  I2C stop request
+	* @note   Users must call I2C_StopReq between 2 requests
+	* @param[in] I2Cx I2C peripheral, which is I2C0 or I2C1
+	* @retval BOOL The bit indicates if request is stopped.
+	* @see		I2C_MasterReadReq I2C_WriteReq 
+	*/
+BOOL I2C_StopReq(I2C0_Type* I2Cx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__CMEM7_I2C_H */
+

+ 120 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_includes.h

@@ -0,0 +1,120 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_includes.h
+	*
+	* @brief    CMEM7 includes file, easy to use CMEM7 library
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#ifndef __CMEM7_INCLUDES_H
+#define __CMEM7_INCLUDES_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7_conf.h"
+#include "cmem7_it.h"
+	 
+#ifdef _ADC
+	#include "cmem7_adc.h"
+#endif
+	 
+#ifdef _AES
+	#include "cmem7_aes.h"
+#endif
+	 
+#ifdef _CAN
+	#include "cmem7_can.h"
+#endif
+	 
+#ifdef _DDR
+	#include "cmem7_ddr.h"
+#endif
+	 
+#ifdef _DMA
+	#include "cmem7_dma.h"
+#endif
+	 
+#ifdef _EFUSE
+	#include "cmem7_efuse.h"
+#endif
+	 
+#ifdef _ETH
+	#include "cmem7_eth.h"
+#endif
+	 
+#ifdef _FLASH
+	#include "cmem7_flash.h"
+#endif
+	 
+#ifdef _GPIO
+	#include "cmem7_gpio.h"
+#endif
+	 
+#ifdef _I2C
+	#include "cmem7_i2c.h"
+#endif
+	 
+#ifdef _MISC
+	#include "cmem7_misc.h"
+#endif
+	 
+#ifdef _RTC
+	#include "cmem7_rtc.h"
+#endif
+	 
+#ifdef _SPI
+	#include "cmem7_spi.h"
+#endif
+	 
+#ifdef _TIM
+	#include "cmem7_tim.h"
+#endif
+	 
+#ifdef _UART
+	#include "cmem7_uart.h"
+#endif
+
+#ifdef _USB
+	#include "cmem7_usb.h"
+#endif
+
+#ifdef _WDG
+	#include "cmem7_wdg.h"
+#endif
+
+
+#ifdef _MARVELL
+  #include <marvel_98dx242.h>
+	#include <s24g_i2c.h>
+#endif	
+	
+#ifdef _IP1826D
+  #include <ip1826d_v00.h>
+#endif	
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_INCLUDES_H */
+

+ 276 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_misc.h

@@ -0,0 +1,276 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_misc.h
+	*
+	* @brief    CMEM7 miscellaneous header file
+	* 
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_MISC_H
+#define __CMEM7_MISC_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/**
+  * @brief  NVIC initialization structure
+	*/
+/**
+@code  
+	The table below gives the allowed values of the pre-emption priority and subpriority according
+	to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
+	============================================================================================================================
+		NVIC_PriorityGroup   | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority  | Description
+	============================================================================================================================
+	 NVIC_PriorityGroup_0  |                0                  |            0-15             |   0 bits for pre-emption priority
+												 |                                   |                             |   4 bits for subpriority
+	----------------------------------------------------------------------------------------------------------------------------
+	 NVIC_PriorityGroup_1  |                0-1                |            0-7              |   1 bits for pre-emption priority
+												 |                                   |                             |   3 bits for subpriority
+	----------------------------------------------------------------------------------------------------------------------------    
+	 NVIC_PriorityGroup_2  |                0-3                |            0-3              |   2 bits for pre-emption priority
+												 |                                   |                             |   2 bits for subpriority
+	----------------------------------------------------------------------------------------------------------------------------    
+	 NVIC_PriorityGroup_3  |                0-7                |            0-1              |   3 bits for pre-emption priority
+												 |                                   |                             |   1 bits for subpriority
+	----------------------------------------------------------------------------------------------------------------------------    
+	 NVIC_PriorityGroup_4  |                0-15               |            0                |   4 bits for pre-emption priority
+												 |                                   |                             |   0 bits for subpriority                       
+	============================================================================================================================
+@endcode
+	*/
+	
+typedef struct
+{
+  uint8_t NVIC_IRQChannel;                    /*!< Specifies the IRQ channel to be enabled or disabled.
+                                                   This parameter can be a value of @ref IRQn_Type 
+                                                   (For the complete Capital-micro Devices IRQ Channels list, please
+                                                    refer to cmem7.h file) */
+
+  uint8_t NVIC_IRQChannelPreemptionPriority;  /*!< Specifies the pre-emption priority for the IRQ channel
+                                                   specified in NVIC_IRQChannel. This parameter can be a value
+                                                   between 0 and 15 as described in the table @ref NVIC_Priority_Table */
+
+  uint8_t NVIC_IRQChannelSubPriority;         /*!< Specifies the subpriority level for the IRQ channel specified
+                                                   in NVIC_IRQChannel. This parameter can be a value
+                                                   between 0 and 15 as described in the table @ref NVIC_Priority_Table */
+
+  BOOL NVIC_IRQChannelCmd;                    /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
+                                                   will be enabled or disabled. 
+                                                   This parameter can be set either to ENABLE or DISABLE */   
+} NVIC_InitTypeDef;
+ 
+
+/** @defgroup NVIC_VectTab
+  * @{
+  */
+
+#define NVIC_VectTab_CME_CODE        ((uint32_t)0x00000000)
+#define NVIC_VectTab_RAM             ((uint32_t)0x20000000)
+#define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)
+#define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_CME_CODE) || \
+                                  ((VECTTAB) == NVIC_VectTab_RAM) || \
+                                  ((VECTTAB) == NVIC_VectTab_FLASH))
+/**
+  * @}
+  */
+
+/** @defgroup NVIC_LP
+  * @{
+  */
+#define NVIC_LP_SEVONPEND            ((uint8_t)0x10)
+#define NVIC_LP_SLEEPDEEP            ((uint8_t)0x04)
+#define NVIC_LP_SLEEPONEXIT          ((uint8_t)0x02)
+#define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
+                        ((LP) == NVIC_LP_SLEEPDEEP) || \
+                        ((LP) == NVIC_LP_SLEEPONEXIT))
+/**
+  * @}
+  */
+
+/** @defgroup NVIC_PriorityGroup
+  * @{
+  */
+#define NVIC_PriorityGroup_0         ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
+                                                            4 bits for subpriority */
+#define NVIC_PriorityGroup_1         ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
+                                                            3 bits for subpriority */
+#define NVIC_PriorityGroup_2         ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
+                                                            2 bits for subpriority */
+#define NVIC_PriorityGroup_3         ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
+                                                            1 bits for subpriority */
+#define NVIC_PriorityGroup_4         ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
+                                                            0 bits for subpriority */
+
+#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
+                                       ((GROUP) == NVIC_PriorityGroup_1) || \
+                                       ((GROUP) == NVIC_PriorityGroup_2) || \
+                                       ((GROUP) == NVIC_PriorityGroup_3) || \
+                                       ((GROUP) == NVIC_PriorityGroup_4))
+/**
+  * @}
+  */
+	
+#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
+
+#define IS_NVIC_SUB_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
+
+#define IS_NVIC_OFFSET(OFFSET)  ((OFFSET) < 0x000FFFFF)
+
+/**
+  * @brief  Configures the priority grouping: pre-emption priority and subpriority.
+  * @param  NVIC_PriorityGroup: specifies the priority grouping bits length. 
+  *   This parameter can be one of the following values, ref as @ref NVIC_PriorityGroup:
+  *     @arg NVIC_PriorityGroup_0: 0 bits for pre-emption priority
+  *                                4 bits for subpriority
+  *     @arg NVIC_PriorityGroup_1: 1 bits for pre-emption priority
+  *                                3 bits for subpriority
+  *     @arg NVIC_PriorityGroup_2: 2 bits for pre-emption priority
+  *                                2 bits for subpriority
+  *     @arg NVIC_PriorityGroup_3: 3 bits for pre-emption priority
+  *                                1 bits for subpriority
+  *     @arg NVIC_PriorityGroup_4: 4 bits for pre-emption priority
+  *                                0 bits for subpriority
+  * @retval None
+  */
+void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
+
+/**
+  * @brief  Initializes the NVIC peripheral according to the specified
+  *         parameters in the NVIC_InitStruct.
+  * @param  NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure that contains
+  *         the configuration information for the specified NVIC peripheral.
+  * @retval None
+  */
+void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
+
+/**
+  * @brief  Sets the vector table location and Offset.
+  * @param  NVIC_VectTab: specifies if the vector table is in RAM or FLASH memory.
+  *   This parameter can be one of the following values, ref as @ref NVIC_VectTab:
+  *     @arg NVIC_VectTab_RAM
+  *     @arg NVIC_VectTab_FLASH
+  * @param  Offset: Vector Table base offset field. This value must be a multiple 
+  *         of 0x200.
+  * @retval None
+  */
+void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
+
+/**
+  * @brief  Selects the condition for the system to enter low power mode.
+  * @param  LowPowerMode: Specifies the new mode for the system to enter low power mode.
+  *   This parameter can be one of the following values, ref as @ref NVIC_LP:
+  *     @arg NVIC_LP_SEVONPEND
+  *     @arg NVIC_LP_SLEEPDEEP
+  *     @arg NVIC_LP_SLEEPONEXIT
+  * @param  NewState: new state of LP condition. This parameter can be: ENABLE or DISABLE.
+  * @retval None
+  */
+void NVIC_SystemLPConfig(uint8_t LowPowerMode, BOOL NewState);
+
+/**
+  * @brief  Memory map from address 'from' to 'address 'to' and open icache or not
+	* @param[in] from address to be mapped from
+	* @param[in] to address to be mapped to
+	* @param[in] isIcacheOn icache is on or off
+  * @retval None
+	*/
+void GLB_MMAP(uint32_t from, uint32_t to, BOOL isIcacheOn);
+
+/**
+  * @brief  Convert the mapping destination address to source address
+	* @param[in] to address to be mapped to
+  * @retval uint32_t address to be mapped from
+	*/
+uint32_t GLB_ConvertToMappingFromAddr(uint32_t to);
+
+/**
+  * @brief  Convert the mapping source address to destination address
+	* @param[in] from address to be mapped from
+  * @retval uint32_t address to be mapped to
+	*/
+uint32_t GLB_ConvertToMappingToAddr(uint32_t from);
+
+/**
+  * @brief  Set NMI irq number, it should be one of @ref IRQn_Type.
+	* @Note		You can assign any valid IRQn_Type to NMI. After that, you will enter NMI 
+	*					interrupt routine if the specific 'irq' occurs. By default, NMI irq number
+	*					is 0, same as ETH_INT_IRQn
+	* @param[in] irq irq number 
+  * @retval None
+	*/
+void GLB_SetNmiIrqNum(uint32_t irq);
+
+/** @defgroup SYS_CLK_SEL
+  * @{
+  */
+#define SYS_CLK_SEL_OSC					0x0
+#define SYS_CLK_SEL_DLL					0x1
+#define SYS_CLK_SEL_CRYSTAL			0x2
+#define SYS_CLK_SEL_EXTERNAL		0x3	
+/**
+  * @}
+  */
+	
+/**
+  * @brief  Select system clock source, it should be one of @ref SYS_CLK_SEL.
+	* @Note		You MUST make sure externel clock has been stabled if clock 
+	*				  source is external before call this function. 
+	* 				Default value is SYS_CLK_SEL_OSC
+	* @param[in] irq irq number 
+  * @retval None
+	*/
+void GLB_SelectSysClkSource(uint8_t source);
+
+/**
+  * @brief  Simulate instruction 'STRB' or 'STRH' with 'BFI'
+	* @Note		In M7, you have to write a register in 32-bit alignment,
+	*				  not in 8-bit or 16-bit. 
+	* @param[in] addr register address to be written 
+  * @param[in] value value to be written
+  * @param[in] lsb LSB in register to be written
+  * @param[in] len bit length to be written
+  * @retval None
+	*/
+	
+	
+//#define aaaa(len) __asm("LDR len, 11")
+
+#define CMEM7_BFI(addr, value, lsb, len)        \
+  do {                                          \
+    unsigned long tmp;                          \
+    unsigned long tmp1 = (unsigned long)addr;   \
+                                                \
+    __asm("LDR tmp, [tmp1]\n"                   \
+      "BFI tmp, "#value", "#lsb", "#len" \n"    \
+      "STR tmp, [tmp1]\n");                     \
+		} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_MISC_H */
+

+ 87 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_retarget.h

@@ -0,0 +1,87 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_retarget.h
+	*
+	* @brief    CMEM7 retarget header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#ifndef __CMEM7_RETARGET_H
+#define __CMEM7_RETARGET_H
+
+#include <stdio.h>
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+#pragma import(__use_no_semihosting_swi)
+
+struct __FILE { int handle; /* Add whatever you need here */ };
+FILE __stdout;
+FILE __stdin;
+FILE __stderr;
+
+
+int fputc(int c, FILE *f) {
+  uint8_t ch = c;
+	if (c == '\n')  {
+		ch = '\r';
+    while (0 == UART_Write(PRINT_UART, 1, &ch));
+		ch = '\n';
+  }
+	
+	while (0 == UART_Write(PRINT_UART, 1, &ch)) ;
+  return ch;
+}
+
+
+int fgetc(FILE *f) {
+	uint8_t ch;
+	
+	while (0 == UART_Read(PRINT_UART, 1, &ch)) ;
+  return ch;
+}
+
+int ferror(FILE *f) {
+  /* Your implementation of ferror */
+  return EOF;
+}
+
+
+void _ttywrch(int c) {
+  while (0 == UART_Write(PRINT_UART, 1, (uint8_t *)&c));
+}
+
+
+void _sys_exit(int return_code) {
+label:  goto label;  /* endless loop */
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_RETARGET_H */

+ 89 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_rtc.h

@@ -0,0 +1,89 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_rtc.h
+	*
+	* @brief    CMEM7 RTC header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_RTC_H
+#define __CMEM7_RTC_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup RTC_Int
+  * @{
+  */
+#define RTC_Int_Second                     ((uint32_t)0x00000001)
+#define RTC_Int_Millsecond                 ((uint32_t)0x00000002)
+#define RTC_Int_All                        ((uint32_t)0x00000003)
+#define IS_RTC_INT(INT)                    (((INT) != 0) && (((INT) & ~RTC_Int_All) == 0))
+/**
+  * @}
+  */
+   
+/**
+  * @brief  Enable or disable RTC interrupt. 
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref RTC_Int
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void RTC_ITConfig(uint32_t Int, BOOL Enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref RTC_Int
+  * @retval BOOL The bit indicates if specific interrupts are set or not
+	*/
+BOOL RTC_GetITStatus(uint32_t Int);
+
+/**
+  * @brief  Clear specific interrupts
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref RTC_Int
+  * @retval None
+	*/
+void RTC_ClearITPendingBit(uint32_t Int);
+
+/**
+  * @brief  Get seconds since power up
+	* @param	None
+  * @retval uint32_t Seconds since power up
+	*/
+uint32_t RTC_GetSecond(void);
+
+/**
+  * @brief  Get current millseconds
+	* @param	None
+  * @retval uint32_t Current millseconds
+	*/
+uint16_t RTC_GetMillSecond(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_RTC_H */
+

+ 167 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_spi.h

@@ -0,0 +1,167 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_spi.h
+	*
+	* @brief    CMEM7 SPI header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_SPI_H
+#define __CMEM7_SPI_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+
+#define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI0) || \
+                                   ((PERIPH) == SPI1))
+
+
+/** @defgroup SPI_MODE
+  * @{
+  */
+#define SPI_MODE_CPOL_0_CPHA_0         0   	/*!< CPOL : Idle clock level is low level. 
+																								 CPHA : Capture data at the first edge */
+#define SPI_MODE_CPOL_0_CPHA_1         1		/*!< CPOL : Idle clock level is low level. 
+																								 CPHA : Capture data at the second edge */	
+#define SPI_MODE_CPOL_1_CPHA_0         2		/*!< CPOL : Idle clock level is high level. 
+																								 CPHA : Capture data at the first edge */
+#define SPI_MODE_CPOL_1_CPHA_1         3	 	/*!< CPOL : Idle clock level is high level. 
+																								 CPHA : Capture data at the first edge */    
+#define IS_SPI_MODE(MODE)              (((MODE) == SPI_MODE_CPOL_0_CPHA_0) || \
+                                        ((MODE) == SPI_MODE_CPOL_0_CPHA_1) || \
+                                        ((MODE) == SPI_MODE_CPOL_1_CPHA_0) || \
+																				((MODE) == SPI_MODE_CPOL_1_CPHA_1))
+/**
+  * @}
+  */
+
+/** @defgroup SPI_INT
+  * @{
+  */	
+#define SPI_INT_RX_FIFO_UNDERFLOW      0x00000001    
+#define SPI_INT_RX_FIFO_OVERFLOW       0x00000002
+#define SPI_INT_RX_FIFO_ALMOST_FULL    0x00000004
+#define SPI_INT_TX_FIFO_UNDERFLOW      0x00000008    
+#define SPI_INT_TX_FIFO_OVERFLOW       0x00000010
+#define SPI_INT_TX_FIFO_ALMOST_FULL    0x00000020
+#define SPI_INT_DONE                   0x00000040
+#define SPI_INT_ALL                    0x0000007F
+
+#define IS_SPI_INT(INT)                (((INT) != 0) && (((INT) & ~SPI_INT_ALL) == 0))
+/**
+  * @}
+  */
+
+/**
+  * @brief  SPI initialization structure
+	*/ 
+typedef struct
+{
+  uint8_t SPI_Mode;                 /*!< indicates SPI's CPOL and CPHA, ref as @ref SPI_MODE */
+  BOOL SPI_RxEn;                    /*!< indicates if SPI receiver is enabled or not */
+  uint8_t SPI_BitLength;            /*!< bit length while transmitting and receiving */
+  uint8_t SPI_Gap;                  /*!< cycle number between continuous data frame */ 
+	uint8_t SPI_ClockDividor;         /*!< SPI clock dividor, 1 / ((1 + DIV) * 2) */
+} SPI_InitTypeDef;
+/**
+  * @}
+  */
+
+/**
+  * @brief  SPI initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] init A pointer to structure SPI_InitTypeDef
+  * @retval None
+	*/ 
+void SPI_Init(SPI0_Type* SPIx, SPI_InitTypeDef *init);
+
+/**
+  * @brief  Enable or disable SPI. 
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] Enable The bit indicates if the specific SPI is enable or not
+  * @retval None
+	*/ 
+void SPI_Enable(SPI0_Type* SPIx, BOOL enable);
+
+/**
+  * @brief  Enable or disable SPI interrupt. 
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref SPI_Int
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void SPI_EnableInt(SPI0_Type* SPIx, uint32_t Int, BOOL enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref SPI_Int
+  * @retval BOOL The bit indicates if specific interrupts are set or not
+	*/
+BOOL SPI_GetIntStatus(SPI0_Type* SPIx, uint32_t Int);
+
+/**
+  * @brief  Clear specific interrupts
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref SPI_Int
+  * @retval None
+	*/
+void SPI_ClearInt(SPI0_Type* SPIx, uint32_t Int);
+
+/**
+  * @brief  Read data from SPI FIFO
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] size Expected data size to be read
+	* @param[out] data A user-allocated buffer to fetch data to be read
+  * @retval uint8_t Actual read data size
+	*/
+uint8_t SPI_ReadFifo(SPI0_Type* SPIx, uint8_t size, uint32_t* data);
+
+/**
+  * @brief  Write data to SPI FIFO
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] size Expected data size to be written
+	* @param[in] data A pointer to the data to be written
+  * @retval uint8_t Actual written data size
+	*/
+uint8_t SPI_WriteFifo(SPI0_Type* SPIx, uint8_t Size, uint32_t* data);
+
+/**
+  * @brief  send a SPI transcation request 
+	* @param[in] SPIx SPI peripheral, which is SPI0 or SPI1
+	* @param[in] size Expected data size to be written and read
+	* @retval BOOL The bit indicates if the request is sent
+	*/
+BOOL SPI_Transcation(SPI0_Type* SPIx, uint8_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__CMEM7_SPI_H */
+

+ 101 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_tim.h

@@ -0,0 +1,101 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_tim.h
+	*
+	* @brief    CMEM7 timer header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_TIM_H
+#define __CMEM7_TIM_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+
+#define IS_TIM_ALL_PERIPH(PERIPH) (((PERIPH) == TIMER0) || \
+                                   ((PERIPH) == TIMER1) || \
+                                   ((PERIPH) == TIMER2) || \
+                                   ((PERIPH) == TIMER3))
+																	 
+/**
+  * @brief  Timer initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
+	* @param[in] Ms overflow micro-seconds of the specific timer
+  * @retval None
+	*/
+void TIM_Init(TIMER0_Type* Timx, uint16_t Ms);
+
+/**
+  * @brief  Enable or disable timer interrupt. 
+	* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
+	* @param[in] Enable The bit indicates if the specific interrupt is enable or not
+  * @retval None
+	*/ 
+void TIM_EnableInt(TIMER0_Type* Timx, BOOL Enable);
+
+/**
+  * @brief  Check the specific interrupt is set or not 
+	* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
+	* @retval BOOL The bit indicates if the specific interrupt is set or not
+	*/
+BOOL TIM_GetIntStatus(TIMER0_Type* Timx);
+
+/**
+  * @brief  Clear specific interrupts
+	* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
+	* @retval None
+	*/
+void TIM_ClearInt(TIMER0_Type* Timx);
+
+/**
+  * @brief  Enable or disable timer. 
+	* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
+	* @param[in] Enable The bit indicates if the specific timer is enable or not
+  * @retval None
+	*/ 
+void TIM_Enable(TIMER0_Type* Timx, BOOL Enable);
+
+/**
+  * @brief  Check the specific timer is overflow or not 
+	* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
+	* @retval BOOL The bit indicates if the specific timer is overflow or not
+	*/
+BOOL TIM_IsOverflow(TIMER0_Type* Timx);
+
+/**
+  * @brief  Get current counter of timer
+	* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
+	* @retval uint32_t current counter
+	*/
+uint32_t TIM_GetCounter(TIMER0_Type* Timx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__CMEM7_TIM_H */
+

+ 172 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_uart.h

@@ -0,0 +1,172 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_uart.h
+	*
+	* @brief    CMEM7 uart header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#ifndef __CMEM7_UART_H
+#define __CMEM7_UART_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+#define IS_UART_ALL_PERIPH(PERIPH) (((PERIPH) == UART0) || \
+                                     ((PERIPH) == UART1) || \
+                                     ((PERIPH) == UART2))
+	
+/** @defgroup UART_StopBits
+  * @{
+  */
+#define UART_StopBits_0_5                 0
+#define UART_StopBits_1                   1
+#define UART_StopBits_1_5                 2
+#define UART_StopBits_2                   3
+#define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_StopBits_1) || \
+                                     ((STOPBITS) == UART_StopBits_0_5) || \
+                                     ((STOPBITS) == UART_StopBits_2) || \
+                                     ((STOPBITS) == UART_StopBits_1_5))
+/**
+  * @}
+  */
+
+/** @defgroup UART_Parity
+  * @{
+  */
+#define UART_Parity_Even                  0
+#define UART_Parity_Odd                   1
+#define UART_Parity_None                  2
+#define IS_UART_PARITY(PARITY) (((PARITY) == UART_Parity_Even) || \
+                                 ((PARITY) == UART_Parity_Odd) || \
+																 ((PARITY) == UART_Parity_None))										 
+/**
+  * @}
+  */
+
+/** @defgroup UART_Int
+  * @{
+  */
+#define UART_Int_RxNotEmpty               0x00000001    
+#define UART_Int_TxEmpty                  0x00000002
+#define UART_Int_TxHalfEmpty              0x00000004
+#define UART_Int_TxTimeoutNotEmpty        0x00000008
+#define UART_Int_TxTimeoutEmpty           0x00000010
+#define UART_Int_RxHalfFull               0x00000020
+#define UART_Int_TxFull                   0x00000040
+#define UART_Int_ParityError              0x00000080
+#define UART_Int_FrameError               0x00000100
+#define UART_Int_OverrunError             0x00000200
+#define UART_Int_RxThresholdReach         0x00000400
+#define UART_Int_All                      0x000007FF
+
+#define IS_UART_INT(INT)        (((INT) != 0) && (((INT) & ~UART_Int_All) == 0))
+
+/**
+  * @}
+  */
+	
+/**
+  * @brief  UART initialization structure
+	*/ 
+typedef struct
+{
+	uint32_t UART_BaudRate;            /*!< Baudrate */																	  
+	uint8_t UART_StopBits;             /*!< Specifies the number of stop bits transmitted, 
+																					It's a value of @ref UART_StopBits */
+	uint8_t UART_Parity;               /*!< Specifies the parity mode. 
+																					It's a value of @ref UART_Parity */
+	BOOL UART_LoopBack;                /*!< loop back mode */
+	BOOL UART_RxEn;                    /*!< Receive enable bit */
+	BOOL UART_CtsEn;                   /*!< Clear to set */
+} UART_InitTypeDef;
+
+/**
+  * @brief  UART initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] UARTx UART peripheral, which is UART0, UART1 or UART2
+	* @param[in] init A pointer to structure UART_InitTypeDef
+  * @retval None
+	*/ 
+void UART_Init(UART0_Type* UARTx, UART_InitTypeDef *init);
+
+/**
+  * @brief  Enable or disable UART interrupt. 
+	* @param[in] UARTx UART peripheral, which is UART0, UART1 or UART2
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref UART_Int
+	* @param[in] Enable The bit indicates if specific interrupts are enable or not
+  * @retval None
+	*/ 
+void UART_EnableInt(UART0_Type* UARTx, uint32_t Int, BOOL Enable);
+
+/**
+  * @brief  Enable or disable UART. 
+	* @param[in] UARTx UART peripheral, which is UART0, UART1 or UART2
+	* @param[in] Enable The bit indicates if the specific UART is enable or not
+  * @retval None
+	*/ 
+void UART_Enable(UART0_Type* UARTx, BOOL enable);
+
+/**
+  * @brief  Check specific interrupts are set or not 
+	* @param[in] UARTx UART peripheral, which is UART0, UART1 or UART2
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref UART_Int
+  * @retval BOOL The bit indicates if specific interrupts are set or not
+	*/
+BOOL UART_GetIntStatus(UART0_Type* UARTx, uint32_t Int);
+
+/**
+  * @brief  Clear specific interrupts
+	* @param[in] UARTx UART peripheral, which is UART0, UART1 or UART2
+	* @param[in] Int interrupt mask bits, which can be the combination of @ref UART_Int
+  * @retval None
+	*/
+void UART_ClearInt(UART0_Type* UARTx, uint32_t Int);
+
+/**
+  * @brief  Write data to UART
+	* @param[in] UARTx UART peripheral, which is UART0, UART1 or UART2
+	* @param[in] Size Expected data size to be written
+	* @param[in] Data A pointer to the data to be written
+  * @retval uint8_t Actual written data size
+	*/
+uint8_t UART_Write(UART0_Type* UARTx, uint8_t Size, uint8_t* Data);
+
+/**
+  * @brief  Read data from UART
+	* @param[in] UARTx UART peripheral, which is UART0, UART1 or UART2
+	* @param[in] Size Expected data size to be read
+	* @param[out] Data A user-allocated buffer to fetch data to be read
+  * @retval uint8_t Actual read data size
+	*/
+uint8_t UART_Read(UART0_Type* UARTx, uint8_t Size, uint8_t* Data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_UART_H */
+

+ 588 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_usb.h

@@ -0,0 +1,588 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_usb.h
+	*
+	* @brief    CMEM7 USB header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#ifndef __CMEM7_USB_H
+#define __CMEM7_USB_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+#include "string.h"
+
+/**
+ *
+ */
+#define SET_HCDMA_DESC_ADDR(a)		(((uint32_t)(a)) >> 9)
+#define MIN(a, b)					(((a) <= (b)) ? (a) : (b))
+#define MAX(a, b)					(((a) >= (b)) ? (a) : (b))
+#define BIT(b)						(0x1u << (b))
+
+/** @defgroup USB_HOST_PID
+  * @{
+  */
+#define USB_HOST_PID_DATA0			0x0				/*!< Indicates the Data PID is DATA0                                       */
+#define USB_HOST_PID_DATA2			0x1				/*!< Indicates the Data PID is DATA2                                       */
+#define USB_HOST_PID_DATA1			0x2				/*!< Indicates the Data PID is DATA1                                       */
+#define USB_HOST_PID_MDATA			0x3				/*!< Indicates the Data PID is MDATA (non-control)                         */
+#define USB_HOST_PID_SETUP			0x3				/*!< Indicates the Data PID is SETUP (control)                             */
+/**
+  * @}
+  */
+
+/** @defgroup USB_EP_TYPE
+  * @{
+  */
+typedef enum {
+	USB_EP_TYPE_CONTROL =			0x0,			/*!< Control                                                               */
+	USB_EP_TYPE_ISO =				0x1,			/*!< Isochronous                                                           */
+	USB_EP_TYPE_BULK =				0x2,			/*!< Bulk                                                                  */
+	USB_EP_TYPE_INT =				0x3,			/*!< Interrupt                                                             */
+} USB_EP_TYPE;
+/**
+  * @}
+  */
+
+/** @defgroup USB_ENUM_SPEED
+  * @{
+  */
+typedef enum {
+	USB_ENUM_SPEED_HS =				0x0,			/*!< Enumerated Speed is High Speed                                        */
+	USB_ENUM_SPEED_FS =				0x1,			/*!< Enumerated Speed is Full Speed                                        */
+	USB_ENUM_SPEED_LS =				0x2,			/*!< Enumerated Speed is Low  Speed                                        */
+	USB_ENUM_SPEED_FS_48M =			0x3,			/*!< Enumerated Speed is Full Speed (PHY clock is running at 48MHz)        */
+} USB_ENUM_SPEED;
+/**
+  * @}
+  */
+
+/** @defgroup USB_INT_GP
+  * @{
+  */
+typedef enum {
+	USB_INT_GP_HOST_DISC,							/*!< Device disconnection interrupt (Only for HOST Mode)                   */
+	USB_INT_GP_DEV_RESET,							/*!< USB Port Reset Interrupt (Only for DEVICE Mode)                       */
+	USB_INT_GP_DEV_ENUMDONE,						/*!< Enumeration Done Interrupt (Only for DEVICE Mode)                     */
+	USB_INT_GP_DEV_SUSP,							/*!< USB Suspend Interrupt (Only for DEVICE Mode)                          */
+	USB_INT_GP_DEV_EARLY,							/*!< USB Idle Interrupt (Only for DEVICE Mode)                             */
+	USB_INT_GP_SOF,									/*!< SOF Interrupt                                                         */
+	USB_INT_GP_MIS,									/*!< USB access overstep the boundary Interrupt                            */
+	USB_INT_GP_IDCHG,								/*!< OTG Connector ID Status Change Interrupt                              */
+	USB_INT_GP_SESSREQ,								/*!< Session Request / Create Interrupt                                    */
+} USB_INT_GP;
+/**
+  * @}
+  */
+
+/** @defgroup USB_INT_OTG
+  * @{
+  */
+typedef enum {
+	USB_INT_OTG_SESEND,								/*!< Session End Interrupt                                                 */
+	USB_INT_OTG_STANDAUP,							/*!< B Device timeout to connect Interrupt                                 */
+	USB_INT_OTG_HNDETECT,							/*!< Host Negotiation Detected Interrupt                                   */
+	USB_INT_OTG_HNSUCCHG,							/*!< Host Negotiation Success Status Change Interrupt                      */
+	USB_INT_OTG_KEEPAPP,							/*!< Debounce Done Interrupt (Only for HOST Mode)                          */
+} USB_INT_OTG;
+/**
+  * @}
+  */
+
+/** @defgroup USB_OTG_CTL
+  * @{
+  */
+typedef enum {
+	USB_OTG_DEV_HNSUCC = 8,							/*!< Host Negotiation Success (Only for DEVICE Mode, Read Only)            */
+	USB_OTG_DEV_HNPREQ = 9,							/*!< HNP Request (Only for DEVICE Mode)                                    */
+	USB_OTG_HST_HNPENABLE = 10,						/*!< Host Set HNP Enable (Only for HOST Mode)                              */
+	USB_OTG_DEV_HNPENABLE = 11,						/*!< Device HNP Enabled (Only for DEVICE Mode)                             */
+} USB_OTG_CTL;
+
+/**
+  * @}
+  */
+
+typedef union {
+    __IO uint32_t  HPRT;                            /*!< Host Port Control and Status Register                                 */
+    
+    struct {
+      __I  uint32_t  PCS        :  1;               /*!< If a device is attached to the port                                   */
+      __IO uint32_t  PCD        :  1;               /*!< A device connection is detected                                       */
+      __IO uint32_t  PE         :  1;               /*!< Port Enable                                                           */
+      __IO uint32_t  PEDC       :  1;               /*!< Set if when the status of the Port Enable (bit 2) of this register
+                                                         changes                                                               */
+      __I  uint32_t  POA        :  1;               /*!< Indicates the overcurrent condition of the port                       */
+      __IO uint32_t  POC        :  1;               /*!< Set if when the status of the Port Overcurrent Active bit (bit
+                                                         4) in this register changes                                           */
+      __IO uint32_t  PR         :  1;               /*!< Application and Core all can perform resume by setting, then
+                                                         clear it whatever resume is success or not                            */
+      __IO uint32_t  PS         :  1;               /*!< Sets this bit to put this port in Suspend mode                        */
+      __IO uint32_t  PRESET     :  1;               /*!< sets this bit, a reset sequence is started on this port               */
+           uint32_t             :  1;
+      __IO uint32_t  PLSDP      :  1;               /*!< Logic level of D+                                                     */
+      __IO uint32_t  PLSDN      :  1;               /*!< Logic level of D-                                                     */
+      __IO uint32_t  PP         :  1;               /*!< this field to control power to this port. 1, power on                 */
+      __IO uint32_t  PTC        :  4;               /*!< The application writes a nonzero value to this field to put
+                                                         the port into a Test mode                                             */
+      __I  uint32_t  SPEED      :  2;               /*!< Indicates the speed of the device attached to this port               */
+    } HPRT_b;                                       /*!< BitSize                                                               */
+} USB_REG_HPRT;
+
+typedef struct {
+  union {
+    uint32_t VALUE;                                 /*!< provide the status of the buffer                                            */
+    struct {
+      __IO uint32_t  SIZE       : 17;               /*!< Total bytes to transfer for OUT; the expected transfer size for IN    */
+      __IO uint32_t  AQTD       :  6;               /*!< IN Only, Alternated Queue Transfer Descriptor Valid                   */
+      __IO uint32_t  AQTD_VLD   :  1;               /*!< IN Only, Alternated Queue Transfer Descriptor Valid                   */
+      __IO uint32_t  SUP        :  1;               /*!< OUT Only, it indicates that the buffer data pointed by this descriptor
+                                                       is a setup packet of 8 bytes                                            */
+      __IO uint32_t  IOC        :  1;               /*!< It indicates that that the core must generate a XferCompl interrupt   */
+      __IO uint32_t  EOL        :  1;               /*!< It indicates that this is the last descriptor in the list             */
+           uint32_t             :  1;
+      __IO uint32_t  STS        :  2;               /*!< The status of the rx/tx data:
+                                                       00=Success; 01=PKTERR; 10=Reserved; 11=Reserved                         */
+           uint32_t             :  1;
+      __IO uint32_t  A          :  1;               /*!< Active: 0=descriptor is not ready; 1=descriptor is ready              */
+    } HOST_NISO_b;                                  /*!< BitSize                                                               */
+    struct {
+      __IO uint32_t  SIZE       : 16;               /*!< Total bytes to transfer for OUT; the expected transfer size for IN    */
+           uint32_t             :  7;
+      __IO uint32_t  MTRF       :  1;               /*!< IN Only, Alternated Queue Transfer Descriptor Valid                   */
+      __IO uint32_t  SR         :  1;               /*!< IN Only, Alternated Queue Transfer Descriptor Valid                   */
+      __IO uint32_t  IOC        :  1;               /*!< It indicates that that the core must generate a XferCompl interrupt   */
+      __IO uint32_t  SP         :  1;               /*!< It indicates that this is the last descriptor in the list             */
+      __IO uint32_t  L          :  1;               /*!< It indicates that this is the last descriptor in the list             */
+      __IO uint32_t  STS        :  2;               /*!< The status of the rx/tx data:
+                                                       00=Success; 01=PKTERR; 10=Reserved; 11=Reserved                         */
+      __IO uint32_t  BS         :  2;               /*!< Active: 0=descriptor is not ready; 1=descriptor is ready              */
+    } DEV_NISO_OUT_b;                               /*!< BitSize                                                               */
+    struct {
+      __IO uint32_t  SIZE       : 16;               /*!< Total bytes to transfer for OUT; the expected transfer size for IN    */
+           uint32_t             :  7;
+      __IO uint32_t  PID        :  2;               /*!< IN Only, Alternated Queue Transfer Descriptor Valid                   */
+      __IO uint32_t  IOC        :  1;               /*!< It indicates that that the core must generate a XferCompl interrupt   */
+      __IO uint32_t  SP         :  1;               /*!< It indicates that this is the last descriptor in the list             */
+      __IO uint32_t  L          :  1;               /*!< It indicates that this is the last descriptor in the list             */
+      __IO uint32_t  STS        :  2;               /*!< The status of the rx/tx data:
+                                                       00=Success; 01=PKTERR; 10=Reserved; 11=Reserved                         */
+      __IO uint32_t  BS         :  2;               /*!< Active: 0=descriptor is not ready; 1=descriptor is ready              */
+    } DEV_NISO_IN_b;                                /*!< BitSize                                                               */
+  } QUADLET;
+  uint32_t  BUIFFER;                                /*!< points to a data buffer                                               */
+} OTG_DESCRIPTOR;
+
+/**
+ * @brief Get OTG Connector ID Status (Is B-Device)
+ * @retval BOOL TRUE: High; FALSE: Low
+   */
+BOOL USB_ogtIsBdevID(void);
+
+/**
+ * @brief Set USB Global Interrupt Enable
+   * @param[in] enable TRUE: Enable; FALSE: Disable
+ * @retval void
+   */
+void USB_EnableInt(BOOL enable);
+
+/**
+ * @brief Flush TX/RX FIFO
+   * @param[in] num Flush FIFO£¬0: non-periodic TX FIFO (HOST Mode) or FIFO 0 (DEVICE Mode); 1: Periodic TX FIFO (HOST Mode) or FIFO 1 (DEVICE Mode); 2-15: FIFO n in DEVICE Mode; 16: Flush All TX FIFO; otherwise: Flush RX FIFO
+ * @retval void
+   */
+void USB_FlushFIFO(uint32_t num);
+
+/**
+ * @brief Initialize USB
+   * @param[in] type USB Mode, Bit0: Force HOST Mode; Bit1: Force DEVICE Mode; Bit4: Enable SRP; Bit5: Enable HNP
+ * @retval void
+   */
+void USB_coreInit(uint32_t type);
+
+/**
+ * @brief Get USB Mode (Is Host Mode?)
+ * @retval BOOL TRUE: HOST Mode; FALSE: DEVICE Mode
+   */
+BOOL USB_roleIsHost(void);
+
+/**
+ * @brief Control and get VBus Status (Only for HOST Mode)
+   * @param[in] opt Bit1: Set VBus using Bit0; Bit0: Turn VBus On or Off
+ * @retval BOOL TRUE: VBus is on; FALSE£ºVBus is off
+ * @note It cannot control VBus actually due to HW problem
+   */
+BOOL USB_hostVBus(uint32_t opt);
+
+/**
+ * @brief Initialize USB HOST Module (Only for HOST Mode)
+ * @retval void
+   */
+void USB_hostInit(void);
+
+/**
+ * @brief Set USB Port Reset Status (Only for HOST Mode)
+   * @param[in] rst TRUE: Port is reseting; FALSE: Port stop reseting
+ * @retval void
+   */
+void USB_HostResetPort(BOOL rst);
+
+/**
+ * @brief Frame Number of the next SOF (Only for HOST Mode)
+ * @retval uint16_t Frame Number of the next SOF will be send
+   */
+uint16_t USB_HostGetCurFrame(void);
+
+/**
+ * @brief Suspend USP Port (Only for HOST Mode)
+ * @retval void
+   */
+void USB_HostSuspendPort(void);
+
+/**
+ * @brief Get the device enumerated speed (Only for HOST Mode)
+ * @retval USB_ENUM_SPEED A value of @ref USB_ENUM_SPEED defined
+   */
+USB_ENUM_SPEED USB_hostGetEnumSpd(void);
+
+/**
+ * @brief Get USB Port Connection Status (Only for HOST Mode)
+ * @retval BOOL TRUE: A device is attached; FALSE: No device is attached
+   */
+BOOL USB_hostPrtConn(void);
+
+/**
+ * @brief Channel 0 Transaction (Only for HOST Mode)
+   * @param[in] devaddr USB Device Address
+   * @param[in] desc A pointer to DMA Descriptor (512-byte alignment)
+   * @param[in] ctd In terms of number of DMA descriptors (0 means start from 1st DMA descriptor)
+   * @param[in] ntd Number of Transfer Descriptors (from 0 to 63 which means from 1 to 64 descriptors)
+   * @param[in] ping TRUE: Do PING protocol (Only for OUT Transfer); Must be 0 for IN Transfer
+   * @param[in] pid PID: A value of @ref USB_HOST_PID defined: USB_HOST_PID_DATA0, USB_HOST_PID_DATA2, USB_HOST_PID_DATA1, USB_HOST_PID_MDATA or USB_HOST_PID_SETUP
+   * @param[in] mps Maximum Packet Size (in bytes)
+   * @param[in] epnum Endpoint Address
+   * @param[in] in Is IN Transfer, TRUE: IN Transfer; FALSE: OUT Transfer
+   * @param[in] eptype Endpoint Type, A value of @ref USB_EP_TYPE defined
+   * @param[in] speed Device Speed, A value of @ref USB_ENUM_SPEED defined
+   */
+void USB_hostCH0(uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed);
+
+/**
+ * @brief Channel 1 Transaction (Only for HOST Mode)
+ * @see USB_hostCH0
+ */
+void USB_hostCH1(uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed);
+
+/**
+ * @brief Channel 2 Transaction (Only for HOST Mode)
+ * @see USB_hostCH0
+ */
+void USB_hostCH2(uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed);
+
+/**
+ * @brief Channel n Transaction (Only for HOST Mode)
+   * @param[in] ch Channel number will be used
+   * @param[in] devaddr USB Device Address
+   * @param[in] desc A pointer to DMA Descriptor (512-byte alignment)
+   * @param[in] ctd In terms of number of DMA descriptors (0 means start from 1st DMA descriptor)
+   * @param[in] ntd Number of Transfer Descriptors (from 0 to 63 which means from 1 to 64 descriptors)
+   * @param[in] ping TRUE: Do PING protocol (Only for OUT Transfer); Must be 0 for IN Transfer
+   * @param[in] pid PID: A value of @ref USB_HOST_PID defined: USB_HOST_PID_DATA0, USB_HOST_PID_DATA2, USB_HOST_PID_DATA1, USB_HOST_PID_MDATA or USB_HOST_PID_SETUP
+   * @param[in] mps Maximum Packet Size (in bytes)
+   * @param[in] epnum Endpoint Address
+   * @param[in] in Is IN Transfer, TRUE: IN Transfer; FALSE: OUT Transfer
+   * @param[in] eptype Endpoint Type, A value of @ref USB_EP_TYPE defined
+   * @param[in] speed Device Speed, A value of @ref USB_ENUM_SPEED defined
+ * @retval int returns 0 if success, otherwise returns a negative value
+   */
+int USB_hostCHn(uint32_t ch, uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed);
+
+/**
+ * @brief Halt Channel n (Only for HOST Mode)
+   * @param[in] ch Channel number will be halted
+ * @retval int returns 0 if success, otherwise returns a negative value
+   */
+int USB_hostCHnHalt(uint32_t ch);
+
+/**
+ * @brief Disable USB Port (Only for HOST Mode)
+   * @param[in] dis TRUE: Disable USB Port; FALSE: Do NOT Disable USB Port
+ * @retval BOOL If USB Port is disabled, TRUE: USB Port Disabled; FALSE: USB Port Enabled
+ * @note It CANNOT Enable USB Port; Port will be enabled automatically after the port was reset successfully.
+   */
+BOOL USB_hostPortDisable(BOOL dis);
+
+/**
+ * @brief Enable Connection Interrupt (Only for HOST Mode)
+   * @param[in] en TRUE: Enable Interrupt; FALSE: Mask the Interrupt
+ * @retval void
+   */
+void USB_hostINT_enConn(BOOL en);
+
+/**
+ * @brief Connection Interrupt Asserted (Only for HOST Mode)
+ * @retval BOOL TRUE: Interrupt Asserted; FALSE: Interrupt is NOT asserted
+ * @note PCD or PEDC asserted, please call USB_hostINT_clrPCD or USB_hostINT_clrPEDC function to clear it.
+   */
+BOOL USB_hostINT_isConn(void);
+
+/**
+ * @brief Port Connection Detected (PCD) Interrupt Asserted (Only for HOST Mode)
+ * @retval BOOL TRUE: Interrupt Asserted; FALSE: Interrupt is NOT asserted
+   */
+BOOL USB_hostINT_isPCD(void);
+
+/**
+ * @brief Clear Port Connection Detected (PCD) Interrupt Flag (Only for HOST Mode)
+ * @retval void
+   */
+void USB_hostINT_clrPCD(void);
+
+/**
+ * @brief Port Enable/Disable Change£¨PEDC£©Interrupt Asserted (Only for HOST Mode)
+ * @retval BOOL TRUE: Interrupt Asserted; FALSE: Interrupt is NOT asserted
+   */
+BOOL USB_hostINT_isPEDC(void);
+
+/**
+ * @brief Clear Port Enable/Disable Change£¨PEDC£©Interrupt Flag (Only for HOST Mode)
+ * @retval void
+   */
+void USB_hostINT_clrPEDC(void);
+
+/**
+ * @brief Enable Transaction Done Interrupt (Only for HOST Mode)
+   * @param[in] ch Channel to enable
+ * @para in en TRUE: Enable Interrupt; FALSE: Mask the Interrupt
+ * @retval int returns 0 if success, otherwise returns a negative value
+   */
+int USB_hostINT_enDone(uint32_t ch, BOOL en);
+
+/**
+ * @brief Transaction Done Interrupt Asserted (Only for HOST Mode)
+   * @param[in] ch Channel to check
+ * @retval uint32_t result, Bit0: Done; Bit1: Buffer Not Available Error; Bit2: Channel Idle; Bit3: Transaction Error
+   */
+uint32_t USB_hostINT_isDone(uint32_t ch);
+
+/**
+ * @brief Transaction Done Interrupt Asserted (Only for HOST Mode)
+   * @param[in] ch Channel to check
+ * @retval uint32_t result, 0: No interrupt is pendding
+   */
+uint32_t USB_hostINT_isPend(uint32_t ch);
+
+/**
+ * @brief Initialize USB DEVICE Module (Only for DEVICE Mode)
+ * @retval void
+   */
+void USB_devInit(void);
+
+/**
+ * @brief Get the device enumerated speed (Only for DEVICE Mode)
+ * @retval USB_ENUM_SPEED A value of @ref USB_ENUM_SPEED defined
+   */
+USB_ENUM_SPEED USB_devGetEnumSpd(void);
+
+/**
+ * @brief Set Device Address (Only for DEVICE Mode)
+   * @param[in] Device Address
+ * @retval void
+   */
+void USB_devSetAddress(uint32_t addr);
+
+
+/**
+ * @brief Endpoint 0 OUT Transation (Only for DEVICE Mode)
+   * @param[in] size Transation length (in bytes)
+   * @param[in] pktcnt Packet Count
+   * @param[in] stpcnt The number of back-to-back SETUP data packets the endpoint can receive. (0 - 3)
+   * @param[in] desc A pointer to DMA descriptors
+   * @param[in] snoop Snoop Mode, TRUE: Enable Snoop Mode, which means it does not check if the OUT packets are correct before transferring them to application memory; FLASE: Disable Snoop Mode
+ * @retval void
+   */
+void USB_devEP0out(uint32_t size, uint32_t pktcnt, uint32_t stpcnt, void *desc, BOOL snoop);
+
+/**
+ * @brief Endpoint 0 IN Transation (Only for DEVICE Mode)
+   * @param[in] size Transation length (in bytes)
+   * @param[in] pktcnt Packet Count
+   * @param[in] desc A pointer to DMA descriptors
+   * @param[in] mps Maximum Packet Size (in bytes), only 8,, 32, 64 is valid
+ * @retval BOOL TRUE: Parameter mps is valid; FLASE: Parameter mps is invalid
+   */
+BOOL USB_devEP0in(uint32_t size, uint32_t pktcnt, void *desc, uint32_t mps/*8,16,32,64-byte*/);
+
+/**
+ * @brief Active Endpoint 1 (Only for DEVICE Mode)
+   * @param[in] in Endpoint direction, TRUE: IN; FALSE: OUT
+   * @param[in] mps Maximum Packet Size (in bytes), 0 means inactive the endpoint
+   * @param[in] type Endpoint type, A value of @ref USB_EP_TYPE defined
+ * @retval void
+ * @note All Endpoint but EP0 will be inactived after USB Port reseted
+   */
+void USB_devActEP1(const BOOL in, const uint32_t mps, USB_EP_TYPE type);
+
+/**
+ * @brief Active Endpoint 2 (Only for DEVICE Mode)
+ * @see USB_devActEP1
+ */
+void USB_devActEP2(const BOOL in, const uint32_t mps, USB_EP_TYPE type);
+
+/**
+ * @brief Endpoint 1 IN Transation (Only for DEVICE Mode)
+   * @param[in] size Maximum Packet Size (in bytes)
+   * @param[in] pktcnt Packet Count
+   * @param[in] pid PID (only for interrupt/bulk), 0x1 means DATA0; 0x2 means DATA1
+   * @param[in] desc A pointer to DMA descriptors
+ * @retval void
+ * @see
+ */
+void USB_devEP1in(uint32_t size, uint32_t pktcnt, uint32_t pid, void *desc);
+
+/**
+ * @brief Endpoint 1 OUT Transation (Only for DEVICE Mode)
+   * @param[in] size Data length (in bytes)
+   * @param[in] pktcnt Packet Count
+   * @param[in] PID (only for interrupt/bulk), 0x1 means DATA0; 0x2 means DATA1
+   * @param[in] stpcnt The number of back-to-back SETUP data packets the endpoint can receive. (0 - 3)
+   * @param[in] desc A pointer to DMA descriptors
+   * @param[in] snoop Snoop Mode, TRUE: Enable Snoop Mode, which means it does not check if the OUT packets are correct before transferring them to application memory; FLASE: Disable Snoop Mode
+ * @retval void
+   */
+void USB_devEP1out(uint32_t size, uint32_t pktcnt, uint32_t pid, uint32_t stpcnt, void *desc, BOOL snoop);
+
+/**
+ * @brief Endpoint 2 IN Transation (Only for DEVICE Mode)
+ * @see USB_devEP1in
+ */
+void USB_devEP2in(uint32_t size, uint32_t pktcnt, uint32_t pid, void *desc);
+
+/**
+ * @brief Endpoint 2 OUT Transation (Only for DEVICE Mode)
+ * @see USB_devEP1out
+ */
+void USB_devEP2out(uint32_t size, uint32_t pktcnt, uint32_t pid, uint32_t stpcnt, void *desc, BOOL snoop);
+
+/**
+ * @brief Set NAK handshake (Only for DEVICE Mode)
+   * @param[in] ep Endpoint
+   * @param[in] in Endpoint Direction, TRUE: IN; FALSE: OUT
+   * @param[in] en TRUE: Enable NAK handshake; FALSE: Disable NAK handshake
+ * @retval void
+   */
+void USB_devNAKhandshake(uint32_t ep, BOOL in, BOOL en);
+
+/**
+ * @brief Set STALL handshake (Only for DEVICE Mode)
+   * @param[in] ep Endpoint
+   * @param[in] in Endpoint Direction, TRUE: IN; FALSE: OUT
+   * @param[in] en TRUE: Enable STALL handshake; FALSE: Disable STALL handshake
+ * @retval BOOL Return the old status before en is set.
+ * @note Not for ISO Endpoint; For Endpoint 0 it clears itself when a SETUP token is received.
+   */
+BOOL USB_devSTALLhandshake(uint32_t ep, BOOL in, BOOL en);
+
+/**
+ * @brief Enable Transaction Done Interrupt (Only for DEVICE Mode)
+   * @param[in] ep Endpoint
+   * @param[in] in Endpoint Direction, TRUE: IN; FALSE: OUT
+ * @para in en TRUE: Enable Interrupt; FALSE: Mask the Interrupt
+ * @retval void
+   */
+void USB_devINT_enDone(uint32_t ep, BOOL in, BOOL en);
+
+/**
+ * @brief Transaction Done Interrupt Asserted (Only for DEVICE Mode)
+   * @param[in] ep Endpoint
+   * @param[in] in Endpoint Direction, TRUE: IN; FALSE: OUT
+ * @retval uint32_t Result, Bit0: Done; Bit1£ºBuffer Not Available Error; Bit2: SETUP Phase Done
+   */
+uint32_t USB_devINT_isDone(uint32_t ep, BOOL in);
+
+/**
+ * @brief Enable OTG Interrupt (Only for DEVICE Mode)
+ * @para in en TRUE: Enable Interrupt; FALSE: Mask the Interrupt
+ * @retval void
+   */
+void USB_INT_enOTG(BOOL en);
+
+/**
+ * @brief OTG Interrupt Asserted
+ * @retval BOOL TRUE: Interrupt Asserted; FALSE: Interrupt is NOT asserted
+   */
+BOOL USB_INT_isOTG(void);
+
+/**
+ * @brief OTG Function Interrupt Asserted
+   * @param[in] otg OTG Function Interrupt to check, A value of @ref USB_INT_OTG defined
+ * @retval BOOL TRUE: Interrupt Asserted; FALSE: Interrupt is NOT asserted
+   */
+BOOL USB_INT_isOTGon(USB_INT_OTG otg);
+
+/**
+ * @brief Clear OTG Function Interrupt Flag
+   * @param[in] otg OTG Function Interrupt to clear, A value of @ref USB_INT_OTG defined
+ * @retval void
+   */
+void USB_INT_clrOTGon(USB_INT_OTG otg);
+
+/**
+ * @brief Enable @ref USB_INT_GP Interrupt
+ * @para in name Interrupt to operate, A value of @ref USB_INT_GP defined
+ * @para in en TRUE: Enable Interrupt; FALSE: Mask the Interrupt
+ * @retval void
+ */
+void USB_INT_enGP(USB_INT_GP name, BOOL en);
+
+/**
+ * @brief @ref USB_INT_GP Interrupt Asserted
+ * @para in name Interrupt to check, A value of @ref USB_INT_GP defined
+ * @retval BOOL TRUE: Interrupt Asserted; FALSE: Interrupt is NOT asserted
+   */
+BOOL USB_INT_isGP(USB_INT_GP name);
+
+/**
+ * @brief Clear @ref USB_INT_GP Interrupt Flag
+ * @para in name Interrupt to clear, A value of @ref USB_INT_GP defined
+ * @retval void
+   */
+void USB_INT_clrGP(USB_INT_GP name);
+
+/**
+ * @brief Enable OTG Function
+   * @param[in] ctl OTG Function to operate, A value of @ref USB_OTG_CTL defined
+   * @param[in] val TRUE: Enable the function; FALSE: Disable the function
+ * @retval BOOL The old value before it configure
+   */
+BOOL USB_otgControl(USB_OTG_CTL ctl, BOOL val);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_USB_H */

+ 110 - 0
bsp/CME_M7/StdPeriph_Driver/inc/cmem7_wdg.h

@@ -0,0 +1,110 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_wdg.h
+	*
+	* @brief    CMEM7 watchdog header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#ifndef __CMEM7_WDG_H
+#define __CMEM7_WDG_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7.h"
+#include "cmem7_conf.h"
+
+/** @defgroup WDG_INT
+  * @{
+  */
+#define WDG_INT_QUARTER                 0
+#define WDG_INT_HALF                    1
+#define IS_WDG_INT(INT)                 (((INT) == WDG_INT_QUARTER) || \
+                                         ((INT) == WDG_INT_HALF))
+/**
+  * @}
+  */
+
+/** @defgroup WDG_TRIGGER_MODE
+  * @{
+  */
+#define WDG_TRIGGER_MODE_EDGE           0
+#define WDG_TRIGGER_MODE_LEVEL          1
+#define IS_WDG_TRIGGER_MODE(TRI)        (((TRI) == WDG_TRIGGER_MODE_EDGE) || \
+                                         ((TRI) == WDG_TRIGGER_MODE_LEVEL))
+/**
+  * @}
+  */
+
+/**
+  * @brief  Deinitializes the Watchdog peripheral registers to their default reset values.
+	* @param[in] None
+  * @retval None
+	*/ 
+void WDG_DeInit(void);
+
+/**
+  * @brief  Watchdog initialization
+  * @note   This function should be called at first before any other interfaces.
+	* @param[in] trigger Watchdog interrupt trigger mode, which is a value of @ref WDG_TRIGGER_MODE
+	* @param[in] ResetMillSecond MillSeconds lasts before global reset
+  * @retval None
+	*/ 
+void WDG_Init(uint8_t trigger, uint16_t ResetMillSecond);
+
+/**
+  * @brief  Enable or disable watchdog interrupt. 
+	* @param[in] Int interrupt mask bits, which is a value of @ref WDG_INT
+	* @param[in] Enable The bit indicates if the specific interrupt are enable or not
+  * @retval None
+	*/ 
+void WDG_ITConfig(uint8_t Int, BOOL Enable);
+
+/**
+  * @brief  Check the specific interrupt are set or not 
+	* @param	None
+  * @retval BOOL The bit indicates if the specific interrupt are set or not
+	*/
+BOOL WDG_GetITStatus(void);
+
+/**
+  * @brief  Clear the specific interrupt
+	* @param	None
+  * @retval None
+	*/
+void WDG_ClearITPendingBit(void);
+
+/**
+  * @brief  Enable or disable watchdog. 
+	* @param[in] Enable The bit indicates if watchdog is enable or not
+  * @retval None
+	*/ 
+void WDG_Cmd(BOOL Enable);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMEM7_WDG_H */
+

+ 47 - 0
bsp/CME_M7/StdPeriph_Driver/inc/system_cmem7.h

@@ -0,0 +1,47 @@
+/**
+	*****************************************************************************
+	* @file     system_cmem7.h
+	*
+	* @brief    CMEM7 system initial header file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note      
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#ifndef __SYSTEM_CMEM7_H
+#define __SYSTEM_CMEM7_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/**
+  * @brief  Setup the microcontroller system.
+  * @note   This function should be used only after reset.
+	* @param  None
+  * @retval None
+	*/  
+void SystemInit(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SYSTEM_CMEM7_H */
+

+ 309 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_adc.c

@@ -0,0 +1,309 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_adc.c
+	*
+	* @brief    CMEM7 ADC source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_adc.h"
+#include "cmem7.h"
+
+#define ADC_SYSTEM_MODE_IDLE       0
+
+static BOOL adc_IsMultiChannel(uint32_t channel) {
+	uint32_t i = 0;
+  
+	for (i = 0; channel != 0; i++) {
+    channel &= (channel - 1);
+	}
+	
+	return ((i > 1) ? TRUE : FALSE);
+}
+
+static uint8_t adc_GetChannel(uint32_t channel) {
+	uint32_t i = 0;
+  
+	for (i = 0; channel > 1; i++) {
+    channel >>= 1;
+	}
+	
+	return i;
+}
+
+static void adc_Reset(uint8_t adc, BOOL enable) {
+	if (adc == ADC_PERIPH_1) {
+		ADC->POWERDOWN_RESET_b.POWERDOWN_ADC1 = TRUE;
+		ADC->POWERDOWN_RESET_b.RESET_ADC1 = TRUE;
+		udelay(8000);
+		if (enable) {
+			ADC->POWERDOWN_RESET_b.POWERDOWN_ADC1 = FALSE;
+			ADC->POWERDOWN_RESET_b.RESET_ADC1 = FALSE;
+			udelay(8000);
+		}
+	} else {
+		ADC->POWERDOWN_RESET_b.POWERDOWN_ADC2 = TRUE;
+		ADC->POWERDOWN_RESET_b.RESET_ADC2 = TRUE;
+		udelay(8000);
+		if (enable) {
+			ADC->POWERDOWN_RESET_b.POWERDOWN_ADC2 = FALSE;
+			ADC->POWERDOWN_RESET_b.RESET_ADC2 = FALSE;
+			udelay(8000);
+		}
+	}
+}
+
+void ADC_Init(ADC_InitTypeDef* init) {
+	assert_param(init);
+	assert_param(IS_ADC_PHASE_CTRL(init->ADC_PhaseCtrl));
+	assert_param(IS_ADC_VSEN(init->ADC_VsenSelection));
+	
+	SOFT_RESET->SOFTRST_b.ADC_n = 0;
+	SOFT_RESET->SOFTRST_b.ADC_n = 1;
+	
+	ADC->CFG0_b.PHASE_CTRL = init->ADC_PhaseCtrl;
+	ADC->CFG0_b.VSEN = init->ADC_VsenSelection;
+}
+
+void ADC_Enable(uint8_t adc, BOOL enable) {
+	assert_param(IS_ADC_ALL_PERIPH(adc));
+	
+	adc_Reset(adc, enable);
+}
+
+void ADC_EnableInt(uint32_t Int, BOOL enable) {
+	assert_param(IS_ADC_INT(Int));
+	
+	if (enable) {
+	  ADC->INT_MASK &= ~Int;
+	} else {
+		ADC->INT_MASK |= Int;
+	}
+}
+
+BOOL ADC_GetIntStatus(uint32_t Int) {
+	assert_param(IS_ADC_INT(Int));
+	
+	if (0 != (ADC->INT_STATUS & Int)) {
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+
+void ADC_ClearInt(uint32_t Int) {
+	assert_param(IS_ADC_INT(Int));
+	
+	ADC->INT_STATUS = Int;
+}
+
+BOOL ADC_StartConversion(uint8_t adc, uint8_t convMode, uint32_t channel) {
+	assert_param(IS_ADC_ALL_PERIPH(adc));
+	assert_param(IS_ADC_CONVERSION(convMode));
+	
+	if (adc == ADC_PERIPH_1) {
+		assert_param(IS_ADC1_CHANNEL(channel));
+		if (ADC->BUSY_b.ADC1_BUSY) {
+			return FALSE;
+		}
+		
+		if (adc_IsMultiChannel(channel)) {
+			ADC->CFG_ADC1_b.SYSTEM_MODE = ADC_SYSTEM_MODE_SINGLE_CONV;
+			ADC->CFG_ADC1_b.MULTI_CHANNEL_BIT = channel;
+			ADC->CFG_ADC1_b.MULTI_CHANNEL_CONTINUE_SCAN = 
+				(convMode == ADC_SYSTEM_MODE_CONTINUOUS_CONV) ? 1 : 0;
+		} else {
+			ADC->CFG_ADC1_b.SYSTEM_MODE = convMode;
+				
+			if (convMode == ADC_SYSTEM_MODE_CONTINUOUS_CONV) {
+				ADC->CFG_ADC1_b.CHANNEL_SEL = adc_GetChannel(channel);
+			} else {
+				ADC->CFG_ADC1_b.MULTI_CHANNEL_BIT = channel;
+				ADC->CFG_ADC1_b.MULTI_CHANNEL_CONTINUE_SCAN = 0;
+			}				
+		}
+				
+		ADC->ADC1_START_b.EN = TRUE;
+	} else {
+		assert_param(IS_ADC2_CHANNEL(channel));
+		if (ADC->BUSY_b.ADC2_BUSY) {
+			return FALSE;
+		}		
+		
+		if (adc_IsMultiChannel(channel)) {
+			ADC->CFG_ADC2_b.SYSTEM_MODE = ADC_SYSTEM_MODE_SINGLE_CONV;
+			ADC->CFG_ADC2_b.MULTI_CHANNEL_BIT = channel;
+			ADC->CFG_ADC2_b.MULTI_CHANNEL_CONTINUE_SCAN = 
+				(convMode == ADC_SYSTEM_MODE_CONTINUOUS_CONV) ? 1 : 0;
+		} else {
+			ADC->CFG_ADC2_b.SYSTEM_MODE = convMode;
+				
+			if (convMode == ADC_SYSTEM_MODE_CONTINUOUS_CONV) {
+				ADC->CFG_ADC2_b.CHANNEL_SEL = adc_GetChannel(channel);
+			} else {
+				ADC->CFG_ADC2_b.MULTI_CHANNEL_BIT = channel;
+				ADC->CFG_ADC2_b.MULTI_CHANNEL_CONTINUE_SCAN = 0;
+			}				
+		}
+				
+		ADC->ADC2_START_b.EN = TRUE;
+	}
+	
+	return TRUE;
+}
+
+BOOL ADC_StartCalibration(uint8_t adc, uint8_t calibration) {
+	assert_param(IS_ADC_ALL_PERIPH(adc));
+	assert_param(IS_ADC_CALIBRATION(calibration));
+	
+	if (adc == ADC_PERIPH_1) {
+		if (ADC->BUSY_b.ADC1_BUSY) {
+			return FALSE;
+		}
+		
+		ADC->CFG_ADC1_b.SYSTEM_MODE = calibration;
+		ADC->ADC1_START_b.EN = TRUE;
+	} else {
+		if (ADC->BUSY_b.ADC2_BUSY) {
+			return FALSE;
+		}
+
+		ADC->CFG_ADC2_b.SYSTEM_MODE = calibration;
+		ADC->ADC2_START_b.EN = TRUE;
+	}
+	
+	return TRUE;	
+}
+
+void ADC_Stop(uint8_t adc) {
+	assert_param(IS_ADC_ALL_PERIPH(adc));
+	
+	if (adc == ADC_PERIPH_1) {
+		if (IS_ADC_CONVERSION(ADC->CFG_ADC1_b.SYSTEM_MODE)) {
+			ADC->ADC1_STOP_b.EN = TRUE;
+		}
+		while (ADC->BUSY_b.ADC1_BUSY) ;
+		
+		ADC->ADC1_FIFO_CLEAR_b.CLEAR = TRUE;
+		//udelay(1000);
+		ADC->ADC1_FIFO_CLEAR_b.CLEAR = FALSE;
+	} else {
+		if (IS_ADC_CONVERSION(ADC->CFG_ADC2_b.SYSTEM_MODE)) {
+			ADC->ADC2_STOP_b.EN = TRUE;
+		}
+		while (ADC->BUSY_b.ADC2_BUSY) ;
+			
+		ADC->ADC2_FIFO_CLEAR_b.CLEAR = TRUE;
+		//udelay(1000);
+		ADC->ADC2_FIFO_CLEAR_b.CLEAR = FALSE;
+	}	
+}
+
+BOOL ADC_IsBusy(uint8_t adc) {
+	assert_param(IS_ADC_ALL_PERIPH(adc));
+	
+	if (adc == ADC_PERIPH_1) {
+		if (ADC->BUSY_b.ADC1_BUSY) {
+			return TRUE;
+		}
+	} else {
+		if (ADC->BUSY_b.ADC2_BUSY) {
+			return TRUE;
+		}
+	}
+	
+	return FALSE;
+}
+
+/* return value is actual read data size */
+uint8_t ADC_Read(uint8_t adc, uint8_t size, ADC_Data* data) {
+	uint8_t count = 0;
+	uint8_t sysMode;
+	uint32_t tmp = 0;
+	assert_param(IS_ADC_ALL_PERIPH(adc));
+	assert_param(data);
+	
+	if (adc == ADC_PERIPH_1) {
+		sysMode = ADC->CFG_ADC1_b.SYSTEM_MODE;
+	} else {
+		sysMode = ADC->CFG_ADC2_b.SYSTEM_MODE;
+	}
+	
+	if ((sysMode == ADC_SYSTEM_MODE_SINGLE_CONV) ||
+		(sysMode == ADC_SYSTEM_MODE_CONTINUOUS_CONV)) {
+		while (count < size) {
+			if (adc == ADC_PERIPH_1) {
+				if (ADC->STATUS_b.ADC1_READ_EMPTY) {
+					break;
+				}
+				
+				tmp = ADC->ADC1_FIFO_READ;
+				(data + count)->channel = 1 << ((tmp&0xf000) >> 12);
+				(data + count++)->data = (tmp & 0xfff);
+			} else {
+				if (ADC->STATUS_b.ADC2_READ_EMPTY) {
+					break;
+				}
+				tmp = ADC->ADC2_FIFO_READ;
+				(data + count)->channel = 1 << ((tmp&0xf000) >> 12);
+				(data + count++)->data = (tmp & 0xfff);
+			}
+		}
+	} else if (sysMode == ADC_CALIBRATION_OFFSET) {
+		if (adc == ADC_PERIPH_1) {
+			if (!ADC->BUSY_b.ADC1_BUSY) {
+				(data + count)->channel = ADC_CHANNEL_CALIBRATION;
+				(data + count++)->data = ADC->ADC1_OUT_OFFSET_CALIBRATION;
+		  }	
+		} else {
+			if (!ADC->BUSY_b.ADC2_BUSY) {
+				(data + count)->channel = ADC_CHANNEL_CALIBRATION;
+				(data + count++)->data = ADC->ADC2_OUT_OFFSET_CALIBRATION;
+		  }
+		}
+	} else if (sysMode == ADC_CALIBRATION_NEGTIVE_GAIN) {	
+		if (adc == ADC_PERIPH_1) {
+			if (!ADC->BUSY_b.ADC1_BUSY) {
+				(data + count)->channel = ADC_CHANNEL_CALIBRATION;
+				(data + count++)->data = ADC->ADC1_OUT_NEGTIVE_GAIN_CALIBRATION;
+			}	
+		} else {
+			if (!ADC->BUSY_b.ADC2_BUSY) {
+			  (data + count)->channel = ADC_CHANNEL_CALIBRATION;
+				(data + count++)->data = ADC->ADC2_OUT_NEGTIVE_GAIN_CALIBRATION;
+		  }
+		}
+	} else {
+		if (adc == ADC_PERIPH_1) {
+			if (!ADC->BUSY_b.ADC1_BUSY) {
+				(data + count)->channel = ADC_CHANNEL_CALIBRATION;
+				(data + count++)->data = ADC->ADC1_OUT_POSITIVE_GAIN_CALIBRATION;
+			}	
+		} else {
+			if (!ADC->BUSY_b.ADC2_BUSY) {
+			  (data + count)->channel = ADC_CHANNEL_CALIBRATION;
+				(data + count++)->data = ADC->ADC2_OUT_POSITIVE_GAIN_CALIBRATION;
+		  }
+		}
+	}
+	
+	return count;
+}

+ 53 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_aes.c

@@ -0,0 +1,53 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_aes.c
+	*
+	* @brief    CMEM7 AES source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_aes.h"
+
+BOOL AES_Decrypt(const void *src, void *dst, uint32_t len)
+{
+	uint32_t *po = dst;
+	const uint32_t *pi = src;
+
+	if (len & 0xF)
+		return FALSE;
+
+	AES->FIFO_CLEAR = 1;
+	AES->FIFO_CLEAR = 0;
+	GLOBAL_CTRL->AES_BURST_TYPE = 0x1;						// Cannot be 0
+	while (len > 0) {
+		while (0 == GLOBAL_CTRL->AES_STATUS_b.IDLE);		// 0x41007010
+		udelay(2);
+		GLOBAL_CTRL->AES_TARGET_ADDR = (uint32_t)po;		// 0x41800000;
+		po += 4;
+		len -= 4 * sizeof(uint32_t);
+		while (0 == GLOBAL_CTRL->AES_STATUS_b.RD_EMPTY);	// 0x41007010
+		AES->FIFO = *pi++;
+		AES->FIFO = *pi++;
+		AES->FIFO = *pi++;
+		AES->FIFO = *pi++;
+	}
+	return TRUE;
+}

+ 386 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_can.c

@@ -0,0 +1,386 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_can.c
+	*
+	* @brief    CMEM7 CAN source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_can.h"
+
+typedef struct {
+  union {
+    __IO uint8_t   FI;                        /*!< Transmit Frame Information if writting or Receive Frame Information
+                                                   if reading, ACR[0] if reset mode                                      */
+                                                    
+    struct {
+      __IO uint8_t   DLC        :  4;         /*!< byte number in the data                                               */
+           uint8_t              :  2;
+      __IO uint8_t   RTR        :  1;         /*!< 1 indicates a remote frame; 0 indicates a data frame                  */
+      __IO uint8_t   FF         :  1;         /*!< 1 selects Extended Frame Format (EFF); 0 selects Standard Frame
+                                                   Format (SFF)                                                          */
+    } FI_b;                                   /*!< BitSize                                                               */
+  } U;
+} CAN_FRAME_INFO;
+
+typedef struct {
+	union {
+    uint16_t  ID;                             /*!< ID                                  */
+    
+    struct {
+      uint16_t  ID28_21   :  8;               /*!< ID28 to ID21                        */
+      uint16_t            :  4;               
+      uint16_t  RTR       :  1;               /*!< if remote frame                     */
+      uint16_t  ID20_18   :  3;               /*!< ID20 to ID18                        */
+    } ID_b;                                   /*!< BitSize                             */
+  } U;
+} CAN_STANDARD_ID;
+
+typedef struct {
+  union {
+    uint32_t  ID;                             /*!< ID                                  */
+    
+    struct {
+      uint32_t  ID28_21   :  8;               /*!< ID28 to ID21                        */
+      uint32_t  ID20_13   :  8;               /*!< ID20 to ID13                        */
+			uint32_t  ID12_5    :  8;               /*!< ID12 to ID5                         */
+			uint32_t            :  2;
+      uint32_t  RTR       :  1;               /*!< if remote frame                     */
+      uint32_t  ID4_0     :  5;               /*!< ID4 to ID0                          */
+    } ID_b;                                   /*!< BitSize                             */
+  } U;
+} CAN_EXTENDED_ID;
+
+#define CAN_MODE_NORMAL            0x00000000
+#define CAN_MODE_RESET             0x00000001
+#define CAN_MODE_LISTEN_ONLY       0x00000002
+#define CAN_MODE_SELF_TEST         0x00000004
+#define CAN_MODE_SINGLE_FILTER     0x00000008
+#define CAN_MODE_SLEEP             0x00000010
+
+#define CAN_OCR_NORMAL             0x02
+#define CAN_OCR_CLOCK              0x03
+
+static BOOL can_SetFilter(CAN0_Type* CANx, CAN_FILTER *f1, CAN_FILTER *f2) {
+	if (!f1) {
+		return FALSE;
+	}
+	
+	if (!IS_CAN_FLT_TYPE(f1->type)) {
+		return FALSE;
+	}
+	
+	if(IS_CAN_FLT_DUAL(f1->type)) {
+		if (!f2 || IS_CAN_FLT_SINGLE(f2->type)) {
+			return FALSE;
+		}
+	}
+	
+	if (f1->type == CAN_FLT_STANDARD_SINGLE) {
+	  CANx->FI_OR_ACR0 = f1->ACCEPT.sf.ID28_18 >> 3;
+		CANx->DI0_OR_ACR1 = (f1->ACCEPT.sf.ID28_18 & 0x07) << 5;
+		CANx->DI0_OR_ACR1 |= f1->ACCEPT.sf.RTR << 4;
+		CANx->DI1_OR_ACR2 = f1->ACCEPT.sf.data1;
+		CANx->DI2_OR_ACR3 = f1->ACCEPT.sf.data2;
+		
+		CANx->DI3_OR_AMR0 = f1->MASK.sf.ID28_18 >> 3;
+		CANx->DI4_OR_AMR1 = (f1->MASK.sf.ID28_18 & 0x07) << 5;
+		CANx->DI4_OR_AMR1 |= f1->MASK.sf.RTR << 4;
+		CANx->DI5_OR_AMR2 = f1->MASK.sf.data1;
+		CANx->DI6_OR_AMR3 = f1->MASK.sf.data2;
+	} else if (f1->type == CAN_FLT_STANDARD_DUAL) {
+	  CANx->FI_OR_ACR0 = f1->ACCEPT.sf.ID28_18 >> 3;
+		CANx->DI0_OR_ACR1 = (f1->ACCEPT.sf.ID28_18 & 0x07) << 5;
+		CANx->DI0_OR_ACR1 |= f1->ACCEPT.sf.RTR << 4;
+		CANx->DI0_OR_ACR1 |= f1->ACCEPT.sf.data1 >> 4;
+		CANx->DI2_OR_ACR3 = f1->ACCEPT.sf.data1 & 0x0F;
+		
+		CANx->DI3_OR_AMR0 = f1->MASK.sf.ID28_18 >> 3;
+		CANx->DI4_OR_AMR1 = (f1->MASK.sf.ID28_18 & 0x07) << 5;
+		CANx->DI4_OR_AMR1 |= f1->MASK.sf.RTR << 4;
+		CANx->DI4_OR_AMR1 = f1->MASK.sf.data1 >> 4;
+		CANx->DI6_OR_AMR3 = f1->MASK.sf.data1 & 0x0F;
+	} else if (f1->type == CAN_FLT_EXTENDED_SINGLE) {
+	  CANx->FI_OR_ACR0 = f1->ACCEPT.ef.ID28_13 >> 8;
+		CANx->DI0_OR_ACR1 = f1->ACCEPT.ef.ID28_13 & 0xFF;
+		CANx->DI1_OR_ACR2 = f1->ACCEPT.ef.ID12_0 >> 5;
+		CANx->DI2_OR_ACR3 = (f1->ACCEPT.ef.ID12_0 & 0x1F) << 3;
+		CANx->DI2_OR_ACR3 |= f1->ACCEPT.ef.RTR << 2;
+		
+		CANx->DI3_OR_AMR0 = f1->MASK.ef.ID28_13 >> 8;
+		CANx->DI4_OR_AMR1 = f1->MASK.ef.ID28_13 & 0xFF;
+		CANx->DI5_OR_AMR2 = f1->MASK.ef.ID12_0 >> 5;
+		CANx->DI6_OR_AMR3 = (f1->MASK.ef.ID12_0 & 0x1F) << 3;
+		CANx->DI6_OR_AMR3 |= f1->MASK.ef.RTR << 2;
+	} else {
+	  CANx->FI_OR_ACR0 = f1->ACCEPT.ef.ID28_13 >> 8;
+		CANx->DI0_OR_ACR1 = f1->ACCEPT.ef.ID28_13 & 0xFF;
+		
+		CANx->DI3_OR_AMR0 = f1->MASK.ef.ID28_13 >> 8;
+		CANx->DI4_OR_AMR1 = f1->MASK.ef.ID28_13 & 0xFF;
+	}
+	
+	if (IS_CAN_FLT_DUAL(f1->type)) {
+		if (f2->type == CAN_FLT_STANDARD_DUAL) {
+			CANx->DI1_OR_ACR2 = f2->ACCEPT.sf.ID28_18 >> 3;
+			CANx->DI2_OR_ACR3 |= (f2->ACCEPT.sf.ID28_18 & 0x07) << 5;
+			CANx->DI2_OR_ACR3 |= f2->ACCEPT.sf.RTR << 4;
+			
+			CANx->DI5_OR_AMR2 = f2->MASK.sf.ID28_18 >> 3;
+			CANx->DI6_OR_AMR3 |= (f2->MASK.sf.ID28_18 & 0x07) << 5;
+			CANx->DI6_OR_AMR3 |= f2->MASK.sf.RTR << 4;
+		} else {
+			CANx->DI1_OR_ACR2 = f2->ACCEPT.ef.ID28_13 >> 8;
+			CANx->DI2_OR_ACR3 = f2->ACCEPT.ef.ID28_13 & 0xFF;
+			
+			CANx->DI5_OR_AMR2 = f2->MASK.ef.ID28_13 >> 8;
+			CANx->DI6_OR_AMR3 = f2->MASK.ef.ID28_13 & 0xFF;
+		}
+	}
+	
+	if (IS_CAN_FLT_SINGLE(f1->type)) {
+		CANx->MODE_b.AFM = 1;
+	} else {
+	  CANx->MODE_b.AFM = 0;
+	}
+	
+	return TRUE;
+}
+
+BOOL CAN_Init(CAN0_Type* CANx, CAN_InitTypeDef* Init, 
+  CAN_FILTER *f1, CAN_FILTER *f2) {
+	assert_param(IS_CAN_ALL_PERIPH(CANx));
+	assert_param(Init);
+	assert_param(IS_CAN_CDR_DIV(Init->CAN_ClockDiv));
+		
+	/* Quit to sleep mode in operation mode */
+	if (CANx->MODE_b.SM) {
+		CANx->MODE_b.RM = FALSE;
+		CANx->MODE_b.SM = FALSE;
+	}
+	
+	/* switch to reset mode to set parameter */
+	CANx->MODE_b.RM = TRUE;
+
+	/* disable all interrupts and clear except receive interrupt */
+	{
+		uint8_t tmp;
+		CANx->INT_EN &= ~CAN_INT_All;
+		tmp = CANx->INT;
+		tmp = tmp;
+	}
+	
+	CANx->MODE_b.LOM = (Init->CAN_TxEn) ? FALSE : TRUE;
+	
+	CANx->MODE_b.STM = Init->CAN_Loopback;
+		
+	CANx->CDR_b.OFF = FALSE;
+	CANx->CDR_b.DIVIDER = Init->CAN_ClockDiv;
+	
+	CANx->BTR0_b.BRP = Init->CAN_Prescaler;
+	CANx->BTR0_b.SJW = Init->CAN_SJW;
+	
+	CANx->BTR1_b.TSEG1 = Init->CAN_TSEG1;
+	CANx->BTR1_b.TSEG2 = Init->CAN_TSEG2;
+	CANx->BTR1_b.SAM = !Init->CAN_HighSpeed;
+	
+	CANx->OCR_b.MODE = CAN_OCR_CLOCK;
+	
+  if (!can_SetFilter(CANx, f1, f2)) {
+		return FALSE;
+	}
+	
+	/* switch to operation mode */
+	CANx->MODE_b.RM = FALSE;
+
+	return TRUE;
+}
+
+void CAN_SetSleepMode(CAN0_Type* CANx, BOOL enable) {
+	assert_param(IS_CAN_ALL_PERIPH(CANx));
+	
+	/* switch to operation mode */
+	CANx->MODE_b.RM = FALSE;
+	
+	CANx->MODE_b.SM = enable;
+}
+
+void CAN_EnableInt(CAN0_Type* CANx, uint32_t Int, BOOL enable) {
+  assert_param(IS_CAN_ALL_PERIPH(CANx));
+	assert_param(IS_CAN_INT(Int));
+	
+	if (enable) {
+		CANx->INT_EN |= CAN_INT_All;
+	} else {
+		CANx->INT_EN &= ~CAN_INT_All;
+	}
+}
+
+uint8_t CAN_GetIntStatus(CAN0_Type* CANx) {
+	assert_param(IS_CAN_ALL_PERIPH(CANx));
+	
+	return CANx->INT;
+}
+
+BOOL CAN_Transmit(CAN0_Type* CANx, CAN_Frame* frame) {
+	assert_param(IS_CAN_ALL_PERIPH(CANx));
+	
+	if (!frame) {
+		return FALSE;
+	}
+	
+	if (CANx->MODE_b.LOM) {
+		return FALSE;
+	}
+	
+	if (CANx->MODE_b.SM) {
+		CANx->MODE_b.RM = FALSE;
+		CANx->MODE_b.SM = FALSE;
+	}
+	
+	{
+		CAN_FRAME_INFO fi;
+		
+		fi.U.FI_b.FF = !frame->SFF;
+		fi.U.FI_b.RTR = frame->RTR;
+		fi.U.FI_b.DLC = frame->DLC;
+
+		CANx->FI_OR_ACR0 = fi.U.FI;
+  }
+	
+  if (frame->SFF) {
+		CAN_STANDARD_ID id;
+		
+		id.U.ID_b.ID28_21 = frame->Id >> 3;
+		id.U.ID_b.RTR = frame->RTR;
+		id.U.ID_b.ID20_18 = frame->Id & 0x07;
+		
+		CANx->DI0_OR_ACR1 = id.U.ID & 0xFF;
+		CANx->DI1_OR_ACR2 = id.U.ID >> 8;
+		
+		CANx->DI2_OR_ACR3 = frame->Data[0];
+		CANx->DI3_OR_AMR0 = frame->Data[1];
+		CANx->DI4_OR_AMR1 = frame->Data[2];
+		CANx->DI5_OR_AMR2 = frame->Data[3];
+		CANx->DI6_OR_AMR3 = frame->Data[4];
+		CANx->DI7 = frame->Data[5];
+		CANx->DI8 = frame->Data[6];
+		CANx->DI9 = frame->Data[7];
+	} else {
+		CAN_EXTENDED_ID id;
+		
+		id.U.ID_b.ID28_21 = frame->Id >> 21;
+		id.U.ID_b.ID20_13 = (frame->Id >> 13) & 0xFF;
+		id.U.ID_b.ID12_5 = (frame->Id >> 5) & 0xFF;
+		id.U.ID_b.RTR = frame->RTR;
+		id.U.ID_b.ID4_0 = frame->Id & 0x1F;
+		
+		CANx->DI0_OR_ACR1 = id.U.ID & 0xFF;
+		CANx->DI1_OR_ACR2 = (id.U.ID >> 8) & 0xFF;
+		CANx->DI2_OR_ACR3 = (id.U.ID >> 16) & 0xFF;
+		CANx->DI3_OR_AMR0 = (id.U.ID >> 24) & 0xFF;
+		
+		CANx->DI4_OR_AMR1 = frame->Data[0];
+		CANx->DI5_OR_AMR2 = frame->Data[1];
+		CANx->DI6_OR_AMR3 = frame->Data[2];
+		CANx->DI7 = frame->Data[3];
+		CANx->DI8 = frame->Data[4];
+		CANx->DI9 = frame->Data[5];
+		CANx->DI10 = frame->Data[6];
+		CANx->DI11 = frame->Data[7];
+	}
+
+  if (CANx->MODE_b.STM) {
+	  CANx->CMD_b.SSR = TRUE;
+	} else {
+		CANx->CMD_b.TR = TRUE;
+	}
+
+  return TRUE;
+}
+
+BOOL CAN_Receive(CAN0_Type* CANx, CAN_Frame* frame) {
+	assert_param(IS_CAN_ALL_PERIPH(CANx));
+	
+	if (!frame) {
+		return FALSE;
+	}
+	
+	if (CANx->MODE_b.SM) {
+		CANx->MODE_b.RM = FALSE;
+		CANx->MODE_b.SM = FALSE;
+	}
+	
+	{
+		CAN_FRAME_INFO fi;
+		
+		fi.U.FI = CANx->FI_OR_ACR0;
+		
+		frame->SFF = fi.U.FI_b.FF ? FALSE : TRUE;
+		frame->RTR = fi.U.FI_b.RTR ? TRUE : FALSE;
+		frame->DLC = fi.U.FI_b.DLC;
+  }
+	
+  if (frame->SFF) {
+		CAN_STANDARD_ID id;
+		
+		id.U.ID = CANx->DI0_OR_ACR1;
+		id.U.ID |= CANx->DI1_OR_ACR2 << 8;
+		
+		frame->Id = id.U.ID_b.ID28_21 << 3;
+		frame->Id |= id.U.ID_b.ID20_18;
+		
+		frame->Data[0] = CANx->DI2_OR_ACR3;
+		frame->Data[1] = CANx->DI3_OR_AMR0;
+		frame->Data[2] = CANx->DI4_OR_AMR1;
+		frame->Data[3] = CANx->DI5_OR_AMR2;
+		frame->Data[4] = CANx->DI6_OR_AMR3;
+		frame->Data[5] = CANx->DI7;
+		frame->Data[6] = CANx->DI8;
+		frame->Data[7] = CANx->DI9;
+	} else {
+		CAN_EXTENDED_ID id;
+		
+		id.U.ID = CANx->DI0_OR_ACR1;
+		id.U.ID |= CANx->DI1_OR_ACR2 << 8;
+		id.U.ID |= CANx->DI2_OR_ACR3 << 16;
+		id.U.ID |= CANx->DI3_OR_AMR0 << 24;
+		
+    frame->Id = id.U.ID_b.ID28_21 << 21;
+		frame->Id |= id.U.ID_b.ID20_13 << 13;
+		frame->Id |= id.U.ID_b.ID12_5 << 5;
+		frame->Id |= id.U.ID_b.ID4_0;
+		
+		frame->Data[0] = CANx->DI4_OR_AMR1;
+		frame->Data[1] = CANx->DI5_OR_AMR2;
+		frame->Data[2] = CANx->DI6_OR_AMR3;
+		frame->Data[3] = CANx->DI7;
+		frame->Data[4] = CANx->DI8;
+		frame->Data[5] = CANx->DI9;
+		frame->Data[6] = CANx->DI10;
+		frame->Data[7] = CANx->DI11;
+	}
+
+  CANx->CMD_b.RRB = TRUE;
+
+  return TRUE;	
+}
+

+ 523 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_ddr.c

@@ -0,0 +1,523 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_ddr.c
+	*
+	* @brief    CMEM7 DDR source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_ddr.h"
+
+#define MAX(a, b)	((a >= b) ? (a) : (b))
+#define CAL_DDR3_CL(cl)   ((cl>11)?(((cl-12)<<MR_CL_OFFSET)|0x4):((cl-4)<<MR_CL_OFFSET))
+
+#define CHIP_MIN_CAPACITY  32
+#define CHIP_CAPACITY_32MB  CHIP_MIN_CAPACITY
+#define CHIP_CAPACITY_64MB (CHIP_CAPACITY_32MB*2)
+#define CHIP_CAPACITY_128MB (CHIP_CAPACITY_64MB*2)
+#define CHIP_CAPACITY_256MB (CHIP_CAPACITY_128MB*2)
+#define CHIP_CAPACITY_512MB (CHIP_CAPACITY_256MB*2)
+#define CHIP_CAPACITY_1024MB (CHIP_CAPACITY_512MB*2)
+
+/** @defgroup DDR time
+  * @{
+  */
+  #define POWER_UP_NOP		200*1000        /*ns*//*JEDEC Standard No. 79-2E   page 17   */
+  #define PRE_ALL_NOP			400        /*ns*/
+  #define POWER_UP_MIN_CK    200
+  #define DDR2_TMRD                2            /*JEDEC Standard No. 79-2E   page 80   */
+  #define DDR3_TMRD                4            /*JEDEC Standard No. 79-2E   page 80   */
+  #define DDR3_TMOD_CK                12            /*JEDEC Standard No. 79-3E   page 171  table 68   */
+  #define DDR3_TMOD                15          /*ns*/  /*JEDEC Standard No. 79-3E   page 171  table 68   */
+  #define DDR3_TZQINIT_CK                512         /*JEDEC Standard No. 79-3E   page 171  table 68   */
+  #define DDR3_TZQINIT                640   /*ns*/      /*JEDEC Standard No. 79-3E   page 171  table 68   */
+  #define DDR3_TDLLK_CK                512         /*JEDEC Standard No. 79-3E   page 171  table 68   */
+  #define RSTH_NOP		500*1000        /*ns*//*JEDEC Standard No. 79-3E   page 20   */
+  #define DDR_TREF      7800 /*ns*/
+  /**
+  * @}
+  */
+#ifndef NULL
+#define	NULL	0
+#endif
+
+/** @defgroup DDRC_SW_PROC_CMD
+  * @{
+  */
+#define SW_CMD_NO_PARM        0
+#define SW_CMD_DES			0x0       /*des 5'b00000     [31:29]=3'b000           [28:0] DES time cke hold*/	
+#define SW_CMD_NOP			0x20000000        /*nop 5'b00100     [31:29]=3'b001           [28:0] NOP time cke hold*/		
+#define SW_CMD_DESCKE         0x40000000	   /*descke 5'b01000     [31:29]=3'b010           [28:0] DES time change cke high*/			
+#define SW_CMD_NOPCKE         0x60000000	 /*nopcke 5'b01100     [31:29]=3'b011           [28:0] NOP time change cke high*/	
+#define SW_CMD_PREA         	0x80000000	 /*nopcke 5'b10000     [31:27]=5'b10000           */	
+
+#define SW_CMD_MR         	0x88000000		/*JEDEC Standard No. 79-2E   page 19   */
+#define SW_CMD_EMR1         	0x88010000	/*JEDEC Standard No. 79-2E   page 19   */
+#define SW_CMD_EMR2         	0x88020000
+#define SW_CMD_EMR3         	0x88030000
+#define SW_CMD_EMR1_TEST  0x88010004	
+#define SW_CMD_REF         	0x90000000  /*REF 5'b10010     [31:27]=5'b10010       */	
+
+#define SW_CMD_RSTH        	0xb0000000  /*RSTH 5'b10110    [31:27]=5'b10110       */	
+#define SW_CMD_ZQCL       	0xb8000000  /*ZQCL 5'b10111    [31:27]=5'b10111       */	
+
+#define SW_CMD_DLL_EN         0x880103C4
+#define SW_CMD_DLL_RST        0x88000953
+/**
+  * @}
+  */
+/** @defgroup DDR2  mode register 
+  * @{
+  */
+ /*JEDEC Standard    */
+#define MR_BURST_LEN_4          0x2
+#define MR_BURST_LEN_8          0x3
+#define MR_BT_SEQ                    0x0
+#define MR_BT_INT                    0x08
+#define MR_CL_OFFSET             4 
+#define MR_TM_NORMAL            0
+#define MR_TM_TEST                 0x80
+#define MR_DLL_NO                   0
+#define MR_DLL_YES                 0x100
+#define MR_WR_OFFSET           9
+#define MR_PPD_FAST              0x1000
+#define MR2_CWL_OFFSET        3
+#define MR1_RZQ_4                 0x4
+/**
+  * @}
+  */
+const uint8_t DDR2_MODE[BUS_WIDTH_MAX][CHIP_NUM_MAX][CHIP_TYPE_MAX]=
+{
+	{
+		{0x20,0x23,0x28,0x2a,0x30,0x21,0x22,0x29,0x2b,0x31,0xff},/*chip x1*/
+		{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}/*chip x2*/
+	},/*bus width x8*/
+
+	{
+		{0xff,0xff,0xff,0xff,0xff,0x25,0x26,0x2d,0x2f,0x33,0xff},/*chip x1*/
+		{0x24,0x27,0x2c,0x2e,0x32,0xff,0xff,0xff,0xff,0xff,0xff}/*chip x2*/
+	}/*bus width x16*/
+};
+const uint8_t DDR3_MODE[BUS_WIDTH_MAX][CHIP_NUM_MAX][CHIP_TYPE_MAX]=
+{
+	{
+		{0xff,0x00,0x01,0x02,0x03,0xff,0x04,0x05,0x06,0x07,0x10},/*chip x1*/
+		{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}/*chip x2*/
+	},/*bus width x8*/
+
+	{
+		{0xff,0xff,0xff,0xff,0xff,0xff,0x0c,0x0d,0x0e,0x0f,0x11},/*chip x1*/
+		{0xff,0x08,0x09,0x0a,0x0b,0xff,0xff,0xff,0xff,0xff,0xff}/*chip x2*/
+	}/*bus width x16*/
+};
+const DDR2MEM DDR2PREDEF[] = {
+	{
+// #define DDR2_400C			4	// sg5E //DDR2-400C CL=4, tCK=5000 ps (dev-brd using)
+		/*tCK*/ 5000,
+		/*tCL*/ 6,//4,
+		/*RCD*/4, /*RP*/4, /*RC*/13, /*RAS*/9, /*WR*/3, /*RRD*/2, /*WTR*/11, /*RTP*/4,
+		/*FAW*/10,
+	},
+	 
+	{
+// #define DDR2_800D			0	// sg25E //DDR2-800D CL=5, tCK=2500 ps
+		/*tCK*/ 2500,
+		/*tCL*/ 5, /*RCD*/5, /*RP*/5, /*RC*/24, //from sim model
+		/*RAS*/18, /*WR*/6, /*RRD*/4, /*WTR*/11, /*RTP*/5,
+		/*FAW*/30, //from sim model
+	}, {
+// #define DDR2_667C			1	// sg3E //DDR2-667C CL=4, tCK=3000 ps
+		/*tCK*/ 3000,
+		/*tCL*/ 4, /*RCD*/4, /*RP*/4, /*RC*/19, /*RAS*/15, /*WR*/5, /*RRD*/4, /*WTR*/10, /*RTP*/5,
+		/*FAW*/17,
+	}, {
+// #define DDR2_667D			2	// sg3 //DDR2-667D CL=5, tCK=3000 ps
+		/*tCK*/ 3000,
+		/*tCL*/ 5, /*RCD*/5, /*RP*/5, /*RC*/20, /*RAS*/15, /*WR*/5, /*RRD*/4, /*WTR*/3, /*RTP*/3,
+		/*FAW*/17,
+	}, {
+// #define DDR2_533C			3	// sg37E //DDR2-533C CL=4, tCK=3750 ps
+		/*tCK*/ 3750,
+		/*tCL*/ 4, /*RCD*/4, /*RP*/4, /*RC*/16, /*RAS*/12, /*WR*/4, /*RRD*/3, /*WTR*/9, /*RTP*/4,
+		/*FAW*/14,
+	},
+};
+
+const DDR3MEM DDR3PREDEF[] = {
+	{
+// #define DDR3_400			14	//  Base on DDR3-800D (5-5-5) tCK=5ns
+		/*tCK*/ 2500,
+		/*tCL*//*9*/ 5, /*WCL*/7/*cwl should be 5 ,but phy has 2 cycles delay.So,wcl should plus the 2 cycles delay.*/ , /*RCD*//*9*/5, /*RAS*//*24*/8, /*RP*//*9*/5, /*RC*//*33*/10, /*RRD*/ 100,
+		/*FAW*//*30*/10, /*WR*/5/*10*/, /*RTP*/4, /*ZQCL*/256, /*ZQCS*/64,
+	}  ,
+
+	{
+// #define DDR3_667			15	//  Base on DDR3-800D (5-5-5) tCK=5ns
+		/*tCK*/ 3000,
+		/*tCL*//*9*/ 5, /*WCL*/7 /*cwl should be 5 ,but phy has 2 cycles delay.So,wcl should plus the 2 cycles delay.*/ , /*RCD*//*9*/5, /*RAS*//*24*/30, /*RP*//*9*/5, /*RC*//*33*/60, /*RRD*/16,
+		/*FAW*//*30*/17, /*WR*/5/*10*/, /*RTP*/4, /*ZQCL*/256, /*ZQCS*/64,
+	},
+
+	{
+// #define DDR3_2133N			0	// sg093 //DDR3-2133N (14-14-14) tCK=0.938ns
+		/*tCK*/ 938,
+		/*tCL*/ 14, /*WCL*/10, /*RCD*/14, /*RAS*/36, /*RP*/14, /*RC*/50, /*RRD*/7,
+		/*FAW*/38, /*WR*/16, /*RTP*/10, /*ZQCL*/342, /*ZQCS*/86,
+	}, {
+// #define DDR3_2133M			1	// sg093E //DDR3-2133M (13-13-13) tCK=0.938ns
+		/*tCK*/ 938,
+		/*tCL*/ 13, /*WCL*/10, /*RCD*/13, /*RAS*/36, /*RP*/13, /*RC*/49, /*RRD*/7,
+		/*FAW*/38, /*WR*/16, /*RTP*/10, /*ZQCL*/342, /*ZQCS*/86,
+	}, {
+// #define DDR3_2133L			2	// sg093F //DDR3-2133L (12-12-12) tCK=0.938ns
+		/*tCK*/ 938,
+		/*tCL*/ 12, /*WCL*/10, /*RCD*/12, /*RAS*/36, /*RP*/12, /*RC*/48, /*RRD*/7,
+		/*FAW*/38, /*WR*/16, /*RTP*/10, /*ZQCL*/342, /*ZQCS*/86,
+	}, {
+// #define DDR3_1866L			3	// sg107E //DDR3-1866L (12-12-12) tCK=1.07ns
+		/*tCK*/ 1070,
+		/*tCL*/ 12, /*WCL*/9, /*RCD*/12, /*RAS*/32, /*RP*/12, /*RC*/44, /*RRD*/6,
+		/*FAW*/33, /*WR*/14, /*RTP*/9, /*ZQCL*/300, /*ZQCS*/75,
+	}, {
+// #define DDR3_1866K			4	// sg107F //DDR3-1866K (11-11-11) tCK=1.07ns
+		/*tCK*/ 1070,
+		/*tCL*/ 11, /*WCL*/9, /*RCD*/11, /*RAS*/32, /*RP*/11, /*RC*/43, /*RRD*/6,
+		/*FAW*/33, /*WR*/14, /*RTP*/9, /*ZQCL*/300, /*ZQCS*/75,
+	}, {
+// #define DDR3_1600J			5	// sg125E //DDR3-1600J (10-10-10) tCK=1.25ns
+		/*tCK*/ 1250,
+		/*tCL*/ 10, /*WCL*/8, /*RCD*/10, /*RAS*/28, /*RP*/10, /*RC*/38, /*RRD*/6,
+		/*FAW*/32, /*WR*/12, /*RTP*/8, /*ZQCL*/256, /*ZQCS*/64,
+	}, {
+// #define DDR3_1600K			6	// sg125 //DDR3-1600K (11-11-11) tCK=1.25ns
+		/*tCK*/ 1250,
+		/*tCL*/ 11, /*WCL*/8, /*RCD*/11, /*RAS*/28, /*RP*/11, /*RC*/37, /*RRD*/6,
+		/*FAW*/32, /*WR*/12, /*RTP*/8, /*ZQCL*/256, /*ZQCS*/64,
+	}, {
+// #define DDR3_1333H			7	// sg15E //DDR3-1333H (9-9-9) tCK=1.5ns
+		/*tCK*/ 1500,
+		/*tCL*/ 9, /*WCL*/7, /*RCD*/9, /*RAS*/24, /*RP*/9, /*RC*/33, /*RRD*/5,
+		/*FAW*/30, /*WR*/10, /*RTP*/5, /*ZQCL*/256, /*ZQCS*/64,
+	}, {
+// #define DDR3_1333J			8	// sg15 //DDR3-1333J (10-10-10) tCK=1.5ns
+		/*tCK*/ 1500,
+		/*tCL*/ 10, /*WCL*/7, /*RCD*/10, /*RAS*/24, /*RP*/10, /*RC*/34, /*RRD*/5,
+		/*FAW*/30, /*WR*/10, /*RTP*/7, /*ZQCL*/256, /*ZQCS*/64,
+	}, {
+// #define DDR3_1066F			9	// sg187E //DDR3-1066F (7-7-7) tCK=1.875ns
+		/*tCK*/ 1875,
+		/*tCL*/ 7, /*WCL*/6, /*RCD*/7, /*RAS*/20, /*RP*/7, /*RC*/27, /*RRD*/6,
+		/*FAW*/27, /*WR*/8, /*RTP*/6, /*ZQCL*/256, /*ZQCS*/64,
+	}, {
+// #define DDR3_1066G			10	// sg187 //DDR3-1066G (8-8-8) tCK=1.875ns
+		/*tCK*/ 1875,
+		/*tCL*/ 8, /*WCL*/6, /*RCD*/8, /*RAS*/20, /*RP*/8, /*RC*/28, /*RRD*/6,
+		/*FAW*/27, /*WR*/8, /*RTP*/6, /*ZQCL*/256, /*ZQCS*/64,
+	}, {
+// #define DDR3_800D			11	// sg25E //DDR3-800D (5-5-5) tCK=2.5ns
+		/*tCK*/ 2500,
+		/*tCL*/ 5, /*WCL*/5, /*RCD*/5, /*RAS*/15, /*RP*/5, /*RC*/20, /*RRD*/4,
+		/*FAW*/17, /*WR*/5, /*RTP*/3, /*ZQCL*/256, /*ZQCS*/64,
+	}, {
+// #define DDR3_800E			12	// sg25 //DDR3-800E (6-6-6) tCK=2.5ns
+		/*tCK*/ 2500,
+		/*tCL*/ 6, /*WCL*/5, /*RCD*/6, /*RAS*/15, /*RP*/6, /*RC*/21, /*RRD*/4,
+		/*FAW*/20, /*WR*/6, /*RTP*/6, /*ZQCL*/256, /*ZQCS*/64,
+	},
+	{
+	// #define DDR3_266MPW			13	// sg25 //DDR3-800E (5-5-5) tCK=2.5ns
+//		/*tCL*/ 5, /*WCL*/7, /*RCD*/5, /*RAS*/9/*37.5/4*/, /*RP*/5, /*RC*/13, /*RRD*/4,
+//		/*FAW 50/4*/15, /*WR6*/5, /*RTP*/4, /*ZQCL*/256, /*ZQCS*/64,
+// #define DDR3_250MPW			13	// sg25 //DDR3-800E (5-5-5) tCK=2.5ns
+		/*tCK*/ 2500,
+		/*tCL*/ 5, /*WCL*/7, /*RCD*/5, /*RAS*/9/*37.5/4*/, /*RP*/5, /*RC*/13, /*RRD*/4,
+		/*FAW 50/4*/15, /*WR6*/5, /*RTP*/4, /*ZQCL*/256, /*ZQCS*/64,
+
+	},
+};
+uint32_t Get_DDR_Capacity(const MEM_CHIP_INFO *chip_info)
+{
+	uint32_t n=0;
+	uint32_t capacity=0;
+
+	assert_param(chip_info);
+	n=(chip_info->Chip_type<_16Mbx16)?(chip_info->Chip_type):(chip_info->Chip_type-_16Mbx16);
+	capacity=(chip_info->Chip_type<_16Mbx16)?(CHIP_MIN_CAPACITY*(1<<n)*(chip_info->Chip_num+1)):(CHIP_MIN_CAPACITY*(1<<n)*(chip_info->Bus_width+1)/(BUS_WIDTH_16+1));
+	return capacity;
+	
+	
+}
+uint32_t Calc_DDR_RFC(const MEM_CHIP_INFO *chip_info)
+{
+	uint32_t capacity=0;
+	uint32_t tRFC=0;
+	assert_param(chip_info);
+
+	
+	capacity=Get_DDR_Capacity(chip_info);
+	if (chip_info->mem_type==MEM_DDR2) {
+	
+		switch(capacity){
+			case CHIP_CAPACITY_32MB:tRFC=75;break;
+			case CHIP_CAPACITY_64MB:tRFC=105;break;
+			case CHIP_CAPACITY_128MB:tRFC=128;break;
+			case CHIP_CAPACITY_256MB:tRFC=195;break;
+			case CHIP_CAPACITY_512MB:tRFC=328;break;
+		}
+	}
+	else{
+		switch(capacity){
+			case CHIP_CAPACITY_64MB:tRFC=90;break;
+			case CHIP_CAPACITY_128MB:tRFC=110;break;
+			case CHIP_CAPACITY_256MB:tRFC=160;break;
+			case CHIP_CAPACITY_512MB:tRFC=300;break;
+			case CHIP_CAPACITY_1024MB:tRFC=350;break;
+		}
+	}
+
+	return tRFC;
+	
+	
+}
+static void DDR_Cmd(const uint32_t cmd ,const uint32_t param)
+{
+		DDRC->CMD =((cmd)|(param));
+	
+}
+static void DDR_Latency(const uint32_t cycle  )
+{
+	DDR_Cmd(SW_CMD_NOP,cycle);
+}
+static void DDR2_conf(const MEM_CHIP_INFO *chip_info ,const void *ddr)
+{
+	uint32_t period=0;
+	const DDR2MEM *ptr = (const DDR2MEM *)ddr;
+	uint32_t tRFC=0;
+	
+	assert_param(ddr);
+	tRFC=Calc_DDR_RFC(chip_info);
+	period = (1000 / (SYSTEM_CLOCK_FREQ / 1000000));	
+	CFG_CTRL->DONE_b.CMD = 0x1;
+
+	DDRC->MODE_b.LANE = 1;
+	DDRC->MODE_b.B16 = 1;
+	DDRC->REF_b.TIME =( DDR_TREF/period);
+	DDRC->RP_b.RPA = 1;
+	DDRC->RFC_b.DI = (tRFC/period);
+	DDRC->PHUNG_b.MODE = 1;
+	DDRC->RD_SEL_b.PHY_SEL = 5;
+
+	DDRC->DQSEN0_b.DL = 2;
+	DDRC->DQSEN1_b.DL = 2;
+	DDRC->DQSEN2_b.DL = 2;
+	DDRC->DQSEN3_b.DL = 2;
+	DDRC->INTCTL_b.DONE = 1;
+	DDRC->INTCTL_b.ERR = 0;
+	DDRC->RDQ_b.L3 = DDRC->RDQ_b.L2 = DDRC->RDQ_b.L1 = DDRC->RDQ_b.L0 = 0x32;
+	DDRC->ITMDLY_b.I0 = DDRC->ITMDLY_b.IS0 = DDRC->ITMDLY_b.I1 = DDRC->ITMDLY_b.IS1 = 
+		DDRC->ITMDLY_b.I2 = DDRC->ITMDLY_b.IS2 = DDRC->ITMDLY_b.I3 = DDRC->ITMDLY_b.IS3 = 3;
+
+	
+	DDR_Latency((POWER_UP_NOP/period));
+	DDR_Cmd(SW_CMD_NOPCKE,(PRE_ALL_NOP/period));
+	DDR_Cmd(SW_CMD_PREA,NULL);
+	DDR_Latency(ptr->tRP);/*tRP*/
+	DDR_Cmd(SW_CMD_EMR2,NULL);
+	DDR_Latency(DDR2_TMRD);
+	DDR_Cmd(SW_CMD_EMR3,NULL);
+	DDR_Latency(DDR2_TMRD);
+	DDR_Cmd(SW_CMD_DLL_EN,NULL);
+	DDR_Latency(DDR2_TMRD);
+	DDR_Cmd(SW_CMD_DLL_RST,NULL);
+	DDR_Latency(DDR2_TMRD);
+	DDR_Cmd(SW_CMD_PREA,NULL);
+	DDR_Latency(ptr->tRP);
+	DDR_Cmd(SW_CMD_REF,NULL);
+	DDR_Latency((tRFC/period));/*tRFC*/
+	DDR_Cmd(SW_CMD_REF,NULL);
+	DDR_Latency((tRFC/period));
+	DDR_Cmd(SW_CMD_MR,(((ptr->tWR-1)<<MR_WR_OFFSET)|(ptr->tCL<<MR_CL_OFFSET)|MR_BURST_LEN_8));
+	DDR_Latency(POWER_UP_MIN_CK);
+	DDR_Cmd(SW_CMD_EMR1_TEST,NULL);
+	DDR_Latency(DDR2_TMRD);
+}
+
+static void DDR3_conf(const MEM_CHIP_INFO *chip_info ,const void *ddr)
+{
+
+	uint32_t period = 0;
+	uint32_t tRFC = 0;
+	const DDR3MEM *ptr = (const DDR3MEM *)ddr;
+
+	tRFC = Calc_DDR_RFC(chip_info);
+	period = (1000 / (SYSTEM_CLOCK_FREQ / 1000000));	
+	
+	DDRC->MODE_b.LANE = 0x1;
+	DDRC->QUE_b.DEPTH=1;
+	DDRC->REF_b.TIME = (DDR_TREF / period);////// //2Gb periodic refresh interval 7.8us 7.8us/5ns
+	DDRC->REF_b.TRIG = 1;
+	DDRC->REF_b.THRD = 8; 
+	DDRC->ZQCSR_b.EN = 1;
+	DDRC->ZQCSI = 128 * 1000000 / period;
+	DDRC->RP_b.RPA = 1;
+	DDRC->RFC_b.DI = (tRFC / period);
+	
+	if (ptr->tCK == 2500) { // 200MHz 
+		DDRC->RD_SEL_b.PHY_SEL = 5;
+	} else if (ptr->tCK == 3000) { // 333MHz 
+		DDRC->RD_SEL_b.PHY_SEL = 6;
+	}
+	
+	DDRC->PHUNG_b.MODE = 1;	
+	DDRC->DQSEN0_b.DL = 2;
+	DDRC->DQSEN1_b.DL = 2;
+	DDRC->DQSEN2_b.DL = 2;
+	DDRC->DQSEN3_b.DL = 2;
+
+	// config MR#
+	DDR_Latency((POWER_UP_NOP/period));//200us nop
+	DDR_Cmd(SW_CMD_RSTH,NULL);// RESET H
+	DDR_Latency((RSTH_NOP/period));// 500us nop  
+	DDR_Cmd(SW_CMD_NOPCKE,((tRFC+10)/period));//	 cke high 170/tck tck txpr max(5nck, trfc(min) + 10ns)	 2Gb refresh time 160ns
+	DDR_Cmd(SW_CMD_EMR2,((ptr->tWCL-5)<<MR2_CWL_OFFSET)); //MR2
+	DDR_Latency(DDR3_TMRD);// tmrd  4nck
+	DDR_Cmd(SW_CMD_EMR3,NULL);// MR3
+	DDR_Latency(DDR3_TMRD); // tmrd
+	DDR_Cmd(SW_CMD_EMR1,MR1_RZQ_4); // MR1	
+	DDR_Latency(DDR3_TMRD); // tmrd
+	DDR_Cmd(SW_CMD_MR,(MR_PPD_FAST|MR_DLL_YES|((ptr->tWR-1)<<MR_WR_OFFSET)|(CAL_DDR3_CL(ptr->tCL))));
+														// MR0
+														// A1 , A0 2'b0 fixed 8 
+														// A2 CL 0 
+														// A3 nibble sequential 0  Interleave 1
+														// A6,A5,A4 CL 101 CL =9 
+														// A7 normal mode 0
+														// A8 DLL reset 1
+														// A11,A10,A9 wr=(twr/ck)=(15/3)=5	=001
+														// A12 DLL control for precharge PD fast exit 1
+														// MR0 =0xb50
+	DDR_Latency(MAX(DDR3_TMOD_CK,(DDR3_TMOD/period)));// tmod max (12nck,15ns) 
+	DDR_Cmd(SW_CMD_ZQCL,NULL);// ZQCL starting ZQ calibration
+	DDR_Latency(MAX(DDR3_TZQINIT_CK,(DDR3_TZQINIT/period))); // tdllk 512nck (should be 500nck)
+	DDR_Latency(DDR3_TDLLK_CK); // tZQinit max(512nck,640ns) 
+
+}
+
+BOOL DDR_Init(const MEM_CHIP_INFO *chip_info, const void *ddr)
+{
+	uint32_t tCL, tWR, tWCL, tWTR, tCK,mode;
+	
+	assert_param(chip_info);
+	assert_param(ddr);
+	if((chip_info->Bus_width<BUS_WIDTH_MAX)
+		&&(chip_info->Chip_num<CHIP_NUM_MAX)
+		&&(chip_info->Chip_type<	CHIP_TYPE_MAX))
+	{
+		if(chip_info->mem_type==MEM_DDR2)
+		{
+			mode=DDR2_MODE[chip_info->Bus_width][chip_info->Chip_num][chip_info->Chip_type];
+		}
+		else
+		{
+			mode=DDR3_MODE[chip_info->Bus_width][chip_info->Chip_num][chip_info->Chip_type];
+		}
+		if(mode==0xff)
+		{
+			return FALSE;
+		}
+		
+	
+	}
+	else
+	{
+		return FALSE;
+	}
+		
+	
+	PDPROT->LOCK_b.EN = 0;
+	do {
+		CFG_CTRL->PDLLSTR_b.C2R1D = 0; // rst dll_c2r1
+		udelay(10);
+		CFG_CTRL->PDLLSTR_b.C2R1D = 1; // releset rst
+		udelay(10);
+	} while ((PDLOCK->GCLK & 0x40) != 0x40);
+	PDPROT->LOCK_b.EN = 1;
+
+	DDRC->MODE_b.MODE = mode;
+
+	if (chip_info->mem_type==MEM_DDR2) {
+		const DDR2MEM *ptr = (const DDR2MEM *)ddr;
+		DDRC->RL_b.VAL = ptr->tCL;
+		DDRC->RCD_b.DI = ptr->tRCD;
+		DDRC->RP_b.DI = ptr->tRP;
+		DDRC->RC_b.DI = ptr->tRC;
+		DDRC->RAS_b.DI = ptr->tRAS;
+		tWR = ptr->tWR;
+		tWTR = ptr->tWTR;
+		DDRC->RRD_b.DI = ptr->tRRD;
+		DDRC->RTP_b.DI = ptr->tRTP;
+		DDRC->FAW_b.DI = ptr->tFAW;
+		DDR2_conf(chip_info,ptr);
+	} else {
+		const DDR3MEM *ptr = (const DDR3MEM *)ddr;
+		DDRC->RL_b.VAL = ptr->tCL;
+		tWCL = ptr->tWCL;
+		DDRC->RCD_b.DI = ptr->tRCD;
+		DDRC->RAS_b.DI = ptr->tRAS;
+		DDRC->RP_b.DI = ptr->tRP;
+		DDRC->RC_b.DI = ptr->tRC;
+		DDRC->RRD_b.DI = ptr->tRRD;
+		DDRC->FAW_b.DI = ptr->tFAW;
+		tWR = ptr->tWR;
+		tCK = ptr->tCK;
+		DDRC->RTP_b.DI = ptr->tRTP;
+		DDRC->ZQCL_b.DI = ptr->tZQoper;
+		DDRC->ZQCS_b.DI = ptr->tZQCS;
+		DDR3_conf(chip_info,ptr);
+	}
+
+	tCL = DDRC->RL_b.VAL;
+
+	DDRC->WTR_b.DI  = (DDRC->MODE_b.MODE & 0x20) ? 
+		(tWCL + tWTR + (DDRC->BURST_b.LEN ? 2 : 4)) : 
+		((tCK * 4) > 7500) ? 18 : (tCK * 4 + 7500 - 1) / 7500;				 //4
+
+	DDRC->CCD_b.DI  = (DDRC->MODE_b.MODE & 0x20) ? (DDRC->BURST_b.LEN ? 2 : 4) : 4;
+	DDRC->RTW_b.DI  = (DDRC->MODE_b.MODE & 0x20) ? (DDRC->BURST_b.LEN ? 4 : 6) : (tCL + DDRC->CCD_b.DI - tWCL + (DDRC->BURST_b.LEN ? 0 : 2));
+	DDRC->WTP_b.DI  = (DDRC->MODE_b.MODE & 0x20) ? (tCL + tWR + (DDRC->BURST_b.LEN ? 1 : 3)) : (tWCL + tWR + (DDRC->BURST_b.LEN ? 2 : 4));
+	DDRC->WL_b.VAL  = (DDRC->MODE_b.MODE & 0x20) ? (MAX(tCL, 3) - 3) : (tWCL - 2);
+	DDRC->ODTH_b.DL = (DDRC->MODE_b.MODE & 0x20) ? (MAX(tCL, 4) - 4) : 0;
+	if (tCK == 2500) { // 200MHz 
+		DDRC->ODTL_b.DL = (DDRC->MODE_b.MODE & 0x20) ? (DDRC->BURST_b.LEN ? (tCL - 1) : (tCL + 1)) : (DDRC->BURST_b.LEN ? 4 : 6);
+	} else if (tCK == 3000) { // 333MHz 
+		DDRC->ODTL_b.DL = 0x1f;
+	}
+
+	
+	// DEBUG INFO HERE
+	DDRC->CTRL_b.STR = 1;
+
+	while (0 == DDRC->STA_b.EMPTY);
+	while(0 == DDRC->INTRAW_b.DONE);
+	DDRC->CTRL_b.STR = DDRC->CTRL_b.TO = 0;
+
+	return TRUE;
+}

+ 262 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_dma.c

@@ -0,0 +1,262 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_dma.c
+	*
+	* @brief    CMEM7 DMA source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_dma.h"
+
+typedef struct {
+	union {
+    uint32_t  CTL_LOW;                              
+    
+    struct {
+      uint32_t  INT_EN     :  1;               
+      uint32_t  DST_TR_WIDTH:  3;              
+      uint32_t  SRC_TR_WIDTH:  3;              
+      uint32_t  DINC       :  2;              
+      uint32_t  SINC       :  2;               
+      uint32_t  DEST_MSIZE :  3;              
+      uint32_t  SRC_MSIZE  :  3;              
+      uint32_t  SRC_GATHER_EN:  1;           
+      uint32_t  DST_SCATTER_EN:  1;          
+      uint32_t             :  1;
+      uint32_t  TT_FC      :  3;           
+      uint32_t  DMS        :  2;              
+      uint32_t  SMS        :  2;            
+      uint32_t  LLP_DST_EN :  1;              
+      uint32_t  LLP_SRC_EN :  1;              
+    } CTL_LOW_b;                                
+  } INNER;
+} INNER_CTL_LOW;
+
+typedef struct {
+  union {
+    uint32_t  CTL_HI;     
+    
+    struct {
+      uint32_t  BLOCK_TS   : 12;    
+      uint32_t  DONE       :  1;                   
+    } CTL_HI_b;                                      
+  } INNER;
+} INNER_CTL_HIGH;
+
+typedef struct {                      
+	uint32_t srcAddr;                  
+	uint32_t dstAddr;                  
+	uint32_t nextBlock;              
+	INNER_CTL_LOW low;                 
+	INNER_CTL_HIGH high;                 
+} INNER_BLOCK_DESC;
+
+
+#define DMA_MAX_CHANNEL_NUM                  8
+
+#define DMA_TR_WIDTH_8_BIT                   0
+#define DMA_TR_WIDTH_16_BIT                  1
+#define DMA_TR_WIDTH_32_BIT                  2
+#define DMA_TR_WIDTH_64_BIT                  3
+#define DMA_TR_WIDTH_128_BIT                 4
+#define DMA_TR_WIDTH_256_BIT                 5
+
+#define DMA_INC_INCREMENT                    0
+#define DMA_INC_DECREMENT                    1
+#define DMA_INC_NO_CHANGE                    2
+
+#define DMA_LOCK_DMA_TRANSFER                0
+#define DMA_LOCK_DMA_BLOCK_TRANSFER          1
+#define DMA_LOCK_DMA_BLOCK_TRANSACTION       2
+
+            
+void DMA_Init() {
+	DMA->DMA_EN_b.EN = TRUE;
+	
+	// only open channel 0
+	DMA->CH_EN = (0xFF << DMA_MAX_CHANNEL_NUM) | 0x0;
+	
+	DMA_ClearInt(DMA_Int_All);
+ 	DMA_EnableInt(DMA_Int_All, FALSE);
+	
+	DMA->SAR0 = 0x0;
+	DMA->DAR0 = 0x0;
+	
+	DMA->CTL_HI0_b.BLOCK_TS 			= 0;
+	DMA->CTL_LOW0_b.INT_EN 				= FALSE;
+	DMA->CTL_LOW0_b.DST_TR_WIDTH 	= DMA_TR_WIDTH_32_BIT;
+	DMA->CTL_LOW0_b.SRC_TR_WIDTH 	= DMA_TR_WIDTH_32_BIT;
+	DMA->CTL_LOW0_b.DINC 					= DMA_INC_INCREMENT;
+	DMA->CTL_LOW0_b.SINC 					= DMA_INC_INCREMENT;
+	DMA->CTL_LOW0_b.DEST_MSIZE 		= 0;
+	DMA->CTL_LOW0_b.SRC_MSIZE 		= 0;
+	DMA->CTL_LOW0_b.SRC_GATHER_EN = FALSE;
+	DMA->CTL_LOW0_b.DST_SCATTER_EN = FALSE;
+	DMA->CTL_LOW0_b.TT_FC 				= 0;
+  DMA->CTL_LOW0_b.DMS    				= 0;
+	DMA->CTL_LOW0_b.SMS    				= 0;
+	DMA->CTL_LOW0_b.LLP_DST_EN   	= FALSE;
+	DMA->CTL_LOW0_b.LLP_SRC_EN   	= FALSE;
+	
+  DMA->LLP0_b.LOC = 0; 
+	DMA->LLP0_b.LMS = 0;
+
+  DMA->SGR0_b.SGC = 0x1;
+	DMA->SGR0_b.SGI = 0x0;
+	
+	DMA->DSR0_b.DSC = 0x0;
+	DMA->DSR0_b.DSI = 0x0;
+
+  DMA->SSTATAR0 = 0x0;
+	DMA->DSTATAR0 = 0x0;
+	
+	DMA->CFG_HI0 								= 0x0;
+	DMA->CFG_LOW0_b.CH_PRIOR 		= 0;
+	DMA->CFG_LOW0_b.CH_SUSP 		= 0;
+	DMA->CFG_LOW0_b.HS_SEL_DST 	= 0;
+	DMA->CFG_LOW0_b.LOCK_B_L 		= 0;
+  DMA->CFG_LOW0_b.HS_SEL_SRC 	= 0;
+	DMA->CFG_LOW0_b.LOCK_CH_L 	= DMA_LOCK_DMA_TRANSFER;
+  DMA->CFG_LOW0_b.LOCK_B_L 		= DMA_LOCK_DMA_TRANSFER;
+	DMA->CFG_LOW0_b.LOCK_CH 		= TRUE;
+	DMA->CFG_LOW0_b.LOCK_B 			= TRUE;
+	DMA->CFG_LOW0_b.DST_HS_POL 	= 0;
+	DMA->CFG_LOW0_b.SRC_HS_POL 	= 0;
+	DMA->CFG_LOW0_b.RELOAD_SRC 	= FALSE;
+	DMA->CFG_LOW0_b.RELOAD_DST 	= FALSE;
+}
+
+void DMA_EnableInt(uint32_t Int, BOOL enable) {
+	assert_param(IS_DMA_INT(Int));
+	
+  if (enable) {
+		if (Int & DMA_Int_TfrComplete) {
+			DMA->INT_EN_TFR = (0x1 << DMA_MAX_CHANNEL_NUM) | 0x1;
+		} 
+		
+		if (Int & DMA_Int_Err) {
+			DMA->INT_EN_ERR = (0x1 << DMA_MAX_CHANNEL_NUM) | 0x1;
+		}
+	} else {
+		if (Int & DMA_Int_TfrComplete) {
+			DMA->INT_EN_TFR = (0x1 << DMA_MAX_CHANNEL_NUM) | 0x0;
+		} 
+		
+		if (Int & DMA_Int_Err) {
+			DMA->INT_EN_ERR = (0x1 << DMA_MAX_CHANNEL_NUM) | 0x0;
+		}
+	}
+}
+
+BOOL DMA_GetIntStatus(uint32_t Int) {
+	assert_param(IS_DMA_INT(Int));
+	
+	if (Int & DMA_Int_TfrComplete) {
+		if (DMA->INT_TFR) {
+			return TRUE;
+		}
+	}
+	
+	if (Int & DMA_Int_Err) {
+		if (DMA->INT_ERR) {
+			return TRUE;
+		}
+	}
+		
+	return FALSE;
+}
+
+void DMA_ClearInt(uint32_t Int) {
+	assert_param(IS_DMA_INT(Int));
+	
+	if (Int & DMA_Int_TfrComplete) {
+		DMA->INT_CLEAR_TFR = 0x1;
+	}
+	
+	if (Int & DMA_Int_Err) {
+		DMA->INT_CLEAR_ERR = 0x1;
+	}
+}
+
+BOOL DMA_IsBusy() {
+	return (DMA->CH_EN_b.EN) ? TRUE : FALSE;
+}
+
+BOOL DMA_Transfer(BLOCK_DESC *blockList) {
+	BLOCK_DESC *p;
+	if (!blockList) {
+		return FALSE;
+	}
+	
+	if (DMA_IsBusy()) {
+		return FALSE;
+	}
+	
+	p = blockList;
+	while (p) {
+		BOOL llp = FALSE;
+		INNER_BLOCK_DESC *inner = (INNER_BLOCK_DESC *)p;
+		if (p->nextBlock) {
+			llp = TRUE;
+		}
+		
+		inner->high.INNER.CTL_HI = 0;
+		inner->high.INNER.CTL_HI_b.BLOCK_TS = (p->number >> DMA_TR_WIDTH_32_BIT);
+		inner->high.INNER.CTL_HI_b.DONE = 0;
+		
+		inner->nextBlock = p->nextBlock;
+		
+		inner->low.INNER.CTL_LOW = 0;
+		inner->low.INNER.CTL_LOW_b.INT_EN = TRUE;
+		inner->low.INNER.CTL_LOW_b.DST_TR_WIDTH 	= DMA_TR_WIDTH_32_BIT;
+	  inner->low.INNER.CTL_LOW_b.SRC_TR_WIDTH 	= DMA_TR_WIDTH_32_BIT;
+	  inner->low.INNER.CTL_LOW_b.DINC 					= DMA_INC_INCREMENT;
+	  inner->low.INNER.CTL_LOW_b.SINC 					= DMA_INC_INCREMENT;
+	  inner->low.INNER.CTL_LOW_b.DEST_MSIZE 		= 0;
+	  inner->low.INNER.CTL_LOW_b.SRC_MSIZE 		  = 0;
+	  inner->low.INNER.CTL_LOW_b.SRC_GATHER_EN  = FALSE;
+	  inner->low.INNER.CTL_LOW_b.DST_SCATTER_EN = FALSE;
+	  inner->low.INNER.CTL_LOW_b.TT_FC 					= 0;
+    inner->low.INNER.CTL_LOW_b.DMS    				= 0;
+	  inner->low.INNER.CTL_LOW_b.SMS    				= 0;
+	  inner->low.INNER.CTL_LOW_b.LLP_DST_EN   	= llp;
+	  inner->low.INNER.CTL_LOW_b.LLP_SRC_EN   	= llp;
+		
+		if ((uint32_t)inner == (uint32_t)blockList) {
+			// copy to DMA
+			DMA->SAR0 = llp ? 0x0 : inner->srcAddr ;
+			DMA->DAR0 = llp ? 0x0 : inner->dstAddr ;
+			
+			DMA->CTL_HI0 = llp ? 0x0 : inner->high.INNER.CTL_HI;
+			DMA->CTL_LOW0 = inner->low.INNER.CTL_LOW;
+			
+			DMA->LLP0 = llp ? (uint32_t)inner : 0x0;
+		}
+		
+		p = (BLOCK_DESC *)inner->nextBlock;
+	}
+
+	// open channel 0
+	DMA->CH_EN = (0x1 << DMA_MAX_CHANNEL_NUM) | 0x1;
+	
+	return TRUE;
+}
+

+ 255 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_efuse.c

@@ -0,0 +1,255 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_efuse.c
+	*
+	* @brief    CMEM7 EFUSE source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_efuse.h"
+
+static void efuse_SetClock(uint8_t dividor) {
+	if (dividor <= 2) {
+		GLOBAL_CTRL->CLK_SEL_1_b.EFUSE_CLK = 0;
+	} else if (dividor <= 4) {
+		GLOBAL_CTRL->CLK_SEL_1_b.EFUSE_CLK = 1;
+	} else if (dividor <= 8) {
+		GLOBAL_CTRL->CLK_SEL_1_b.EFUSE_CLK = 2;
+	} else {
+		GLOBAL_CTRL->CLK_SEL_1_b.EFUSE_CLK = 3;
+	}
+}
+
+static uint32_t efuse_GetClock() {
+	return SYSTEM_CLOCK_FREQ / (1 << (GLOBAL_CTRL->CLK_SEL_1_b.EFUSE_CLK + 1));
+}
+
+// static uint8_t efuse_Crc8Bit(uint8_t data, uint8_t crc) {
+// 	uint8_t newCrc;
+// 	uint8_t d[8], c[8], i;
+// 	
+// 	for (i = 0; i < 8; i++) {
+// 		d[i] = (data >> i) & 0x01;
+// 		c[i] = (crc >> i) & 0x01;
+// 	}
+// 	
+// 	newCrc = d[7] ^ d[6] ^ d[0] ^ c[0] ^ c[6] ^ c[7];
+// 	newCrc |= (d[6] ^ d[1] ^ d[0] ^ c[0] ^ c[1] ^ c[6]) << 1;
+// 	newCrc |= (d[6] ^ d[2] ^ d[1] ^ d[0] ^ c[0] ^ c[1] ^ c[2] ^ c[6]) << 2;
+// 	newCrc |= (d[7] ^ d[3] ^ d[2] ^ d[1] ^ c[1] ^ c[2] ^ c[3] ^ c[7]) << 3;
+// 	newCrc |= (d[4] ^ d[3] ^ d[2] ^ c[2] ^ c[3] ^ c[4]) << 4;
+// 	newCrc |= (d[5] ^ d[4] ^ d[3] ^ c[3] ^ c[4] ^ c[5]) << 5;
+// 	newCrc |= (d[6] ^ d[5] ^ d[4] ^ c[4] ^ c[5] ^ c[6]) << 6;
+// 	newCrc |= (d[7] ^ d[6] ^ d[5] ^ c[5] ^ c[6] ^ c[7]) << 1;
+// 	
+// 	return newCrc;
+// }
+
+// static uint8_t efuse_Crc(EFUSE_AesKey* key, uint8_t lock, BOOL isLowRegion) {
+// 	uint8_t crc = 0;
+// 	
+// 	if (isLowRegion) {
+// 		crc = efuse_Crc8Bit(key->key0, crc);
+// 		crc = efuse_Crc8Bit(key->key0 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key0 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key0 >> 24, crc);
+// 		crc = efuse_Crc8Bit(key->key1, crc);
+// 		crc = efuse_Crc8Bit(key->key1 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key1 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key1 >> 24, crc);
+// 		crc = efuse_Crc8Bit(key->key2, crc);
+// 		crc = efuse_Crc8Bit(key->key2 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key2 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key2 >> 24, crc);
+// 		crc = efuse_Crc8Bit(key->key3, crc);
+// 		crc = efuse_Crc8Bit(key->key3 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key3 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key3 >> 24, crc);
+// 		crc = efuse_Crc8Bit(lock, crc);
+// 		crc = efuse_Crc8Bit(0x0, crc);
+// 		crc = efuse_Crc8Bit(0x0, crc);
+// 	} else {
+// 		crc = efuse_Crc8Bit(key->key4, crc);
+// 		crc = efuse_Crc8Bit(key->key4 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key4 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key4 >> 24, crc);
+// 		crc = efuse_Crc8Bit(key->key5, crc);
+// 		crc = efuse_Crc8Bit(key->key5 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key5 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key5 >> 24, crc);
+// 		crc = efuse_Crc8Bit(key->key6, crc);
+// 		crc = efuse_Crc8Bit(key->key6 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key6 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key6 >> 24, crc);
+// 		crc = efuse_Crc8Bit(key->key7, crc);
+// 		crc = efuse_Crc8Bit(key->key7 >> 8, crc);
+// 		crc = efuse_Crc8Bit(key->key7 >> 16, crc);
+// 		crc = efuse_Crc8Bit(key->key7 >> 24, crc);
+// 		crc = efuse_Crc8Bit(lock, crc);
+// 		crc = efuse_Crc8Bit(0x0, crc);
+// 		crc = efuse_Crc8Bit(0x0, crc);
+// 	}
+// 	
+// 	return crc;
+// }
+
+void EFUSE_Init(EFUSE_InitTypeDef* init) {
+	assert_param(init);
+	assert_param(IS_EFUSE_TMRF(init->EFUSE_TMRF));
+	
+	efuse_SetClock(init->EFUSE_ClockDividor);
+	EFUSE->USER_CTRL_LOW_b.TMRF = init->EFUSE_TMRF;
+	EFUSE->USER_CTRL_HI_b.TMRF = init->EFUSE_TMRF;
+	if (init->timing) {
+		uint32_t value;
+		
+		value = (init->timing->EFUSE_Tpwph * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_0_b.TPWPH = value >> 2;
+		EFUSE->TIMING_1_b.TPWPH = value & 0x00000003;
+
+		value = (init->timing->EFUSE_Trac * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_0_b.TRAC = value;
+
+		value = (init->timing->EFUSE_Trah * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_0_b.TRAH = value;
+		
+		value = (init->timing->EFUSE_Trpw * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_0_b.TRPW = value;
+
+		value = (init->timing->EFUSE_Trc * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_0_b.TRC = value;
+		
+		value = (init->timing->EFUSE_Tesr * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_0_b.TESR = value;
+
+		value = (init->timing->EFUSE_Tprs * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_0_b.TPRS = value;
+
+		value = (init->timing->EFUSE_Tpi * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_1_b.TPIT = value;
+
+		value = (init->timing->EFUSE_Tpp * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_1_b.TPP = value;
+
+		value = (init->timing->EFUSE_Teps * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_1_b.TEPS = value;
+
+		value = (init->timing->EFUSE_Teps * (efuse_GetClock() / 1000000) / 1000);
+		value = (value == 0) ? 1 : value;
+		EFUSE->TIMING_1_b.TPWPS = value;
+	}
+}
+
+/* It only can be written once */
+// BOOL EFUSE_Write(EFUSE_AesKey* key) {
+//   assert_param(key);	
+// 	
+// 	if ((EFUSE->USER_CTRL_LOW_b.LOCK || EFUSE->USER_CTRL_LOW_b.BUSY) ||
+// 		(EFUSE->USER_CTRL_HI_b.LOCK || EFUSE->USER_CTRL_HI_b.BUSY)) {
+// 		return FALSE;
+// 	}
+// 	
+// 	// write low region
+// 	EFUSE->USER_DATA0_LOW = key->key0;
+// 	EFUSE->USER_DATA1_LOW = key->key1;
+// 	EFUSE->USER_DATA2_LOW = key->key2;
+// 	EFUSE->USER_DATA3_LOW = key->key3;
+// 	EFUSE->USER_DATA4_LOW_b.CRC = efuse_Crc(key, 0x1, TRUE);
+// 	EFUSE->USER_DATA4_LOW_b.LOCK = 1;
+// 	EFUSE->USER_CTRL_LOW_b.WR_EN = FALSE;
+// 	EFUSE->USER_CTRL_LOW_b.WR_EN = TRUE;
+// 	
+// 	udelay(1000);
+// 	while (EFUSE->USER_CTRL_LOW_b.BUSY) ;
+// 	
+// 	if (EFUSE->USER_CTRL_LOW_b.WR_CRC_ERR) {
+// 		return FALSE;
+// 	}
+// 	
+// 	// write high region
+// 	EFUSE->USER_DATA0_HI = key->key4;
+// 	EFUSE->USER_DATA1_HI = key->key5;
+// 	EFUSE->USER_DATA2_HI = key->key6;
+// 	EFUSE->USER_DATA3_HI = key->key7;
+// 	EFUSE->USER_DATA4_HI_b.CRC = efuse_Crc(key, 0x1, FALSE);
+// 	EFUSE->USER_DATA4_HI_b.LOCK = 1;
+// 	EFUSE->USER_CTRL_HI_b.WR_EN = FALSE;
+// 	EFUSE->USER_CTRL_HI_b.WR_EN = TRUE;
+// 	
+// 	udelay(1000);
+// 	while (EFUSE->USER_CTRL_HI_b.BUSY) ;
+// 	
+// 	if (EFUSE->USER_CTRL_HI_b.WR_CRC_ERR) {
+// 		return FALSE;
+// 	}
+// 	return TRUE;
+// }
+
+BOOL EFUSE_Compare(EFUSE_AesKey* key) {
+  assert_param(key);	
+	
+	if (EFUSE->USER_CTRL_LOW_b.BUSY || EFUSE->USER_CTRL_HI_b.BUSY) {
+		return FALSE;
+	}
+	
+	// compare low region
+	EFUSE->USER_DATA0_LOW = key->key0;
+	EFUSE->USER_DATA1_LOW = key->key1;
+	EFUSE->USER_DATA2_LOW = key->key2;
+	EFUSE->USER_DATA3_LOW = key->key3;
+	EFUSE->USER_CTRL_LOW_b.RD_EN = FALSE;
+	EFUSE->USER_CTRL_LOW_b.RD_EN = TRUE;
+	
+	udelay(2);
+	while (EFUSE->USER_CTRL_LOW_b.BUSY) ;
+	
+	if (EFUSE->USER_CTRL_LOW_b.COMPARE_FAIL) {
+		return FALSE;
+	}
+	
+	// compare high region
+	EFUSE->USER_DATA0_HI = key->key4;
+	EFUSE->USER_DATA1_HI = key->key5;
+	EFUSE->USER_DATA2_HI = key->key6;
+	EFUSE->USER_DATA3_HI = key->key7;
+	EFUSE->USER_CTRL_HI_b.RD_EN = FALSE;
+	EFUSE->USER_CTRL_HI_b.RD_EN = TRUE;
+	
+	udelay(2);
+	while (EFUSE->USER_CTRL_HI_b.BUSY) ;
+	
+	if (EFUSE->USER_CTRL_HI_b.COMPARE_FAIL) {
+		return FALSE;
+	}
+	
+	return TRUE;	
+}
+

+ 692 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_eth.c

@@ -0,0 +1,692 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_eth.c
+	*
+	* @brief    CMEM7 ethernet source file
+	*
+	*
+	* @version  V2.0
+	* @date     3. September 2014
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_eth.h"
+#include "cmem7_misc.h"
+
+typedef struct { 
+	union {
+    uint32_t  TX0;
+		
+		struct {
+			uint32_t 								:  1;
+			uint32_t UNDERFLOW_ERR  :  1; 	 /*!< [OUT] Underflow error            											*/
+			uint32_t 								:  1;
+			uint32_t COLLISION_CNT	:  4;		 /*!< [OUT] Collision count				                          */
+			uint32_t 								:  1;
+			uint32_t EX_COLLISION 	:  1;		 /*!< [OUT] Excessive collision error	                      */
+			uint32_t LATE_COLLISION :  1;		 /*!< [OUT] Late collision error	                          */
+			uint32_t NO_CARRIER     :  1;		 /*!< [OUT] No carrier error                          			*/
+			uint32_t LOSS_CARRIER   :  1;		 /*!< [OUT] loss of carrier error                          	*/
+			uint32_t PAYLOAD_ERR 		:  1;		 /*!< [OUT] IP payload error                          			*/
+			uint32_t 								:  2;
+			uint32_t ERR_SUM 				:  1;		 /*!< [OUT] Error summary		                          			*/
+			uint32_t HEADER_ERR 		:  1;		 /*!< [OUT] IP header error                          				*/
+			uint32_t 								:  3;
+			uint32_t TCH						:  1;		 /*!< Second Address Chained                                */
+			uint32_t 								:  4;
+			uint32_t TTSE           :  1; 	 /*!< enables IEEE1588 hardware timestamping in first segment */
+			uint32_t 							  :  2;  
+			uint32_t FS           	:  1; 	 /*!< first segment flag                                    */
+			uint32_t LS           	:  1; 	 /*!< last segment flag                                     */
+			uint32_t IC	           	:  1; 	 /*!< Interrupt on Completion                               */
+			uint32_t OWN          	:  1; 	 /*!< Descriptor is owned by self or hardware               */
+		} TX0_b;
+	} TX_0;
+	
+	union {
+    uint32_t  TX1;
+		
+		struct {
+			uint32_t SIZE						: 13; 	 /*!< buffer size                                           */
+			uint32_t                : 19;
+		} TX1_b;
+	} TX_1;
+	
+	uint32_t bufAddr;
+	uint32_t nextDescAddr;
+  uint64_t reserved;
+	uint64_t timeStamp;									 /*!< time stamp in the last segment                         */
+} INNER_ETH_TX_DESC;
+
+typedef struct { 
+	union {
+    uint32_t  RX0;
+		
+		struct {
+			uint32_t 								:  1;
+			uint32_t CRC_ERR        :  1; 	 /*!< [OUT] CRC error while last segment                		*/
+			uint32_t 								:  5;
+			uint32_t TTSE           :  1; 	 /*!< timestamp available while last segment                */
+			uint32_t LS           	:  1; 	 /*!< last segment flag                                     */
+			uint32_t FS           	:  1; 	 /*!< first segment flag                                    */
+			uint32_t 								:  1;
+			uint32_t OVERFLOW_ERR   :  1; 	 /*!< [OUT] FIFO overflow while last segment                */
+			uint32_t LENGTH_ERR     :  1; 	 /*!< [OUT] length error while last segment                	*/
+			uint32_t 								:  2;
+			uint32_t ERR_SUM        :  1; 	 /*!< [OUT] Error summary while last segment              	*/
+			uint32_t FL           	: 14; 	 /*!< frame length while last segment                       */
+			uint32_t 		           	:  1;
+			uint32_t OWN          	:  1; 	 /*!< Descriptor is owned by self or hardware               */
+		} RX0_b;
+	} RX_0;
+	
+	union {
+    uint32_t  RX1;
+		
+		struct {
+			uint32_t SIZE						: 13; 	 /*!< buffer size                                           */
+			uint32_t 		           	:  1;
+			uint32_t RCH            :  1;    /*!< Second Address Chained                                */
+			uint32_t 		           	: 16;
+			uint32_t DIC	          :  1; 	 /*!< Disable interrupt on Completion                       */
+		} RX1_b;
+	} RX_1;
+	
+	uint32_t bufAddr;
+	uint32_t nextDescAddr;
+  uint64_t reserved;
+	uint64_t timeStamp;									 /*!< time stamp while the last segment                     */
+} INNER_ETH_RX_DESC;
+
+
+#define PHY_OP_READ                 0x0
+#define PHY_OP_WRITE                0x1
+
+#define ETH_BURST_MODE_FIXED        0x0
+#define ETH_BURST_MODE_UNDERSIZE    0x1
+#define ETH_BURST_MODE_MIXED        0x2
+
+#define ETH_BURST_LENGTH_MIN        1
+#define ETH_BURST_LENGTH_MAX        256
+#define ETH_BURST_LENGTH_8X_SWITCH  32
+#define ETH_BURST_LENGTH_8X_MIN     8
+
+#define ETH_DMA_ARBITRATION_ROUND_ROBIN			0x0
+#define ETH_DMA_ARBITRATION_FIXED_PRIORITY	0x1
+
+#define ETH_RX_THRESHOLD_64         0x0
+#define ETH_RX_THRESHOLD_32         0x1
+#define ETH_RX_THRESHOLD_96         0x2
+#define ETH_RX_THRESHOLD_128        0x3
+
+#define ETH_TX_THRESHOLD_64         0x0
+#define ETH_TX_THRESHOLD_128        0x1
+#define ETH_TX_THRESHOLD_192        0x2
+#define ETH_TX_THRESHOLD_256        0x3
+#define ETH_TX_THRESHOLD_40         0x4
+#define ETH_TX_THRESHOLD_32         0x5
+#define ETH_TX_THRESHOLD_24         0x6
+#define ETH_TX_THRESHOLD_16         0x7
+
+#define ETH_INT_ABNORMAL_SUMMARY    0x8000
+#define ETH_INT_NORMAL_SUMMARY      0x10000
+
+#define IS_ETH_INT_NORMAL(INT)      ((INT & ETH_INT_TX_COMPLETE_FRAME) 	|| \
+																		 (INT & ETH_INT_TX_BUF_UNAVAI) 			|| \
+																		 (INT & ETH_INT_RX_COMPLETE_FRAME))
+																		 
+#define IS_ETH_INT_ABNORMAL(INT)    ((INT & ETH_INT_TX_STOP) 						|| \
+																		 (INT & ETH_INT_RX_OVERFLOW)        || \
+																		 (INT & ETH_INT_TX_UNDERFLOW)       || \
+																		 (INT & ETH_INT_RX_BUF_UNAVAI) 			|| \
+																		 (INT & ETH_INT_RX_STOP) 						|| \
+																		 (INT & ETH_INT_BUS_FATAL_ERROR))																		 
+						
+#define ETH_PREAMBLE_7_BYTE         0x0
+#define ETH_PREAMBLE_5_BYTE         0x1
+#define ETH_PREAMBLE_3_BYTE         0x2
+
+#define ETH_LINE_SPEED_1000M_BPS		0x0
+#define ETH_LINE_SPEED_10_100M_BPS	0x1
+
+#define ETH_EXACT_SPEED_10M_BPS			0x0
+#define ETH_EXACT_SPEED_100M_BPS		0x1
+
+#define ETH_SOURCE_ADDR_REPLACE     0x3
+
+#define ETH_PASS_CTRL_FRAME_ALL     0x0
+
+#define ETH_DESC_OWN_BY_SELF        0x0
+#define ETH_DESC_OWN_BY_HW          0x1
+
+
+static void mac_SwReset(void) {
+	ETH->BUS_MODE_b.SWR = 1;
+	while (ETH->BUS_MODE_b.SWR) ;
+	while (ETH->AHB_STATUS_b.BUSY) ;
+}
+
+static void mac_SetConfig(ETH_InitTypeDef *init) {	
+	ETH->CONFIG_b.PRELEN = ETH_PREAMBLE_7_BYTE;
+	ETH->CONFIG_b.RX_EN = init->ETH_RxEn;
+	ETH->CONFIG_b.TX_EN = init->ETH_TxEn;
+	ETH->CONFIG_b.DC_EN = FALSE;
+	ETH->CONFIG_b.ACS = FALSE;
+	ETH->CONFIG_b.LUD = init->ETH_LinkUp;
+	ETH->CONFIG_b.IPC = init->ETH_ChecksumOffload;
+	ETH->CONFIG_b.DM = init->ETH_Duplex;
+	ETH->CONFIG_b.LM = FALSE;
+	ETH->MMCRIMR = 0xFFFFFFFF;
+	ETH->MMCTIMR = 0xFFFFFFFF;
+	ETH->MMCIRCOIM = 0xFFFFFFFF;
+	
+	if (init->ETH_Speed == ETH_SPEED_10M) {
+		ETH->CONFIG_b.FES = ETH_EXACT_SPEED_10M_BPS;
+		ETH->CONFIG_b.PS = ETH_LINE_SPEED_10_100M_BPS;
+	} else if (init->ETH_Speed == ETH_SPEED_100M) {
+		ETH->CONFIG_b.FES = ETH_EXACT_SPEED_100M_BPS;
+		ETH->CONFIG_b.PS = ETH_LINE_SPEED_10_100M_BPS;
+	} else {
+		ETH->CONFIG_b.FES = ETH_EXACT_SPEED_100M_BPS;
+		ETH->CONFIG_b.PS = ETH_LINE_SPEED_1000M_BPS;
+	}
+
+	ETH->CONFIG_b.JE = init->ETH_JumboFrame;
+	
+	ETH->CONFIG_b.JD = TRUE;
+	ETH->CONFIG_b.WD = TRUE;
+	ETH->CONFIG_b.TC = FALSE;
+	ETH->CONFIG_b.CST = TRUE;
+	ETH->CONFIG_b.TWOKPE = FALSE;
+	ETH->CONFIG_b.SARC = ETH_SOURCE_ADDR_REPLACE;
+}
+
+static void mac_SetMacAddr(uint8_t *mac) {
+	ETH->ADDR0_HIGH = (mac[5] << 8) | mac[4];
+	ETH->ADDR0_LOW = (mac[3] << 24) | (mac[2] << 16) | 
+		  (mac[1] << 8) | mac[0];
+}
+
+static void mac_SetBurst(
+  uint8_t mode, uint32_t rxBurstLen, uint32_t txBurstLen) {
+	ETH->BUS_MODE_b.RIB = FALSE;
+	ETH->BUS_MODE_b.AAL = FALSE;
+		
+	if (mode == ETH_BURST_MODE_FIXED) {
+		ETH->BUS_MODE_b.FB = TRUE;
+		ETH->BUS_MODE_b.MB = FALSE;
+	} else if (mode == ETH_BURST_MODE_UNDERSIZE) {
+		ETH->BUS_MODE_b.FB = FALSE;
+		ETH->BUS_MODE_b.MB = FALSE;
+	} else {
+		ETH->BUS_MODE_b.FB = TRUE;
+		ETH->BUS_MODE_b.MB = TRUE;
+	}
+	
+	rxBurstLen = 1 << rxBurstLen;
+	rxBurstLen = (rxBurstLen > ETH_BURST_LENGTH_MAX) ? 
+	  ETH_BURST_LENGTH_MAX : rxBurstLen;
+	
+	txBurstLen = 1 << txBurstLen;
+	txBurstLen = (txBurstLen > ETH_BURST_LENGTH_MAX) ? 
+	  ETH_BURST_LENGTH_MAX : txBurstLen;
+	
+	// Regrading PBLx8 register, if one of PBL and RPBL is more than 
+	// ETH_BURST_LENGTH_8X_SWITCH, another should be more than 
+	// ETH_BURST_LENGTH_8X_MIN.
+	// If not, the greater level down to ETH_BURST_LENGTH_8X_SWITCH.
+	if ((txBurstLen < ETH_BURST_LENGTH_8X_MIN) ||
+		(rxBurstLen < ETH_BURST_LENGTH_8X_MIN)) {
+		if (rxBurstLen > ETH_BURST_LENGTH_8X_SWITCH) {
+			rxBurstLen = ETH_BURST_LENGTH_8X_SWITCH;
+		}
+		
+		if (txBurstLen > ETH_BURST_LENGTH_8X_SWITCH) {
+			txBurstLen = ETH_BURST_LENGTH_8X_SWITCH;
+		}
+	}
+		
+	ETH->BUS_MODE_b.USP = (rxBurstLen == txBurstLen) ? FALSE : TRUE;
+  if ((txBurstLen > ETH_BURST_LENGTH_8X_SWITCH) ||
+		(rxBurstLen > ETH_BURST_LENGTH_8X_SWITCH)) {
+		ETH->BUS_MODE_b.PBLx8 = TRUE;
+	} else {
+		ETH->BUS_MODE_b.PBLx8 = FALSE;
+	}
+	
+	if (ETH->BUS_MODE_b.PBLx8) {
+		ETH->BUS_MODE_b.RPBL = rxBurstLen >> 3;
+		ETH->BUS_MODE_b.PBL = txBurstLen >> 3;
+	} else {
+		ETH->BUS_MODE_b.RPBL = rxBurstLen;
+		ETH->BUS_MODE_b.PBL = txBurstLen;
+	}	
+}
+
+static void mac_SetPriority(BOOL isRxPrior, uint8_t priorityRate) {
+  ETH->BUS_MODE_b.PRWG = 0;
+	ETH->BUS_MODE_b.DA = ETH_DMA_ARBITRATION_ROUND_ROBIN;
+	
+	ETH->BUS_MODE_b.TXPR = isRxPrior ? FALSE : TRUE;
+	ETH->BUS_MODE_b.PR = priorityRate;
+}
+
+static void mac_SetDescMode(BOOL isAlternate, uint8_t gap) {
+  ETH->BUS_MODE_b.ATDS = isAlternate;
+	ETH->BUS_MODE_b.DSL = gap;
+}
+
+static void mac_SetOpertionMode(void) {
+	ETH->OPERATION_b.OSF = FALSE;
+	ETH->OPERATION_b.RT = ETH_RX_THRESHOLD_32;
+	ETH->OPERATION_b.RSF = FALSE;
+	
+	ETH->OPERATION_b.DGF = FALSE;
+	ETH->OPERATION_b.FUF = FALSE;
+	ETH->OPERATION_b.FEF = FALSE;
+	ETH->OPERATION_b.TT = ETH_TX_THRESHOLD_64;
+	ETH->OPERATION_b.TSF = FALSE;
+	
+	ETH->OPERATION_b.FTF = TRUE;
+	ETH->OPERATION_b.DFF = TRUE;
+}
+
+static void mac_SetFrameFilter(ETH_FrameFilter *filter) {
+	ETH->FF_b.PR = FALSE;
+	ETH->FF_b.HUC = FALSE;
+	ETH->FF_b.HMC = FALSE;
+	ETH->FF_b.DAIF = FALSE;
+	ETH->FF_b.PM = FALSE;
+	ETH->FF_b.DBF = FALSE;
+	ETH->FF_b.PCF = ETH_PASS_CTRL_FRAME_ALL;
+	ETH->FF_b.SAIF = FALSE;
+	ETH->FF_b.SAF = FALSE;
+	ETH->FF_b.HPF = FALSE;
+	ETH->FF_b.VTFE = FALSE;
+	ETH->FF_b.IPFE = FALSE;
+	ETH->FF_b.DNTU = FALSE;
+	ETH->FF_b.RA = FALSE;//TRUE
+	
+	// receive all
+	if (!filter) {
+		return ;
+	}
+	
+	// broadcast 
+	if (filter->ETH_BroadcastFilterEnable) {
+		ETH->FF_b.RA = FALSE;
+		ETH->FF_b.DBF = TRUE;
+	}
+	
+	// DA
+	if (filter->ETH_OwnFilterEnable) {
+		ETH->FF_b.RA = FALSE;
+		ETH->FF_b.DAIF = filter->ETH_SelfDrop;
+	}
+	
+	// SA
+	if (filter->ETH_SourceFilterEnable) {
+		uint32_t value;
+    
+    ETH->FF_b.RA = FALSE;
+		ETH->FF_b.SAF = TRUE;
+		ETH->FF_b.SAIF = filter->ETH_SourceDrop;
+		ETH->ADDR1_HIGH_b.AE = TRUE;
+		ETH->ADDR1_HIGH_b.SA = TRUE; 
+    ETH->ADDR1_HIGH_b.ADDR = 
+			(filter->ETH_SourceMacAddr[5] << 8) | filter->ETH_SourceMacAddr[4];
+		
+		
+// 		value = (filter->ETH_SourceMacAddr[5] << 8) | filter->ETH_SourceMacAddr[4];
+//     CMEM7_BFI(&(ETH->ADDR1_HIGH), value, 0, 16);
+    ETH->ADDR1_LOW = (filter->ETH_SourceMacAddr[3] << 24) | 
+			(filter->ETH_SourceMacAddr[2] << 16) | 
+		  (filter->ETH_SourceMacAddr[1] << 8) | 
+			filter->ETH_SourceMacAddr[0];
+	}
+}
+
+static void mac_setFlowControl(void) {
+  ETH->FC_b.FCB = FALSE;
+	ETH->FC_b.TFE = FALSE;//TRUE
+	ETH->FC_b.RFE = FALSE;//TRUE
+	ETH->FC_b.UP = FALSE;//TRUE
+}
+
+uint32_t ETH_PhyRead(uint32_t phyAddr, uint32_t phyReg) {
+	ETH->GMII_ADDR_b.PA = phyAddr;
+	ETH->GMII_ADDR_b.GR = phyReg;
+	ETH->GMII_ADDR_b.GW = PHY_OP_READ;
+
+	ETH->GMII_ADDR_b.BUSY = TRUE;
+	while (ETH->GMII_ADDR_b.BUSY) ;
+	
+	return ETH->GMII_DATA;
+}
+
+void ETH_PhyWrite(uint32_t phyAddr, uint32_t phyReg, uint32_t data) {
+	ETH->GMII_ADDR_b.PA = phyAddr;
+	ETH->GMII_ADDR_b.GR = phyReg;
+	ETH->GMII_ADDR_b.GW = PHY_OP_WRITE;
+  ETH->GMII_DATA = data;
+	
+	ETH->GMII_ADDR_b.BUSY = TRUE;
+	while (ETH->GMII_ADDR_b.BUSY) ;
+}
+
+void ETH_StructInit(ETH_InitTypeDef* init)
+{
+    init->ETH_Speed = ETH_SPEED_10M;
+    init->ETH_Duplex = ETH_DUPLEX_FULL;
+    init->ETH_JumboFrame = FALSE;
+    init->ETH_LinkUp = FALSE;
+    init->ETH_RxEn = TRUE;
+    init->ETH_TxEn = TRUE;
+    init->ETH_ChecksumOffload = FALSE;
+    init->ETH_Filter = 0;
+    init->ETH_MacAddr[0] = 0;
+    init->ETH_MacAddr[1] = 0;
+    init->ETH_MacAddr[2] = 0;
+    init->ETH_MacAddr[3] = 0;
+    init->ETH_MacAddr[4] = 0;
+    init->ETH_MacAddr[5] = 0;
+    
+}
+BOOL ETH_Init(ETH_InitTypeDef *init) {
+    assert_param(init);
+    assert_param(IS_ETH_SPEED(init->ETH_Speed));
+    assert_param(IS_ETH_DUPLEX(init->ETH_Duplex));
+	
+    mac_SwReset();
+    mac_SetConfig(init);
+    mac_SetMacAddr(init->ETH_MacAddr);
+	
+    mac_SetBurst(ETH_BURST_MODE_MIXED, 3, 4);
+    mac_SetPriority(TRUE, 0);
+    mac_SetDescMode(TRUE, 0);
+    mac_SetOpertionMode();
+    mac_SetFrameFilter(init->ETH_Filter);
+    mac_setFlowControl();
+	
+    return TRUE;
+}
+
+void ETH_ITConfig(uint32_t Int, BOOL enable) {
+	assert_param(IS_ETH_INT(Int));
+	
+	if (enable) {
+		if (IS_ETH_INT_NORMAL(Int)) {
+			ETH->INT_EN_b.NIE = TRUE;
+		}
+		
+		if (IS_ETH_INT_ABNORMAL(Int)) {
+			ETH->INT_EN_b.AIE = TRUE;
+		}
+		
+		ETH->INT_EN |= Int;
+	} else {
+		ETH->INT_EN &= ~Int;
+		
+		if (!IS_ETH_INT_NORMAL(ETH->INT_EN)) {
+			ETH->INT_EN_b.NIE = FALSE;
+		}
+		
+		if (!IS_ETH_INT_ABNORMAL(ETH->INT_EN)) {
+			ETH->INT_EN_b.AIE = FALSE;
+		}
+	}
+}
+BOOL ETH_GetITStatus(uint32_t Int) {
+	assert_param(IS_ETH_INT(Int));
+	
+	Int &= ETH->INT_EN;
+	if (0 != (ETH->STATUS & Int)) {
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+void ETH_ClearITPendingBit(uint32_t Int) {
+	uint32_t sta;
+	assert_param(IS_ETH_INT(Int));
+		
+	sta = ETH->STATUS;
+	sta &= ETH->INT_EN;
+	sta &= ~Int;
+	
+	// write 1 clear
+	ETH->STATUS = Int;
+	
+	if (IS_ETH_INT_NORMAL(Int)) {
+		if (!IS_ETH_INT_NORMAL(sta)) {
+			// write 1 clear NIS
+			ETH->STATUS = ETH_INT_NORMAL_SUMMARY;
+		}
+	}
+	
+	if (IS_ETH_INT_ABNORMAL(Int)) {
+		if (!IS_ETH_INT_ABNORMAL(sta)) {
+			// write 1 clear AIS
+			ETH->STATUS = ETH_INT_ABNORMAL_SUMMARY;
+		}
+	}
+}
+
+void ETH_GetMacAddr(uint8_t *mac) {
+  uint32_t tmp;
+	
+	if (!mac) {
+		return ;
+	}
+	
+	tmp = ETH->ADDR0_LOW;
+	*(mac + 0) = (tmp >> 0) & 0xFF;
+	*(mac + 1) = (tmp >> 8) & 0xFF;
+	*(mac + 2) = (tmp >> 16) & 0xFF;
+	*(mac + 3) = (tmp >> 24) & 0xFF;
+	tmp = ETH->ADDR0_HIGH;
+	*(mac + 4) = (tmp >> 0) & 0xFF;
+	*(mac + 5) = (tmp >> 8) & 0xFF;
+}
+
+BOOL ETH_SetTxDescRing(ETH_TX_DESC *ring) {
+	ETH_TX_DESC *buf = ring;
+	
+	if (!ring) {
+		return FALSE;
+	}
+	
+	if (ETH->OPERATION_b.ST) {
+		return FALSE;
+	}
+
+  /* If code mapping */
+  ring = (ETH_TX_DESC *)GLB_ConvertToMappingFromAddr((uint32_t)ring);
+  buf = ring;
+  
+	do {
+		INNER_ETH_TX_DESC *desc = (INNER_ETH_TX_DESC *)buf;
+    uint8_t first = desc->TX_0.TX0_b.FS;
+    uint8_t last = desc->TX_0.TX0_b.LS;
+    
+    // clear all bits
+    desc->TX_0.TX0 = 0;
+    desc->TX_0.TX0_b.FS = first;
+    desc->TX_0.TX0_b.LS = last;
+		desc->TX_0.TX0_b.TCH = TRUE;
+		desc->TX_0.TX0_b.IC = TRUE;
+		desc->TX_0.TX0_b.OWN = ETH_DESC_OWN_BY_SELF;
+		
+    buf->bufAddr = GLB_ConvertToMappingFromAddr(buf->bufAddr);
+    buf->nextDescAddr = GLB_ConvertToMappingFromAddr(buf->nextDescAddr);
+		buf = (ETH_TX_DESC *)buf->nextDescAddr;
+	} while (buf != ring);
+	
+	ETH->TDESLA = (uint32_t)ring;
+ 
+	return TRUE;
+}
+
+void ETH_StartTx() {
+	ETH->OPERATION_b.ST = TRUE;
+}
+
+void ETH_StopTx() {
+	ETH->OPERATION_b.ST = FALSE;
+}
+
+void ETH_ResumeTx() {
+	ETH->TPD = 0;
+}
+
+ETH_TX_DESC *ETH_AcquireFreeTxDesc(void) {
+	uint32_t cur = ETH->CURTDESAPTR;
+	INNER_ETH_TX_DESC *desc = (INNER_ETH_TX_DESC *)cur;
+	
+	do {
+		if (desc->TX_0.TX0_b.OWN == ETH_DESC_OWN_BY_SELF) {
+			return (ETH_TX_DESC *)desc;
+		}
+		desc = (INNER_ETH_TX_DESC *)desc->nextDescAddr;
+	} while ((uint32_t)desc != cur);
+	
+  return 0;		
+}
+
+BOOL ETH_IsFreeTxDesc(ETH_TX_DESC *desc) {
+	INNER_ETH_TX_DESC *inner;
+	
+	if (!desc) {
+		return FALSE;
+	}
+	
+	inner = (INNER_ETH_TX_DESC *)desc;
+	return (inner->TX_0.TX0_b.OWN == ETH_DESC_OWN_BY_SELF) ? TRUE : FALSE;
+}
+
+void ETH_ReleaseTxDesc(ETH_TX_DESC *desc) {
+	INNER_ETH_TX_DESC *inner;
+	
+	if (!desc) {
+		return;
+	}
+	
+	inner = (INNER_ETH_TX_DESC *)desc;
+	inner->TX_0.TX0_b.OWN = ETH_DESC_OWN_BY_HW;
+}
+
+void ETH_SetTxDescBufAddr(ETH_TX_DESC *desc, uint32_t bufAddr) {
+	if (desc) {
+		desc->bufAddr = GLB_ConvertToMappingFromAddr(bufAddr);;
+	}
+}
+
+uint32_t ETH_GetTxDescBufAddr(ETH_TX_DESC *desc) {
+  return (desc ? GLB_ConvertToMappingToAddr(desc->bufAddr) : 0);
+}
+
+BOOL ETH_SetRxDescRing(ETH_RX_DESC *ring) {
+	ETH_RX_DESC *buf = ring;
+	
+	if (!ring) {
+		return FALSE;
+	}
+	
+	if (ETH->OPERATION_b.SR) {
+		return FALSE;
+	}
+
+  /* If code mapping */
+  ring = (ETH_RX_DESC *)GLB_ConvertToMappingFromAddr((uint32_t)ring);
+  buf = ring;
+	do {
+		INNER_ETH_RX_DESC *desc = (INNER_ETH_RX_DESC *)buf;
+		desc->RX_1.RX1_b.RCH = TRUE;
+		desc->RX_1.RX1_b.DIC = FALSE;
+		desc->RX_0.RX0_b.OWN = ETH_DESC_OWN_BY_HW;
+
+    buf->bufAddr = GLB_ConvertToMappingFromAddr(buf->bufAddr);
+    buf->nextDescAddr = GLB_ConvertToMappingFromAddr(buf->nextDescAddr);
+		buf = (ETH_RX_DESC *)buf->nextDescAddr;
+	} while (buf != ring);
+	
+	ETH->RDESLA = (uint32_t)ring;
+ 
+	return TRUE;
+}
+
+void ETH_StartRx() {
+	ETH->OPERATION_b.SR = TRUE;
+}
+
+void ETH_StopRx() {
+	ETH->OPERATION_b.SR = FALSE;
+}
+
+void ETH_ResumeRx() {
+	ETH->RPD = 0;
+}
+
+ETH_RX_DESC *ETH_AcquireFreeRxDesc(void) {
+	uint32_t cur = ETH->CURRDESAPTR;
+	INNER_ETH_RX_DESC *desc = (INNER_ETH_RX_DESC *)cur;
+	
+	do {
+		if (desc->RX_0.RX0_b.OWN == ETH_DESC_OWN_BY_SELF) {
+			return (ETH_RX_DESC *)desc;
+		}
+		desc = (INNER_ETH_RX_DESC *)desc->nextDescAddr;
+	} while ((uint32_t)desc != cur);
+	
+  return 0;		
+}
+
+BOOL ETH_IsFreeRxDesc(ETH_RX_DESC *desc) {
+	INNER_ETH_RX_DESC *inner;
+	
+	if (!desc) {
+		return FALSE;
+	}
+	
+	inner = (INNER_ETH_RX_DESC *)desc;
+	return (inner->RX_0.RX0_b.OWN == ETH_DESC_OWN_BY_SELF) ? TRUE : FALSE;
+}
+
+void ETH_ReleaseRxDesc(ETH_RX_DESC *desc) {
+	INNER_ETH_RX_DESC *inner;
+	
+	if (!desc) {
+		return;
+	}
+	
+	inner = (INNER_ETH_RX_DESC *)desc;
+	inner->RX_0.RX0_b.OWN = ETH_DESC_OWN_BY_HW;
+}
+
+
+void ETH_SetRxDescBufAddr(ETH_RX_DESC *desc, uint32_t bufAddr) {
+	if (desc) {
+		desc->bufAddr = GLB_ConvertToMappingFromAddr(bufAddr);;
+	}
+}
+
+uint32_t ETH_GetRxDescBufAddr(ETH_RX_DESC *desc) {
+  return (desc ? GLB_ConvertToMappingToAddr(desc->bufAddr) : 0);
+}
+
+
+

+ 400 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_flash.c

@@ -0,0 +1,400 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_flash.c
+	*
+	* @brief    CMEM7 flash controller source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_flash.h"
+
+typedef struct {
+  union {
+    uint16_t  STATUS;                         /*!< status register                     */
+    
+    struct {
+      uint16_t  WIP:  1;                      /*!< in writting                         */
+      uint16_t  WEL:  1;                      /*!< write enable                        */
+      uint16_t  BP:  5;                       /*!< protection region                   */
+      uint16_t  SRP:  2;                      /*!< protection mode                     */
+      uint16_t  QE:  1;                       /*!< Quad mode                           */
+    } STATUS_b;                               /*!< BitSize                             */
+  } INNER;
+} FLASH_INNER_STATUS;
+
+
+#define NS_IN_A_SECOND                            (1000000000)
+
+#define FLASH_MAX_SIZE                            0x800000
+#define FLASH_PAGE_SIZE                           0x100
+#define FLASH_SECTOR_SIZE                         0x001000
+#define FLASH_BLOCK_32K_SIZE                      0x008000
+#define FLASH_BLOCK_64K_SIZE                      0x010000
+
+#define FLASH_CMD_RD_INNER_STATUS_LOW             0x05
+#define FLASH_CMD_RD_INNER_STATUS_HIGH            0x35
+
+#define FLASH_CMD_WR_WRITE_ENABLE                 0x06
+#define FLASH_CMD_WR_WRITE_DISABLE                0x04
+
+#define FLASH_CME_WR_STATUS_REG                   0x01
+
+#define FLASH_CME_ERASE_SECTOR                    0x20
+#define FLASH_CME_ERASE_BLOCK_32K                 0x52
+#define FLASH_CME_ERASE_BLOCK_64K                 0xD8
+#define FLASH_CME_ERASE_CHIP                      0xC7
+
+#define FLASH_CME_WR_ENTER_DEEP_PD                0xB9
+#define FLASH_CME_WR_EXIT_DEEP_PD                 0xAB
+
+#define FLASH_CME_RD_NORMAL                       0x03
+#define FLASH_CME_RD_FAST                         0x0B
+#define FLASH_CME_RD_FAST_DUAL                    0x3B
+#define FLASH_CME_RD_FAST_QUAD                    0x6B
+
+#define FLASH_CME_WR                              0x02
+
+typedef void (*WAIT)(void);
+static WAIT wait;
+
+static void flash_setClock(uint8_t dividor) {
+	dividor = (dividor < 2) ? 2 : dividor;
+	NOR_FLASH->CTRL0_b.DIV = dividor / 2 - 1;
+}
+
+static void flash_cleanOperation() {
+	NOR_FLASH->TRIGGER_b.OP_CLEAN = TRUE;	
+	while (NOR_FLASH->STATUS_b.BUSY);
+	
+	NOR_FLASH->TRIGGER_b.OP_CLEAN = FALSE;	
+	while (NOR_FLASH->STATUS_b.BUSY);
+}
+
+static uint8_t flash_ReadInnerStatusLow() {
+	NOR_FLASH->CTRL0_b.RW_BYTE_CNT = 1;
+	NOR_FLASH->CTRL1_b.CMD = FLASH_CMD_RD_INNER_STATUS_LOW;
+	NOR_FLASH->TRIGGER_b.OP_START = TRUE;
+	
+	while (NOR_FLASH->STATUS_b.BUSY);
+	
+	return (uint8_t)NOR_FLASH->DATA;
+}
+
+static uint8_t flash_ReadInnerStatusHigh() {
+  NOR_FLASH->CTRL0_b.RW_BYTE_CNT = 1;
+	NOR_FLASH->CTRL1_b.CMD = FLASH_CMD_RD_INNER_STATUS_HIGH;
+	NOR_FLASH->TRIGGER_b.OP_START = TRUE;
+	
+	while (NOR_FLASH->STATUS_b.BUSY);
+	
+	return (uint8_t)NOR_FLASH->DATA;	
+}
+
+//static void flash_WaitInWritting() {
+void flash_WaitInWritting(void) {
+	FLASH_INNER_STATUS s;
+	
+	while (NOR_FLASH->STATUS_b.BUSY);
+	
+	do {
+		s.INNER.STATUS = flash_ReadInnerStatusLow();
+		if (!s.INNER.STATUS_b.WIP) {
+			break;
+		}
+		
+		if (wait) {
+			(*wait)();
+		}
+	} while (1);
+}
+
+static void flash_WriteWriteEnable(BOOL enable) {
+  NOR_FLASH->CTRL0_b.RW_BYTE_CNT = 0;
+	NOR_FLASH->CTRL1_b.CMD = 
+	  enable ? FLASH_CMD_WR_WRITE_ENABLE : FLASH_CMD_WR_WRITE_DISABLE;
+	
+	NOR_FLASH->TRIGGER_b.OP_START = TRUE;
+	
+	flash_WaitInWritting();
+}
+
+static void flash_WriteStatusReg(FLASH_INNER_STATUS *s) {
+  uint16_t tmp = s->INNER.STATUS;
+	
+	NOR_FLASH->CTRL0_b.RW_BYTE_CNT = 2;
+	NOR_FLASH->CTRL1_b.CMD = FLASH_CME_WR_STATUS_REG;
+	NOR_FLASH->DATA = ((tmp << 8) | (tmp >> 8)) << 16;
+	NOR_FLASH->TRIGGER_b.OP_START = TRUE;
+	
+	flash_WaitInWritting();
+}
+
+static void flash_Erase(uint8_t cmd, uint32_t addr) {	
+	NOR_FLASH->CTRL0_b.RW_BYTE_CNT = 0;
+	NOR_FLASH->CTRL1_b.CMD = cmd;
+	NOR_FLASH->CTRL1_b.ADDRESS = addr;
+	NOR_FLASH->TRIGGER_b.OP_START = TRUE;
+	
+	flash_WaitInWritting();
+}
+
+static void flash_WriteDeepPowerDownEnable(BOOL enable) {
+  NOR_FLASH->CTRL0_b.RW_BYTE_CNT = 0;
+	NOR_FLASH->CTRL1_b.CMD = 
+	  enable ? FLASH_CME_WR_ENTER_DEEP_PD : FLASH_CME_WR_EXIT_DEEP_PD;
+	
+	NOR_FLASH->TRIGGER_b.OP_START = TRUE;
+	
+	flash_WaitInWritting();
+}
+
+static void flash_RwReq(uint8_t cmd, uint32_t addr, uint16_t size) {
+	NOR_FLASH->CTRL0_b.RW_BYTE_CNT = size;
+	NOR_FLASH->CTRL1_b.CMD = cmd;
+	NOR_FLASH->CTRL1_b.ADDRESS = addr;
+	
+	NOR_FLASH->TRIGGER_b.OP_START = TRUE;
+}
+
+//static void flash_WaitReadFifoNotEmpty() {
+void flash_WaitReadFifoNotEmpty(void) {
+	while (NOR_FLASH->STATUS_b.RD_FIFO_EMPTY) {
+		if (wait) {
+			(*wait)();
+		}
+	}
+}
+
+//static uint16_t flash_ReadFifo(uint16_t size, uint8_t* data) {
+uint16_t flash_ReadFifo(uint16_t size, uint8_t* data) {
+	uint16_t count = 0;
+	
+	while (!NOR_FLASH->STATUS_b.RD_FIFO_EMPTY && size != 0) {
+  	uint32_t d =	NOR_FLASH->DATA;
+		if (size > 3) {
+			*(data + count++) = d >> 24;
+			*(data + count++) = (d & 0x00FF0000) >> 16;
+			*(data + count++) = (d & 0x0000FF00) >> 8;
+			*(data + count++) = (d & 0x000000FF);
+			size -= 4;
+		} else if (size == 3) {
+			*(data + count++) = (d & 0x00FF0000) >> 16;
+			*(data + count++) = (d & 0x0000FF00) >> 8;
+			*(data + count++) = (d & 0x000000FF);
+			size -= 3;
+		} else if (size == 2) {
+			*(data + count++) = (d & 0x0000FF00) >> 8;
+			*(data + count++) = (d & 0x000000FF);
+			size -= 2;
+		} else if (size == 1) {
+			*(data + count++) = (d & 0x000000FF);
+			size -= 1;
+		}
+	}
+	
+	return count;
+}
+
+static uint16_t flash_WriteFifo(uint16_t size, uint8_t* data) {
+	uint16_t count = 0;
+	
+	while (!NOR_FLASH->STATUS_b.WR_FIFO_FULL && size != 0) { 	
+		uint32_t d = 0;
+		
+		if (size > 3) {
+			d = *(data + count++) << 24;
+			d |= *(data + count++) << 16;
+			d |= *(data + count++) << 8;
+			d |= *(data + count++);
+			size -= 4;
+		} else if (size == 3) {
+			d = *(data + count++) << 24;
+			d |= *(data + count++) << 16;
+			d |= *(data + count++) << 8;
+			size -= 3;
+		} else if (size == 2) {
+			d = *(data + count++) << 24;
+			d |= *(data + count++) << 16;
+			size -= 2;
+		} else if (size == 1) {
+			d = *(data + count++) << 24;
+			size -= 1;
+		}
+		
+		NOR_FLASH->DATA = d;		
+	}
+	
+	return count;
+}
+
+static uint16_t flash_WritePage(uint32_t addr, uint16_t size, uint8_t* data) {
+	uint16_t actualSize, retSize;
+  
+	flash_WriteWriteEnable(TRUE);
+	
+	actualSize = FLASH_PAGE_SIZE - (addr & (FLASH_PAGE_SIZE - 1)); 
+	actualSize = (size > actualSize) ? actualSize : size;
+  retSize = actualSize;
+	
+	flash_RwReq(FLASH_CME_WR, addr, actualSize);
+	
+	while (actualSize != 0) {
+		uint8_t count = flash_WriteFifo(actualSize, data);
+		
+		actualSize -= count;
+		data += count;
+	}
+	
+	flash_WaitInWritting();
+	
+	return retSize;
+}
+
+void FLASH_Init(FLASH_InitTypeDef* init) {
+	FLASH_INNER_STATUS s;
+	
+	assert_param(init);
+	assert_param(IS_FLASH_PROTECT_MODE(init->FLASH_ProtectMode));
+	assert_param(IS_FLASH_PROTECT_REGION(init->FLASH_ProtectRegion));
+	
+	wait = init->FLASH_Wait;
+	flash_setClock(init->FLASH_ClockDividor);
+	
+	flash_cleanOperation();
+	
+	flash_WaitInWritting();
+	
+	s.INNER.STATUS = flash_ReadInnerStatusLow();
+	s.INNER.STATUS |= ((uint16_t)flash_ReadInnerStatusHigh()) << 8;
+	s.INNER.STATUS_b.BP = init->FLASH_ProtectRegion;
+	s.INNER.STATUS_b.SRP = init->FLASH_ProtectMode;
+	s.INNER.STATUS_b.QE = init->FLASH_QuadEnable;
+
+	flash_WriteWriteEnable(TRUE);
+	flash_WriteStatusReg(&s);
+}
+
+void FLASH_GetStatus(uint8_t* ProtectMode, uint8_t* ProtectRegion, BOOL* QuadEnable) {
+	FLASH_INNER_STATUS s;
+	
+	assert_param(ProtectMode);
+	assert_param(ProtectRegion);
+	assert_param(QuadEnable);
+	
+	flash_WaitInWritting();
+	
+	s.INNER.STATUS = flash_ReadInnerStatusLow();
+	s.INNER.STATUS |= ((uint16_t)flash_ReadInnerStatusHigh()) << 8;
+	*ProtectRegion = s.INNER.STATUS_b.BP;
+	*ProtectMode = s.INNER.STATUS_b.SRP;
+	*QuadEnable = (s.INNER.STATUS_b.QE == 1) ?  TRUE : FALSE;
+}
+
+void FLASH_EraseSector(uint32_t addr) {
+	flash_WaitInWritting();
+	flash_WriteWriteEnable(TRUE);
+	
+	addr = (addr << 8) >> 8;
+	addr = addr / FLASH_SECTOR_SIZE * FLASH_SECTOR_SIZE;
+	flash_Erase(FLASH_CME_ERASE_SECTOR, addr);
+}
+
+void FLASH_Erase32kBlock(uint32_t addr) {
+	flash_WaitInWritting();
+	flash_WriteWriteEnable(TRUE);
+	
+	addr = (addr << 8) >> 8;
+	addr = addr / FLASH_BLOCK_32K_SIZE * FLASH_BLOCK_32K_SIZE;
+	flash_Erase(FLASH_CME_ERASE_BLOCK_32K, addr);
+}
+
+void FLASH_Erase64kBlock(uint32_t addr) {
+	flash_WaitInWritting();
+	flash_WriteWriteEnable(TRUE);
+	
+	addr = (addr << 8) >> 8;
+	addr = addr / FLASH_BLOCK_64K_SIZE * FLASH_BLOCK_64K_SIZE;
+	flash_Erase(FLASH_CME_ERASE_BLOCK_64K, addr);
+}
+
+void FLASH_EraseChip(void) {
+	flash_WaitInWritting();
+	flash_WriteWriteEnable(TRUE);
+	flash_Erase(FLASH_CME_ERASE_CHIP, 0x0);
+}
+
+void FLASH_EnableDeepPowerDown(BOOL enable) {
+	flash_WaitInWritting();
+	flash_WriteWriteEnable(TRUE);
+	flash_WriteDeepPowerDownEnable(enable);
+}
+
+void FLASH_Read(uint8_t ReadMode, uint32_t addr, uint16_t size, uint8_t* data) {
+	uint8_t cmd;
+	
+	assert_param(IS_FLASH_READ_MODE(ReadMode));
+	assert_param(addr + size <= FLASH_MAX_SIZE);
+	assert_param(data);
+	
+	if (size == 0) {
+		return ;
+	}
+	
+	flash_WaitInWritting();
+	
+	if (ReadMode == FLASH_READ_MODE_NORMAL) {
+		cmd = FLASH_CME_RD_NORMAL;
+	} else if (ReadMode == FLASH_READ_MODE_FAST) {
+		cmd = FLASH_CME_RD_FAST;
+	} else if (ReadMode == FLASH_READ_MODE_FAST_DUAL) {
+		cmd = FLASH_CME_RD_FAST_DUAL;
+	} else {
+		cmd = FLASH_CME_RD_FAST_QUAD;
+	}
+	
+	flash_RwReq(cmd, addr, size);
+	
+  while (size > 0) {
+		uint16_t count = 0;
+		
+    flash_WaitReadFifoNotEmpty();
+	
+	  count = flash_ReadFifo(size, data);
+		size -= count;
+		data += count;
+	}
+}
+
+void FLASH_Write(uint32_t addr, uint16_t size, uint8_t* data) {
+	assert_param(addr + size <= FLASH_MAX_SIZE);
+	assert_param(data);
+	
+	flash_WaitInWritting();
+	
+	while (size > 0) {
+	  uint16_t count = flash_WritePage(addr, size, data);
+
+		addr += count;
+		size -= count;
+		data += count;
+	}
+}
+

+ 256 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_gpio.c

@@ -0,0 +1,256 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_gpio.c
+	*
+	* @brief    CMEM7 GPIO source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_gpio.h"
+
+#define GPIO_GROUP_GPIO_H 					(GPIO_GROUP_GPIO + 1)
+#define GPIO_GROUP_GPIO_N 					(GPIO_GROUP_GPIO + 2)
+
+#define IS_INNER_GPIO_GROUP(GROUP)  (((GROUP) == GPIO_GROUP_GPIO) || \
+																			((GROUP) == GPIO_GROUP_GPIO_H) || \
+																			((GROUP) == GPIO_GROUP_GPIO_N))
+
+#define GPIO_PWM_CHANNEL_GPIO_H_9 	(GPIO_PWM_CHANNEL_GPIO_31 + 1)
+#define GPIO_PWM_CHANNEL_GPIO_H_19 	(GPIO_PWM_CHANNEL_GPIO_31 + 2)
+#define GPIO_PWM_CHANNEL_GPIO_H_20 	(GPIO_PWM_CHANNEL_GPIO_31 + 3)
+        
+#define IS_INNER_GPIO_PWM_CHANNEL(CHANNEL)  (((CHANNEL) == GPIO_PWM_CHANNEL_GPIO_31) || \
+                                       ((CHANNEL) == GPIO_PWM_CHANNEL_GPIO_H_9) || \
+                                       ((CHANNEL) == GPIO_PWM_CHANNEL_GPIO_H_19) || \
+                                       ((CHANNEL) == GPIO_PWM_CHANNEL_GPIO_H_20))
+static uint32_t gpio_GetClock() {
+	return SYSTEM_CLOCK_FREQ / (1 << (GLOBAL_CTRL->CLK_SEL_0_b.GPIO_CLK + 1));
+}
+
+void GPIO_Init(uint8_t Group, uint32_t PositiveTrigger) {
+	assert_param(IS_GPIO_GROUP(Group));
+	
+	if (Group == GPIO_GROUP_GPIO) {
+	  GPIO->GPIO_POSITIVE_EDGE_INT_TRIGGER = PositiveTrigger;
+	} else if (Group == GPIO_GROUP_GPIO_H) {
+		GPIO->GPIO_H_POSITIVE_EDGE_INT_TRIGGER = PositiveTrigger;
+	} else {
+		GPIO->GPIO_N_POSITIVE_EDGE_INT_TRIGGER = PositiveTrigger;
+	}
+}
+
+void GPIO_EnableOutput(uint8_t Group, uint32_t Enable) {
+	assert_param(IS_GPIO_GROUP(Group));
+	
+	if (Group == GPIO_GROUP_GPIO) {
+	  GPIO->GPIO_OE = Enable;
+	} else if (Group == GPIO_GROUP_GPIO_H) {
+		GPIO->GPIO_H_OE = Enable;
+	} else {
+		GPIO->GPIO_N_OE = Enable;
+	}
+}
+
+void GPIO_EnableInt(uint8_t Group, uint32_t Enable) {
+	assert_param(IS_GPIO_GROUP(Group));
+	
+	if (Group == GPIO_GROUP_GPIO) {
+	  GPIO->GPIO_INT_MASK = ~Enable;
+	} else if (Group == GPIO_GROUP_GPIO_H) {
+		GPIO->GPIO_H_INT_MASK = ~Enable;
+	} else {
+		GPIO->GPIO_N_INT_MASK = ~Enable;
+	}
+}
+
+uint32_t GPIO_GetIntStatus(uint8_t Group) {
+	assert_param(IS_GPIO_GROUP(Group));
+	
+	if (Group == GPIO_GROUP_GPIO) {
+	  return GPIO->GPIO_INT_STATUS;
+	} else if (Group == GPIO_GROUP_GPIO_H) {
+		return GPIO->GPIO_H_INT_STATUS;
+	} 
+	
+	return GPIO->GPIO_N_INT_STATUS;
+}
+
+void GPIO_ClearInt(uint8_t Group, uint32_t Clear) {
+	assert_param(IS_GPIO_GROUP(Group));
+	
+	if (Group == GPIO_GROUP_GPIO) {
+	  GPIO->GPIO_INT_STATUS = Clear;
+	} else if (Group == GPIO_GROUP_GPIO_H) {
+		GPIO->GPIO_H_INT_STATUS = Clear;
+	} else {
+		GPIO->GPIO_N_INT_STATUS = Clear;
+	}
+}
+
+uint32_t GPIO_Read(uint8_t Group) {
+  uint32_t data;
+	
+	assert_param(IS_GPIO_GROUP(Group));
+	
+	if (Group == GPIO_GROUP_GPIO) {
+	  data = GPIO->GPIO_IN;
+	} else if (Group == GPIO_GROUP_GPIO_H) {
+		data = GPIO->GPIO_H_IN;
+	} else {
+		data = GPIO->GPIO_N_IN;
+	}
+	
+	return data;
+}
+
+void GPIO_Write(uint8_t Group, uint32_t Unmask, uint32_t data) {
+	assert_param(IS_GPIO_GROUP(Group));
+	
+	if (Group == GPIO_GROUP_GPIO) {
+		GPIO->GPIO_OUT_UNMASK = Unmask;
+	  GPIO->GPIO_OUT_DATA = data;
+	} else if (Group == GPIO_GROUP_GPIO_H) {
+		GPIO->GPIO_H_OUT_UNMASK = Unmask;
+	  GPIO->GPIO_H_OUT_DATA = data;
+	} else {
+		GPIO->GPIO_N_OUT_UNMASK = Unmask;
+	  GPIO->GPIO_N_OUT_DATA = data;
+	}
+}
+
+void GPIO_InitPwm(uint8_t Channel, uint32_t HighLevelNanoSecond, uint32_t LowLevelNanoSecond) {
+	uint16_t lowTick, highTick;
+	
+	assert_param(IS_GPIO_PWM_CHANNEL(Channel));
+	
+	lowTick = LowLevelNanoSecond * (gpio_GetClock() / 1000000) / 1000;
+	highTick = HighLevelNanoSecond * (gpio_GetClock() / 1000000) / 1000;
+	lowTick = (lowTick < 1) ? lowTick : lowTick - 1;
+	highTick = (highTick < 1) ? highTick : highTick - 1;
+	
+	if (Channel == GPIO_PWM_CHANNEL_GPIO_31) {
+		GPIO->PWM_OUT0_LEN_b.LOW_LEVEL_TICK = lowTick; 
+		GPIO->PWM_OUT0_LEN_b.HIGH_LEVEL_TICK = highTick; 
+	} else if (Channel == GPIO_PWM_CHANNEL_GPIO_H_9) {
+		GPIO->PWM_OUT1_LEN_b.LOW_LEVEL_TICK = lowTick; 
+		GPIO->PWM_OUT1_LEN_b.HIGH_LEVEL_TICK = highTick; 
+	} else if (Channel == GPIO_PWM_CHANNEL_GPIO_H_19) {
+		GPIO->PWM_OUT2_LEN_b.LOW_LEVEL_TICK = lowTick; 
+		GPIO->PWM_OUT2_LEN_b.HIGH_LEVEL_TICK = highTick; 
+  } else {
+		GPIO->PWM_OUT3_LEN_b.LOW_LEVEL_TICK = lowTick; 
+		GPIO->PWM_OUT3_LEN_b.HIGH_LEVEL_TICK = highTick; 
+	}
+}
+
+void GPIO_EnablePwm(uint8_t Channel, BOOL Enable) {
+	assert_param(IS_GPIO_PWM_CHANNEL(Channel));
+	
+	if (Channel == GPIO_PWM_CHANNEL_GPIO_31) {
+		GPIO->PWM_OUT_EN_b.GPIO_31 = Enable; 
+		GPIO->PWM_OUT_SEL_b.GPIO_31 = Enable; 
+	} else if (Channel == GPIO_PWM_CHANNEL_GPIO_H_9) {
+		GPIO->PWM_OUT_EN_b.GPIO_H_9 = Enable; 
+		GPIO->PWM_OUT_SEL_b.GPIO_H_9 = Enable;
+	} else if (Channel == GPIO_PWM_CHANNEL_GPIO_H_19) {
+		GPIO->PWM_OUT_EN_b.GPIO_H_19 = Enable;
+	GPIO->PWM_OUT_SEL_b.GPIO_H_19 = Enable;		
+  } else {
+		GPIO->PWM_OUT_EN_b.GPIO_H_20 = Enable; 
+		GPIO->PWM_OUT_SEL_b.GPIO_H_20 = Enable;
+	}
+}
+
+/**
+   xjf 20150324
+   
+**/
+void GPIO_SetBits(uint32_t mask)
+{
+  static uint32_t g_GPIO_OUT_UNMASK;
+  static uint32_t g_GPIO_OUT_DATA;
+  static uint32_t g_GPIO_OE;
+	
+	g_GPIO_OUT_UNMASK = GPIO->GPIO_OUT_UNMASK ;
+  g_GPIO_OUT_DATA   = GPIO->GPIO_OUT_DATA   ;
+	g_GPIO_OE         = GPIO->GPIO_OE ;
+  g_GPIO_OUT_UNMASK |=mask;  
+  g_GPIO_OE         |=mask;
+	g_GPIO_OUT_DATA   |=mask;
+	
+	GPIO->GPIO_OUT_UNMASK =g_GPIO_OUT_UNMASK ;
+  GPIO->GPIO_OUT_DATA   =g_GPIO_OUT_DATA ;
+	GPIO->GPIO_OE         =g_GPIO_OE       ;
+}
+
+void GPIO_clrBits(uint32_t mask)
+{
+  static uint32_t g_GPIO_OUT_UNMASK;
+  static uint32_t g_GPIO_OUT_DATA;
+  static uint32_t g_GPIO_OE;
+	
+	g_GPIO_OUT_UNMASK = GPIO->GPIO_OUT_UNMASK ;
+  g_GPIO_OUT_DATA   = GPIO->GPIO_OUT_DATA   ;
+	g_GPIO_OE         = GPIO->GPIO_OE ;
+  g_GPIO_OUT_UNMASK |=mask;  
+  g_GPIO_OE         |=mask;
+	g_GPIO_OUT_DATA   &=(~ mask);
+	
+	GPIO->GPIO_OUT_UNMASK =g_GPIO_OUT_UNMASK ;
+  GPIO->GPIO_OUT_DATA   =g_GPIO_OUT_DATA ;
+	GPIO->GPIO_OE         =g_GPIO_OE       ;
+}
+
+uint32_t GPIO_getBits(uint32_t mask)
+{
+  static uint32_t g_GPIO_OUT_UNMASK;
+  //static uint32_t g_GPIO_OUT_DATA;
+  static uint32_t g_GPIO_OE;
+	
+	uint32_t  get_delay = 0;
+	uint32_t  saved_mask;
+	
+	saved_mask=mask;
+	
+	g_GPIO_OUT_UNMASK      = GPIO->GPIO_OUT_UNMASK ;
+	g_GPIO_OE              = GPIO->GPIO_OE ;
+  g_GPIO_OUT_UNMASK     &=(~mask);  
+  g_GPIO_OE             &=(~mask);
+	GPIO->GPIO_OUT_UNMASK  =g_GPIO_OUT_UNMASK ;
+	GPIO->GPIO_OE          =g_GPIO_OE       ;
+	for(get_delay=0;get_delay<100;get_delay++)
+	  {
+    }
+	//get_delay=(GPIO->GPIO_IN)&saved_mask;
+  if(((GPIO->GPIO_IN)&saved_mask)==saved_mask)	
+	   {
+			 return(1);
+	    }		
+	else
+   	{
+			return(0);
+    }
+	
+}
+/**
+   xjf 20150324
+   
+**/

+ 321 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_i2c.c

@@ -0,0 +1,321 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_i2c.c
+	*
+	* @brief    CMEM7 I2C source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_i2c.h"
+
+#define I2C_INNER_INT_ALL				0x3FF
+
+typedef struct {
+	union {
+    uint32_t  DATA_CMD;                                                           
+    
+    struct {
+      uint32_t  DATA       :  8;                                                                   
+      uint32_t  RD_CMD     :  1;              
+      uint32_t  WR_CMD     :  1;                
+      uint32_t  WR_RD_CMD  :  1;               
+    } DATA_CMD_b;                                   
+  } INNER;
+} I2C_INNER_DATA_CMD;
+
+static uint32_t i2c_GetClock(I2C0_Type* I2Cx) {
+	uint32_t dividor;
+
+	if ((uint32_t)I2Cx == (uint32_t)I2C0) {
+		dividor = GLOBAL_CTRL->CLK_SEL_0_b.I2C0_CLK;
+	} else if ((uint32_t)I2Cx == (uint32_t)I2C1) {
+		dividor = GLOBAL_CTRL->CLK_SEL_0_b.I2C1_CLK;
+	} 
+	
+	return SYSTEM_CLOCK_FREQ / (1 << (dividor + 1));
+}
+
+static uint16_t i2c_NormalizeAddr(I2C0_Type* I2Cx, uint16_t addr) {
+  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	
+	if (I2Cx->CTRL_b.MODE == I2C_Mode_Master) {
+		if (I2Cx->CTRL_b.MASTER_ADDR_WIDTH == I2C_ADDR_WIDTH_7BIT) {
+			addr &= 0x007F;
+		} else {
+			addr &= 0x3FF;
+		}
+	}
+	
+	if (I2Cx->CTRL_b.MODE == I2C_Mode_Slave) {
+		if (I2Cx->CTRL_b.SLAVE_ADDR_WIDTH == I2C_ADDR_WIDTH_7BIT) {
+			addr &= 0x007F;
+		} else {
+			addr &= 0x3FF;
+		}
+	}
+	
+	return addr;
+}
+
+static void i2c_ReadClear(uint32_t bit) {
+	uint32_t tmp;
+	tmp = bit;
+	tmp = tmp;	
+}
+		
+void I2C_Init(I2C0_Type* I2Cx, I2C_InitTypeDef* I2C_Init) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(I2C_Init);
+	assert_param(IS_I2C_MODE(I2C_Init->I2C_Mode));
+	assert_param(IS_I2C_ADDR_WIDTH(I2C_Init->I2C_AddressWidth));
+	
+	// reset
+	I2Cx->ENABLE_b.RESET = FALSE;
+	I2Cx->ENABLE_b.RESET = TRUE;
+	
+	// clear interrupt
+	I2Cx->INT_MASK = I2C_INNER_INT_ALL;
+	i2c_ReadClear(I2Cx->CLR_ALL_INT_b.CLEAR);
+	
+	I2Cx->CTRL_b.MODE = I2C_Init->I2C_Mode;
+	if (I2Cx->CTRL_b.MODE == I2C_Mode_Master) {
+	  I2Cx->CTRL_b.MASTER_ADDR_WIDTH = I2C_Init->I2C_AddressWidth;
+		I2Cx->TAR_b.START_BYTE = TRUE;
+		I2Cx->TAR_b.ADDR10 = i2c_NormalizeAddr(I2Cx, I2C_Init->I2C_Address);
+	}
+	if (I2Cx->CTRL_b.MODE == I2C_Mode_Slave) {
+	  I2Cx->CTRL_b.SLAVE_ADDR_WIDTH = I2C_Init->I2C_AddressWidth;
+		I2Cx->SAR_b.ADDR10 = i2c_NormalizeAddr(I2Cx, I2C_Init->I2C_Address);
+	}
+	
+	I2Cx->RX_TL_b.THRESHOLD = 0;
+	I2Cx->TX_TL_b.THRESHOLD = 0;
+	
+	I2Cx->SLAVE_NACK_b.NACK = FALSE;
+	
+	if (I2C_Init->timing) {
+		I2Cx->SCL_CNT_b.HIGH_LEVEL_TICK = 
+		  i2c_GetClock(I2Cx) / I2C_Init->timing->I2C_Freq / 2;
+		I2Cx->SCL_CNT_b.LOW_LEVEL_TICK = 
+		  i2c_GetClock(I2Cx) / I2C_Init->timing->I2C_Freq / 2;
+	  I2Cx->SDA_SETUP_b.TSU_DAT = ((uint64_t)I2C_Init->timing->I2C_TsuDat) * 
+		  i2c_GetClock(I2Cx) / 1000000000;
+		I2Cx->SDA_SETUP_b.TSETUP = ((uint64_t)I2C_Init->timing->I2C_Tsetup) * 
+		  i2c_GetClock(I2Cx) / 1000000000;
+		I2Cx->TSU_STA_SETUP_b.TBUF = ((uint64_t)I2C_Init->timing->I2C_Tbuf) * 
+		  i2c_GetClock(I2Cx) / 1000000000;
+	  I2Cx->TSU_STA_SETUP_b.TSU_STA = ((uint64_t)I2C_Init->timing->I2C_TsuSta) * 
+		  i2c_GetClock(I2Cx) / 1000000000;
+		I2Cx->TSU_STA_SETUP_b.SDA_FILTER_EN = I2C_Init->timing->I2C_SdaFilterEn;
+		I2Cx->TSU_STA_SETUP_b.SDA_FILTER_CNT = I2C_Init->timing->I2C_SdaFilterSpike;
+		I2Cx->TSU_STA_SETUP_b.SCL_FILTER_EN = I2C_Init->timing->I2C_SclFilterEn;
+		I2Cx->TSU_STA_SETUP_b.SCL_FILTER_CNT = I2C_Init->timing->I2C_SclFilterSpike;
+  }
+}
+
+void I2C_Enable(I2C0_Type* I2Cx, BOOL enable) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	
+  I2Cx->ENABLE_b.EN = enable;
+}
+
+void I2C_EnableInt(I2C0_Type* I2Cx, uint32_t Int, BOOL enable) {
+  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(IS_I2C_INT(Int));
+	
+  if (enable) {
+	  I2Cx->INT_MASK &= ~Int;
+	} else {
+		I2Cx->INT_MASK |= Int;
+	}
+}
+
+BOOL I2C_GetIntStatus(I2C0_Type* I2Cx, uint32_t Int) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(IS_I2C_INT(Int));
+	
+	if (0 != (I2Cx->INT_STATUS & Int)) {
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+void I2C_ClearInt(I2C0_Type* I2Cx, uint32_t Int) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(IS_I2C_INT(Int));
+	
+	if (Int == I2C_INT_RX_FIFO_NOT_EMPTY) {
+		// It can't be clear by sw but read data
+	} 
+	
+	if (Int == I2C_INT_RD_REQUEST) {
+		i2c_ReadClear(I2Cx->CLR_RD_REQ_b.CLEAR);
+	} 
+	
+	if (Int == I2C_INT_TX_ABORT) {
+		i2c_ReadClear(I2Cx->CLR_TX_ABRT_b.CLEAR);
+	} 
+	
+	if (Int == I2C_INT_RX_DONE) {
+		i2c_ReadClear(I2Cx->CLR_RX_DONE_b.CLEAR);
+	} 
+	
+	if (Int == I2C_INT_TX_DONE) {
+		i2c_ReadClear(I2Cx->CLR_TX_DONE_b.CLEAR);
+	} 
+}
+
+BOOL I2C_GetStatus(I2C0_Type* I2Cx, uint32_t Status) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(IS_I2C_STATUS(Status));
+	
+	if (0 != (I2Cx->STATUS & Status)) {
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+
+void I2C_ClearStatus(I2C0_Type* I2Cx, uint32_t Status) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(IS_I2C_STATUS(Status));
+	
+	if (Status & I2C_STATUS_RX_FIFO_NOT_EMPTY) {
+		// It can't be clear by sw but read
+	} 
+	
+	if (Status & I2C_STATUS_RD_REQUEST) {
+		i2c_ReadClear(I2Cx->CLR_RD_REQ_b.CLEAR);
+	} 
+	
+	if (Status & I2C_STATUS_TX_ABORT) {
+		i2c_ReadClear(I2Cx->CLR_TX_ABRT_b.CLEAR);
+	} 
+	
+	if (Status & I2C_STATUS_RX_DONE) {
+		i2c_ReadClear(I2Cx->CLR_RX_DONE_b.CLEAR);
+	} 
+	
+	if (Status & I2C_STATUS_TX_DONE) {
+		i2c_ReadClear(I2Cx->CLR_TX_DONE_b.CLEAR);
+	} 
+}
+
+BOOL I2C_MasterReadReq(I2C0_Type* I2Cx, uint8_t size) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	
+	if (!I2Cx->ENABLE_b.EN || I2Cx->STATUS_b.BUSY) {
+		return FALSE;
+	}
+
+	if (I2Cx->CTRL_b.MODE == I2C_Mode_Slave) {
+	  return FALSE;
+	}
+	
+	if (size == 0) {
+		return FALSE;
+	}
+	
+	I2Cx->WRITE_READ_CNT_b.RD_BYTE_CNT = size;
+	if (size != 0) {
+    I2C_INNER_DATA_CMD inner;
+    
+    inner.INNER.DATA_CMD_b.DATA = 0;
+		inner.INNER.DATA_CMD_b.RD_CMD = TRUE;
+		inner.INNER.DATA_CMD_b.WR_CMD = FALSE;
+		inner.INNER.DATA_CMD_b.WR_RD_CMD = FALSE;
+		
+		I2Cx->DATA_CMD = inner.INNER.DATA_CMD;
+	}
+	
+	return TRUE;
+}
+
+uint8_t I2C_ReadFifo(I2C0_Type* I2Cx, uint8_t size, uint8_t* data) {
+	uint8_t count;
+	
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(data);
+	
+	if (!I2Cx->ENABLE_b.EN) {
+		return 0;
+	}
+	
+	count = 0;
+	while (I2Cx->STATUS_b.RX_FIFO_NOT_EMPTY && count < size) {
+		*(data + count++) = I2Cx->DATA_CMD_b.DATA;
+	}
+	
+	return count;
+}
+
+BOOL I2C_WriteReq(I2C0_Type* I2Cx, uint8_t size, uint8_t firstData) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	
+	if (!I2Cx->ENABLE_b.EN || I2Cx->STATUS_b.BUSY) {
+		return FALSE;
+	}
+	
+	if (size == 0) {
+		return FALSE;
+	}
+	
+	I2Cx->WRITE_READ_CNT_b.WR_BYTE_CNT = size;
+	if (size != 0) {
+    I2C_INNER_DATA_CMD inner;
+    
+    inner.INNER.DATA_CMD_b.DATA = firstData	;
+		inner.INNER.DATA_CMD_b.RD_CMD = FALSE;
+		inner.INNER.DATA_CMD_b.WR_CMD = 
+		  (I2Cx->CTRL_b.MODE == I2C_Mode_Slave) ? FALSE : TRUE;
+		inner.INNER.DATA_CMD_b.WR_RD_CMD = FALSE;
+
+		I2Cx->DATA_CMD = inner.INNER.DATA_CMD;
+	}
+
+	return TRUE;
+}
+
+uint8_t I2C_WriteFifo(I2C0_Type* I2Cx, uint8_t size, uint8_t* data) {
+	uint8_t count;
+	
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	assert_param(data);
+	
+	if (!I2Cx->ENABLE_b.EN) {
+		return 0;
+	}
+
+	count = 0;
+	while (I2Cx->STATUS_b.TX_FIFO_NOT_FULL && count < size) {
+	  I2Cx->DATA_CMD_b.DATA = *(data + count++);
+	}
+	
+	return count;	
+}
+
+BOOL I2C_StopReq(I2C0_Type* I2Cx) {
+	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+	
+	udelay(600);
+	
+	return TRUE;
+}

+ 183 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_misc.c

@@ -0,0 +1,183 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_misc.c
+	*
+	* @brief    CMEM7 miscellaneous file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#include "cmem7_misc.h"
+
+#define AIRCR_VECTKEY_MASK    ((uint32_t)0x05FA0000)
+
+void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup)
+{
+  /* Check the parameters */
+  assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup));
+  
+  /* Set the PRIGROUP[10:8] bits according to NVIC_PriorityGroup value */
+  SCB->AIRCR = AIRCR_VECTKEY_MASK | NVIC_PriorityGroup;
+}
+
+void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct)
+{
+  uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F;
+  
+  /* Check the parameters */
+  assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));  
+  assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));
+    
+  if (NVIC_InitStruct->NVIC_IRQChannelCmd != FALSE)
+  {
+    /* Compute the Corresponding IRQ Priority --------------------------------*/    
+    tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700))>> 0x08;
+    tmppre = (0x4 - tmppriority);
+    tmpsub = tmpsub >> tmppriority;
+
+    tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
+    tmppriority |=  NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
+    tmppriority = tmppriority << 0x04;
+        
+    NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;
+    
+    /* Enable the Selected IRQ Channels --------------------------------------*/
+    NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
+      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
+  }
+  else
+  {
+    /* Disable the Selected IRQ Channels -------------------------------------*/
+    NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
+      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
+  }
+}
+
+void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)
+{ 
+  /* Check the parameters */
+  assert_param(IS_NVIC_VECTTAB(NVIC_VectTab));
+  assert_param(IS_NVIC_OFFSET(Offset));  
+   
+  SCB->VTOR = NVIC_VectTab | (Offset & (uint32_t)0x1FFFFF80);
+}
+
+void NVIC_SystemLPConfig(uint8_t LowPowerMode, BOOL NewState)
+{
+  /* Check the parameters */
+  assert_param(IS_NVIC_LP(LowPowerMode));
+  
+  if (!NewState)
+  {
+    SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode);
+  } else {
+		SCB->SCR |= LowPowerMode;
+	}
+}
+
+#define DEF_IBUS_OFFSET     0x1FFE0000
+#define DEF_EXT_ADDR        0x08020000
+static BOOL isMappingOn() {
+  /* If default values aren't changed */
+  if ((GLOBAL_CTRL->IBUSOFF == DEF_IBUS_OFFSET) && 
+    (GLOBAL_CTRL->EXTADDR == DEF_EXT_ADDR)) {
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+void GLB_MMAP(uint32_t from, uint32_t to, BOOL isIcacheOn) {
+	volatile int n;
+	
+	GLOBAL_CTRL->IBUSOFF = GLOBAL_CTRL->DBUSOFF = (from - to);
+	GLOBAL_CTRL->EXTADDR = to;
+	
+	// Delay several cycles 
+	for (n = 0; n < 100; n++);
+	GLOBAL_CTRL->ICACHE_b.EN = isIcacheOn;
+	for (n = 0; n < 100; n++);
+}
+
+/*
+ * ------------------------------------------------------------------
+ * | 0 - 0x20000 | --> 0x20000000 | -> 0x40000000 | -> 0xFFFFFFFF   |
+ * |  code SRAM  | map to region  | data SRAM     | map from region |
+ * ------------------------------------------------------------------
+ */
+#define MAPPING_FROM_REGION_START   0x40000000
+#define MAPPING_TO_REGION_END       0x20000000
+uint32_t GLB_ConvertToMappingFromAddr(uint32_t to) {
+  if (!isMappingOn()) {
+    return to;
+  }
+  
+  if ((to > MAPPING_TO_REGION_END) || (to < GLOBAL_CTRL->EXTADDR)) {
+    return to;
+  }
+  
+  return (to + GLOBAL_CTRL->IBUSOFF);
+}
+
+uint32_t GLB_ConvertToMappingToAddr(uint32_t from) {
+  if (!isMappingOn()) {
+    return from;
+  }
+  
+  if (from < MAPPING_FROM_REGION_START) {
+    return from;
+  }
+  
+  return (from - GLOBAL_CTRL->IBUSOFF);
+}
+
+void GLB_SetNmiIrqNum(uint32_t irq) {
+	GLOBAL_CTRL->NMI_SEL_b.NMI = irq;
+}
+
+void GLB_SelectSysClkSource(uint8_t source) {
+	switch (source) {
+	case SYS_CLK_SEL_DLL :
+		// M7's DLL clock should be fixed at PLL loation 2
+		// In constrast, it's C2R1.
+		// Wait DLL clock stable
+		while (PDLOCK->GCLK_b.C2R1D == 0) ;
+		GLOBAL_CTRL->CLK_SEL_1_b.SYS_CLK = SYS_CLK_SEL_DLL;
+		break;
+	case SYS_CLK_SEL_CRYSTAL :
+		GLOBAL_CTRL->CLK_SEL_1_b.SYS_CLK = SYS_CLK_SEL_CRYSTAL;
+		break;
+	case SYS_CLK_SEL_EXTERNAL :
+		// TODO, Add the condition that makes sure input
+		// external clock is stable
+		// For example :
+		//	PLL location 0
+		// 	while (PDLOCK->GCLK_b.C1R1P == 0) ;
+		// 	DLL location 0
+		// 	while (PDLOCK->GCLK_b.C1R1D == 0) ;
+		GLOBAL_CTRL->CLK_SEL_1_b.SYS_CLK = SYS_CLK_SEL_EXTERNAL;
+		break;
+	case SYS_CLK_SEL_OSC :
+		// Fall through
+	default :
+		GLOBAL_CTRL->CLK_SEL_1_b.SYS_CLK = SYS_CLK_SEL_OSC;
+		break;		
+	}
+}

+ 63 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_rtc.c

@@ -0,0 +1,63 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_rtc.c
+	*
+	* @brief    CMEM7 RTC source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_rtc.h"
+
+#define SECONDS_IN_A_DAY                (86400)
+
+void RTC_ITConfig(uint32_t Int, BOOL Enable) {
+	assert_param(IS_RTC_INT(Int));  
+	
+	if (Enable) {
+	  GLOBAL_CTRL->RTC_INT_EN |= Int;
+	} else {
+		GLOBAL_CTRL->RTC_INT_EN &= ~Int;
+	}
+}
+
+BOOL RTC_GetITStatus(uint32_t Int) {
+	assert_param(IS_RTC_INT(Int)); 
+	
+	if (0 != (RTC->INT_STATUS & Int)) {
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+
+void RTC_ClearITPendingBit(uint32_t Int) {
+  assert_param(IS_RTC_INT(Int));  
+	
+	RTC->INT_STATUS = Int;
+}
+
+uint32_t RTC_GetSecond() {
+	return RTC->SECOND;
+}
+
+uint16_t RTC_GetMillSecond() {
+	return RTC->MILLSECOND_b.MS;
+}

+ 145 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_spi.c

@@ -0,0 +1,145 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_spi.c
+	*
+	* @brief    CMEM7 SPI source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_spi.h"
+
+void SPI_Init(SPI0_Type* SPIx, SPI_InitTypeDef *init) {
+	assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	assert_param(init);
+	assert_param(IS_SPI_MODE(init->SPI_Mode));
+	assert_param(init->SPI_BitLength != 0);
+	
+	if (init->SPI_Mode == SPI_MODE_CPOL_0_CPHA_0) {
+		SPIx->CTRL_b.CLK_HIGH = FALSE;
+		SPIx->CTRL_b.NEG_EDGE = TRUE;
+  } else if (init->SPI_Mode == SPI_MODE_CPOL_0_CPHA_1) {
+		SPIx->CTRL_b.CLK_HIGH = FALSE;
+		SPIx->CTRL_b.NEG_EDGE = FALSE;
+  } else if (init->SPI_Mode == SPI_MODE_CPOL_1_CPHA_0) {
+		SPIx->CTRL_b.CLK_HIGH = TRUE;
+		SPIx->CTRL_b.NEG_EDGE = FALSE;
+  } else {
+		SPIx->CTRL_b.CLK_HIGH = TRUE;
+		SPIx->CTRL_b.NEG_EDGE = TRUE;
+  } 		
+
+	SPIx->CTRL_b.RX_EN = init->SPI_RxEn;
+	SPIx->BCNT_b.CNT = init->SPI_BitLength - 1;
+	SPIx->DIV = init->SPI_ClockDividor;
+	SPIx->GAP = (init->SPI_Gap == 0) ? 0 : init->SPI_Gap / 2 + 1;
+}
+
+void SPI_Enable(SPI0_Type* SPIx, BOOL enable) {
+	assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	
+  SPIx->CTRL_b.EN = enable;
+}
+
+void SPI_EnableInt(SPI0_Type* SPIx, uint32_t Int, BOOL enable) {
+  assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	assert_param(IS_SPI_INT(Int));
+	
+  if (enable) {
+	  SPIx->INT_MASK &= ~Int;
+	} else {
+		SPIx->INT_MASK |= Int;
+	}
+	
+	SPIx->INT_MASK &= SPI_INT_ALL;
+}
+
+BOOL SPI_GetIntStatus(SPI0_Type* SPIx, uint32_t Int) {
+	assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	assert_param(IS_SPI_INT(Int));
+	
+	if (0 != (SPIx->INT_STATUS & Int)) {
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+void SPI_ClearInt(SPI0_Type* SPIx, uint32_t Int) {
+	assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	assert_param(IS_SPI_INT(Int));
+	
+	SPIx->INT_STATUS = Int;
+}
+
+uint8_t SPI_ReadFifo(SPI0_Type* SPIx, uint8_t size, uint32_t* data) {
+	uint8_t count;
+	
+	assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	assert_param(data);
+	
+	if (!SPIx->CTRL_b.EN) {
+		return 0;
+	}
+	
+	count = 0;
+	while (!SPIx->STATUS_b.RFIFO_EMPTY && count < size) {
+	  uint32_t d = SPIx->RW_DATA;
+	  d <<= (32 - SPIx->BCNT_b.CNT - 1);
+	  d >>= (32 - SPIx->BCNT_b.CNT - 1);
+		*(data + count++) = d;
+	}
+	
+	return count;
+}
+	
+uint8_t SPI_WriteFifo(SPI0_Type* SPIx, uint8_t Size, uint32_t* data) {
+	uint8_t count;
+	
+	assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	assert_param(data);
+	
+	if (!SPIx->CTRL_b.EN) {
+		return 0;
+	}
+	
+	count = 0;
+	while (!SPIx->STATUS_b.TFIFO_FULL && count < Size) {
+	  uint32_t d = *(data + count++);
+		d <<= (32 - SPIx->BCNT_b.CNT - 1);
+		SPIx->RW_DATA = d;
+	}
+	
+	return count;
+}
+
+BOOL SPI_Transcation(SPI0_Type* SPIx, uint8_t size) {
+	assert_param(IS_SPI_ALL_PERIPH(SPIx));
+	assert_param(size);
+	
+	if (!SPIx->CTRL_b.EN) {
+		return FALSE;
+	}
+	
+	SPIx->TRANS_CNT = size - 1;
+	SPIx->TRANS_START_b.TX_TRIGGER = TRUE;
+	
+	return TRUE;
+}
+

+ 80 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_tim.c

@@ -0,0 +1,80 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_tim.c
+	*
+	* @brief    CMEM7 timer source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_tim.h"
+
+static uint32_t tim_GetClock() {
+	return SYSTEM_CLOCK_FREQ / (1 << (GLOBAL_CTRL->CLK_SEL_0_b.TIMER_CLK + 1));
+}
+
+void TIM_Init(TIMER0_Type* Timx, uint16_t Ms) {
+	assert_param(IS_TIM_ALL_PERIPH(Timx));
+	
+	Timx->CTRL_b.EN = FALSE;
+	Timx->LEN = tim_GetClock() / 1000 * Ms;
+	Timx->TYPE_b.SIGNLE_SHOT = TRUE;
+}
+
+void TIM_EnableInt(TIMER0_Type* Timx, BOOL Enable) {
+	assert_param(IS_TIM_ALL_PERIPH(Timx));
+	
+	if (Enable == TRUE) {
+	  Timx->INT_EN_b.EN_REVERSE = FALSE;
+	} else {
+		Timx->INT_EN_b.EN_REVERSE = TRUE;
+	}
+}
+
+BOOL TIM_GetIntStatus(TIMER0_Type* Timx) {
+	assert_param(IS_TIM_ALL_PERIPH(Timx));
+	
+	return (Timx->INT_STA_b.STA ? TRUE : FALSE);
+}
+
+void TIM_ClearInt(TIMER0_Type* Timx) {
+	assert_param(IS_TIM_ALL_PERIPH(Timx));
+	
+	Timx->INT_STA_b.STA = 1;
+}
+
+void TIM_Enable(TIMER0_Type* Timx, BOOL Enable) {
+	assert_param(IS_TIM_ALL_PERIPH(Timx));
+	
+	Timx->CTRL_b.EN = Enable;
+}
+
+BOOL TIM_IsOverflow(TIMER0_Type* Timx) {
+	assert_param(IS_TIM_ALL_PERIPH(Timx));
+	
+	return (Timx->CNT == 0) ? TRUE : FALSE;
+}
+
+uint32_t TIM_GetCounter(TIMER0_Type* Timx) {
+	assert_param(IS_TIM_ALL_PERIPH(Timx));
+	
+	return Timx->CNT;
+}
+

+ 177 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_uart.c

@@ -0,0 +1,177 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_uart.c
+	*
+	* @brief    CMEM7 uart file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+
+#include "cmem7_uart.h"
+
+#define UART_Mode_8b                        1
+#define UART_Mode_8b_Parity                 7
+
+#define UART_BaudMode_0                     0
+#define UART_BaudMode_1                     1
+#define UART_BaudMode_Division							19200
+
+#define UART_WR_MAX_FIFO_SIZE               16	
+
+static uint32_t UART_GetClock(UART0_Type* UARTx) {
+	uint32_t dividor;
+
+	if ((uint32_t)UARTx == (uint32_t)UART0) {
+		dividor = GLOBAL_CTRL->CLK_SEL_0_b.UART0_CLK;
+	} else if ((uint32_t)UARTx == (uint32_t)UART1) {
+		dividor = GLOBAL_CTRL->CLK_SEL_0_b.UART1_CLK;
+	} else if ((uint32_t)UARTx == (uint32_t)UART2) {
+		dividor = GLOBAL_CTRL->CLK_SEL_1_b.UART2_CLK;
+	}
+	
+	return SYSTEM_CLOCK_FREQ / (1 << (dividor + 1));
+}
+
+static uint16_t UART_CalcBaudrateReload(uint32_t FreqHz, uint32_t Baudrate) {
+  if (Baudrate <= UART_BaudMode_Division) {                     
+		/** reload in mode 0
+		  *    reload = FreqHz / 16 * Baudrate
+		  * round up 
+		  *    reload = FreqHz / 16 * Baudrate + 1/ 2
+		  *    reload = (2 * FreqHz + 16 * Baudrate) / 2 * 16 * Baudrate
+		  */
+		return ((FreqHz << 1) + (Baudrate << 4)) / (Baudrate << 5);
+	} 
+	
+	/** reload in mode 1
+		*    reload = Baudrate * 16 * 65536 / FreqHz
+		* round up 
+		*    reload = Baudrate * 16 * 65536 / FreqHz + 1/ 2
+		*    reload = (2 * Baudrate * 16 * 65536 + FreqHz) / 2 * FreqHz
+		*/
+	return ((((uint64_t)(Baudrate)) << 21) + FreqHz) / (FreqHz << 1);
+}
+            
+void UART_Init(UART0_Type* UARTx, UART_InitTypeDef *init) {
+ 	assert_param(IS_UART_ALL_PERIPH(UARTx));
+	assert_param(init);
+ 	assert_param(IS_UART_STOPBITS(init->UART_StopBits));
+ 	assert_param(IS_UART_PARITY(init->UART_Parity));
+	
+	/* TODO : assume clock is 50MHz */
+	UARTx->BAUDRATE = UART_CalcBaudrateReload(
+	  UART_GetClock(UARTx), init->UART_BaudRate);
+	UARTx->CTRL_b.MODE = 
+	  (init->UART_Parity == UART_Parity_None) ? 
+	  UART_Mode_8b : UART_Mode_8b_Parity;	
+	UARTx->CTRL_b.STOP = init->UART_StopBits;
+	UARTx->CTRL_b.PARITY = 
+	  (init->UART_Parity == UART_Parity_None) ? 
+	  UART_Parity_Even : init->UART_Parity;
+	UARTx->CTRL_b.LOOPBACK = init->UART_LoopBack;
+	UARTx->CTRL_b.RX_EN = init->UART_RxEn;
+	UARTx->CTRL_b.CTS = init->UART_CtsEn;
+	UARTx->CTRL_b.BAUD_MODE = 
+	  (init->UART_BaudRate > UART_BaudMode_Division) ? 
+	  UART_BaudMode_1 : UART_BaudMode_0;
+	UARTx->CTRL_b.FIFO_EN = TRUE;
+	UARTx->CTRL_b.RX_THRESHOLD = UART_WR_MAX_FIFO_SIZE;
+	UARTx->CTRL_b.RX_HALF_FULL = (UART_WR_MAX_FIFO_SIZE >> 1);
+	UARTx->TIMEOUT = 0xFF;
+	
+	UARTx->INT_MASK |= UART_Int_All;
+	UARTx->INT_SEEN &= UART_Int_All;
+}
+
+void UART_EnableInt(UART0_Type* UARTx, uint32_t Int, BOOL enable) {
+	assert_param(IS_UART_ALL_PERIPH(UARTx));
+	assert_param(IS_UART_INT(Int));
+	
+  if (enable) {
+	  UARTx->INT_MASK &= ~Int;
+	} else {
+		UARTx->INT_MASK |= Int;
+	}
+	
+	UARTx->INT_MASK &= UART_Int_All;
+}
+
+void UART_Enable(UART0_Type* UARTx, BOOL enable) {
+	assert_param(IS_UART_ALL_PERIPH(UARTx));
+	
+	UARTx->RUN_b.EN = enable;
+}
+
+BOOL UART_GetIntStatus(UART0_Type* UARTx, uint32_t Int) {
+	assert_param(IS_UART_ALL_PERIPH(UARTx));
+	assert_param(IS_UART_INT(Int));
+	
+	if (0 != (UARTx->INT_SEEN & Int)) {
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+
+void UART_ClearInt(UART0_Type* UARTx, uint32_t Int) {
+	assert_param(IS_UART_ALL_PERIPH(UARTx));
+	assert_param(IS_UART_INT(Int));
+	
+	UARTx->INT_SEEN = Int;
+}
+
+uint8_t UART_Write(UART0_Type* UARTx, uint8_t Size, uint8_t* Data) {
+	uint8_t count;
+	
+	/* Check the parameters */
+  assert_param(IS_UART_ALL_PERIPH(UARTx));
+	assert_param(Data);
+	
+	if (!UARTx->RUN_b.EN) {
+		return 0;
+	}
+	
+	count = 0;
+	while (!UARTx->STATUS_b.TF && count < Size) {
+		UARTx->TX_BUF = *(Data + count++);
+	}
+  
+	return count;
+}
+
+/* return value is actual read data size */
+uint8_t UART_Read(UART0_Type* UARTx, uint8_t Size, uint8_t* Data) {
+	uint8_t count;
+	
+	assert_param(IS_UART_ALL_PERIPH(UARTx));
+	assert_param(Data);
+	
+	if (!UARTx->RUN_b.EN) {
+		return 0;
+	}
+	
+	count = 0;
+	while (UARTx->STATUS_b.RNE && count < Size) {
+		*(Data + count++) = (UARTx->RX_BUF & 0x00FF);
+	}
+	
+	return count;	
+}
+

+ 842 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_usb.c

@@ -0,0 +1,842 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_usb.c
+	*
+	* @brief    CMEM7 USB source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_usb.h"
+
+static void USB_SET_REG_HPRT(const USB_REG_HPRT *clr, const USB_REG_HPRT *set)
+{
+	USB_REG_HPRT hprt;
+	hprt.HPRT = USB->__HPRT;					// @0x41300440
+	hprt.HPRT_b.POC = hprt.HPRT_b.PEDC = hprt.HPRT_b.PE = hprt.HPRT_b.PCD = 0;
+	if (clr)
+		hprt.HPRT &= (~clr->HPRT);
+	if (set)
+		hprt.HPRT |= (set->HPRT);
+	USB->__HPRT = hprt.HPRT;
+}
+
+void USB_coreInit(uint32_t type)
+{
+	USB->GINTEN = 0;
+	USB->GINTSTS = ~0;
+	GLOBAL_CTRL->USB_PHY_CTRL_b.CKISEL = 0;		// Crystal
+	// core initialization
+	// choose PHY and soft reset
+	USB->GUSBCFG_b.PHY_IF = 0;					// 60MHz, 8bit
+	USB->GUSBCFG_b.ULPI_UTMI_SEL = 0;			// UTMI
+	USB->GUSBCFG_b.PHY_SEL = 0;					// USB 2.0 HS UTMI+
+	USB->GRSTCTL_b.CORE_SOFT_RST = 1;
+	while (USB->GRSTCTL_b.CORE_SOFT_RST == 1) ;
+	while (USB->GRSTCTL_b.AHB_IDLE == 0) ;
+
+	USB->GAHBCFG_b.DMA_EN = 1;
+	USB->GAHBCFG_b.GLBL_INTR_EN = 1;
+	USB->GAHBCFG_b.BST_LEN = 0x1;   			// INCR
+
+	USB->GINTEN_b.RFNE = FALSE;
+
+	USB->GUSBCFG_b.USB_TRD_TIM = 0x9; 			// 8-bit UTMI+
+	USB->GUSBCFG_b.SRP_CAP = (type & 0x10) ? 1 : 0;
+	USB->GUSBCFG_b.HNP_CAP = (type & 0x20) ? 1 : 0;
+	if (type & 0x1) {
+		USB->GUSBCFG_b.FORCE_HOST_MODE = 1;
+		USB->GUSBCFG_b.FORCE_DEVICE_MODE = 0;
+	} else if (type & 0x2) {
+		USB->GUSBCFG_b.FORCE_DEVICE_MODE = 1;
+		USB->GUSBCFG_b.FORCE_HOST_MODE = 0;
+	}
+	udelay(50000);
+}
+
+void USB_EnableInt(BOOL enable)
+{
+	USB->GAHBCFG_b.GLBL_INTR_EN = enable;
+}
+
+void USB_FlushFIFO(uint32_t num)
+{
+	if (num < 0x10) {
+		USB->GRSTCTL_b.TX_FIFO_FLUSH_NUM = num;
+		USB->GRSTCTL_b.TX_FIFO_FLUSH = 1;
+		while (USB->GRSTCTL_b.TX_FIFO_FLUSH);
+	} else if (num > 0x10) {
+		USB->GRSTCTL_b.RX_FIFO_FLUSH = 1;
+		while (USB->GRSTCTL_b.RX_FIFO_FLUSH);
+	} else {
+		USB->GRSTCTL_b.TX_FIFO_FLUSH_NUM = 0;
+		USB->GRSTCTL_b.TX_FIFO_ALL = 1;
+		USB->GRSTCTL_b.TX_FIFO_FLUSH = 1;
+		while (USB->GRSTCTL_b.TX_FIFO_FLUSH);
+	}
+}
+
+BOOL USB_ogtIsBdevID()
+{
+	return USB->GOTGCTL_b.CON_ID_STS ? TRUE : FALSE;
+}
+
+BOOL USB_hostVBus(uint32_t opt)
+{
+	if (opt & 0x2) {
+		USB_REG_HPRT hprt;
+		hprt.HPRT = 0;
+		hprt.HPRT_b.PP = 1;
+		if (opt & 0x1)
+			USB_SET_REG_HPRT(NULL, &hprt);
+		else
+			USB_SET_REG_HPRT(&hprt, NULL);
+	}
+	return USB->__HPRT_b.PP ? TRUE : FALSE;
+}
+
+void USB_hostInit()
+{
+	USB_REG_HPRT hprt;
+	// HOST MODE
+	USB->HCFG_b.FS_LS_PCS = 0x0;				// PHY clock is running at 30/60 MHz
+	USB->HCFG_b.FS_LS_SUPPORT = 0x0;			// HS/FS/LS
+	USB->HCFG_b.EN_SG_DMA = 0x1;				// Enable Scatter/Gather DMA
+	hprt.HPRT = 0;
+	hprt.HPRT_b.PP = 1;
+	USB_SET_REG_HPRT(NULL, &hprt);
+}
+
+void USB_HostResetPort(BOOL rst)
+{
+	USB_REG_HPRT hprt;
+	hprt.HPRT = 0;
+	hprt.HPRT_b.PRESET = 1;
+	if (rst)
+		USB_SET_REG_HPRT(NULL, &hprt);
+	else
+		USB_SET_REG_HPRT(&hprt, NULL);
+}
+
+uint16_t USB_HostGetCurFrame()
+{
+	return USB->HFNUM_b.FN;
+}
+
+void USB_HostSuspendPort()
+{
+	USB_REG_HPRT hprt;
+	hprt.HPRT = 0;
+	hprt.HPRT_b.PS = 1;
+	USB_SET_REG_HPRT(NULL, &hprt);
+}
+
+USB_ENUM_SPEED USB_hostGetEnumSpd()
+{
+	return (USB_ENUM_SPEED)USB->__HPRT_b.SPEED;
+}
+
+BOOL USB_hostPrtConn()
+{
+	return USB->__HPRT_b.PCS ? TRUE : FALSE;
+}
+
+void USB_hostCH0(uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed)
+{
+	USB->HCDMA0_b.ADDR = SET_HCDMA_DESC_ADDR(desc);
+	USB->HCDMA0_b.CTD = ctd;
+	USB->HCTSIZ0_b.PING = ping ? 1 : 0;
+	USB->HCTSIZ0_b.NTD = ntd;
+	USB->HCTSIZ0_b.PID = pid;
+	USB->HCC0_b.MPS = mps;
+	USB->HCC0_b.EP_NUM = epnum;
+	USB->HCC0_b.EP_DIR = in ? 1 : 0;
+	USB->HCC0_b.LSD = (USB_ENUM_SPEED_LS == speed) ? 1 : 0;
+	USB->HCC0_b.EP_TYPE = eptype;
+	USB->HCC0_b.EC = 0;
+	USB->HCC0_b.DA = devaddr;
+	USB->HCC0_b.CE = 1;
+}
+
+void USB_hostCH1(uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed)
+{
+	USB->HCDMA1_b.ADDR = SET_HCDMA_DESC_ADDR(desc);
+	USB->HCDMA1_b.CTD = ctd;
+	USB->HCTSIZ1_b.PING = ping ? 1 : 0;
+	USB->HCTSIZ1_b.NTD = ntd;
+	USB->HCTSIZ1_b.PID = pid;
+	USB->HCC1_b.MPS = mps;
+	USB->HCC1_b.EP_NUM = epnum;
+	USB->HCC1_b.EP_DIR = in ? 1 : 0;
+	USB->HCC1_b.LSD = (USB_ENUM_SPEED_LS == speed) ? 1 : 0;
+	USB->HCC1_b.EP_TYPE = eptype;
+	USB->HCC1_b.EC = 0;
+	USB->HCC1_b.DA = devaddr;
+	USB->HCC1_b.CE = 1;
+}
+
+void USB_hostCH2(uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed)
+{
+	USB->HCDMA2_b.ADDR = SET_HCDMA_DESC_ADDR(desc);
+	USB->HCDMA2_b.CTD = ctd;
+	USB->HCTSIZ2_b.PING = ping ? 1 : 0;
+	USB->HCTSIZ2_b.NTD = ntd;
+	USB->HCTSIZ2_b.PID = pid;
+	USB->HCC2_b.MPS = mps;
+	USB->HCC2_b.EP_NUM = epnum;
+	USB->HCC2_b.EP_DIR = in ? 1 : 0;
+	USB->HCC2_b.LSD = (USB_ENUM_SPEED_LS == speed) ? 1 : 0;
+	USB->HCC2_b.EP_TYPE = eptype;
+	USB->HCC2_b.EC = 0;
+	USB->HCC2_b.DA = devaddr;
+	USB->HCC2_b.CE = 1;
+}
+
+int USB_hostCHn(uint32_t ch, uint32_t devaddr, OTG_DESCRIPTOR *desc, uint32_t ctd, uint32_t ntd, BOOL ping, uint32_t pid, uint32_t mps, uint32_t epnum, BOOL in, USB_EP_TYPE eptype, USB_ENUM_SPEED speed)
+{
+	USB_Type *USBn = (USB_Type *)(((char *)USB) + (ch * 0x20));
+
+	if (ch > 15)
+		return -1;
+	USBn->HCDMA0_b.ADDR = SET_HCDMA_DESC_ADDR(desc);
+	USBn->HCDMA0_b.CTD = ctd;
+	USBn->HCTSIZ0_b.PING = ping ? 1 : 0;
+	USBn->HCTSIZ0_b.NTD = ntd;
+	USBn->HCTSIZ0_b.PID = pid;
+	USBn->HCC0_b.MPS = mps;
+	USBn->HCC0_b.EP_NUM = epnum;
+	USBn->HCC0_b.EP_DIR = in ? 1 : 0;
+	USBn->HCC0_b.LSD = (USB_ENUM_SPEED_LS == speed) ? 1 : 0;
+	USBn->HCC0_b.EP_TYPE = eptype;
+	USBn->HCC0_b.EC = 0;
+	USBn->HCC0_b.DA = devaddr;
+	USBn->HCC0_b.CE = 1;
+	return 0;
+}
+
+int USB_hostCHnHalt(uint32_t ch)
+{
+	uint32_t hcchar;
+	USB_Type *USBn = (USB_Type *)(((char *)USB) + (ch * 0x20));
+
+	if (ch > 15)
+		return -1;
+	hcchar = USBn->HCC0;
+	hcchar |= (0x3 << 30);
+	USBn->HCC0 = hcchar;
+	return 0;
+}
+
+BOOL USB_hostPortDisable(BOOL dis)
+{
+	if (dis) {
+		USB_REG_HPRT hprt;
+		hprt.HPRT = 0;
+		hprt.HPRT_b.PE = 1;
+		USB_SET_REG_HPRT(&hprt, NULL);
+	}
+	return USB->__HPRT_b.PE ? FALSE : TRUE;
+}
+
+BOOL USB_roleIsHost()
+{
+	return USB->GINTSTS_b.CUR_MOD ? TRUE : FALSE;
+}
+
+void USB_hostINT_enConn(BOOL en)
+{
+	USB->GINTEN_b.HP = en;
+}
+
+BOOL USB_hostINT_isConn()
+{
+	return USB->GINTSTS_b.HP ? TRUE : FALSE;
+}
+
+BOOL USB_hostINT_isPCD()
+{
+	return USB->__HPRT_b.PCD ? TRUE : FALSE;
+}
+
+void USB_hostINT_clrPCD()
+{
+	USB_REG_HPRT hprt;
+	hprt.HPRT = 0;
+	hprt.HPRT_b.PCD = 1;
+	USB_SET_REG_HPRT(NULL, &hprt);
+}
+
+BOOL USB_hostINT_isPEDC()
+{
+	return USB->__HPRT_b.PEDC ? TRUE : FALSE;
+}
+
+void USB_hostINT_clrPEDC()
+{
+	USB_REG_HPRT hprt;
+	hprt.HPRT = 0;
+	hprt.HPRT_b.PEDC = 1;
+	USB_SET_REG_HPRT(NULL, &hprt);
+}
+
+int USB_hostINT_enDone(uint32_t ch, BOOL en)
+{
+	USB_Type *USBn = (USB_Type *)(((char *)USB) + (ch * 0x20));
+
+	if (ch > 15)
+		return -1;
+
+	if (en) {
+		USB->GINTEN_b.HC = 1;
+		USB->HAINT_EN_b.EN |= BIT(ch);
+	} else
+		USB->HAINT_EN_b.EN &= ~BIT(ch);
+
+	USBn->HCINT_EN0_b.TC = USBn->HCINT_EN0_b.CH_HALT = USBn->HCINT_EN0_b.BNA = en ? 1 : 0;
+	return 0;
+}
+
+uint32_t USB_hostINT_isDone(uint32_t ch)
+{
+	uint32_t retval = 0;
+
+	if (ch > 15)
+		return 0;
+
+	if ((USB->GINTSTS_b.HC) && ((USB->HAINT & BIT(ch)))) {
+		USB_Type *USBn = (USB_Type *)(((char *)USB) + (ch * 0x20));
+		if (USBn->HCINT0_b.TC) {
+			USBn->HCINT0 = BIT(0);
+			retval |= 0x1;
+		}
+		if (USBn->HCINT0_b.BNA) {
+			USBn->HCINT0 = BIT(11);
+			retval |= 0x2;
+		}
+		if (USBn->HCINT0_b.CH_HALT) {
+			USBn->HCINT0 = BIT(1);
+			retval |= 0x4;
+		}
+		if (USBn->HCINT0_b.ETE) {
+			USBn->HCINT0 = BIT(12);
+			retval |= 0x8;
+		}
+	}
+	return retval;
+}
+
+uint32_t USB_hostINT_isPend(uint32_t ch)
+{
+	uint32_t retval = 0;
+
+	if (ch > 15)
+		return 0;
+
+	if ((USB->GINTSTS_b.HC) && ((USB->HAINT & BIT(ch)))) {
+		USB_Type *USBn = (USB_Type *)(((char *)USB) + (ch * 0x20));
+		retval = USBn->HCINT0;
+		USBn->HCINT0 = retval;
+	}
+	return retval;
+}
+
+void USB_devInit()
+{
+	// If still has some int needed to be enable
+	USB->GINTEN_b.MODE_MIS = TRUE;
+	USB->GINTEN_b.OTG_INT = TRUE;
+
+	// DEVICE MODE
+	USB->GINTEN_b.RFNE = FALSE;					// REG_CS(0x018/*GINTMSK*/, BIT(5)/*NPTxFEmpMsk*/ | BIT(4)/*RxFLvlMsk*/, 0);
+	USB->GINTEN_b.NPTFE = FALSE;
+	USB->DCFG_b.DSPEED = 0;						// HS DEV
+	USB->DCFG_b.NZLSOH = 0;						// REG_CS(0x800/*DCFG*/, BIT(2)/*NZStsOUTHShk*/ | BIT(1) | BIT(0)/*DevSpd: HS*/, BIT(23)/*DescDMA*/ | BIT(13)/*EnDevOutNak*/);
+	USB->DCFG_b.EN_SG_DMA = 1;
+	USB->DCFG_b.EDON = 1;
+	USB->DCTL_b.SD = 0;
+}
+
+USB_ENUM_SPEED USB_devGetEnumSpd()
+{
+	return (USB_ENUM_SPEED)USB->DSTS_b.SPEED;
+}
+
+void USB_devSetAddress(uint32_t addr)
+{
+	USB->DCFG_b.DEVICE_ADDR = addr;
+}
+
+void USB_devEP0out(uint32_t size, uint32_t pktcnt, uint32_t stpcnt, void *desc, BOOL snoop)
+{
+	USB->DOEPTSIZ0_b.SIZE = size;
+	USB->DOEPTSIZ0_b.PACKET_CNT = pktcnt;
+	USB->DOEPTSIZ0_b.SETUP_CNT = stpcnt;
+	USB->DOEPDMA0 = (uint32_t)(desc);
+	USB->DOEPCTL0_b.SNOOP = snoop;
+	USB->DOEPCTL0_b.CNAK = 1;
+	USB->DOEPCTL0_b.EPE = 1;					// REG_CS(0xB00/*DOEPCTL0*/, 0, BIT(31)/*EPEna*/);
+}
+
+BOOL USB_devEP0in(uint32_t size, uint32_t pktcnt, void *desc, uint32_t mps/*8,16,32,64-byte*/)
+{
+	switch (mps) {
+		case 64:	mps = 0x0; break;
+		case 32:	mps = 0x1; break;
+		case 16:	mps = 0x2; break;
+		case 8:		mps = 0x3; break;
+		default:	return FALSE;
+	}
+	USB->DIEPTSIZ0_b.SIZE = size;
+	USB->DIEPTSIZ0_b.PACKET_CNT = pktcnt;
+	USB->DIEPDMA0 = (uint32_t)(desc);
+	USB->DIEPCTL0_b.MPS = mps;
+	USB->DIEPCTL0_b.TX_FIFO_NUM = 0;
+	USB->DIEPCTL0_b.CNAK = 1;
+	USB->DIEPCTL0_b.EPE = 1;					// REG_CS(0xB00/*DOEPCTL0*/, 0, BIT(31)/*EPEna*/);
+	return TRUE;
+}
+
+void USB_devActEP1(const BOOL in, const uint32_t mps, USB_EP_TYPE type)
+{
+	if (in) {
+		USB->DIEPCTL1_b.MPS = mps;
+		USB->DIEPCTL1_b.EP_TYPE = type;
+		USB->DIEPCTL1_b.UAE = (mps != 0) ? 1 : 0;
+	} else {
+		USB->DOEPCTL1_b.MPS = mps;
+		USB->DOEPCTL1_b.EP_TYPE = type;
+		USB->DOEPCTL1_b.UAE = (mps != 0) ? 1 : 0;
+	}
+}
+
+void USB_devActEP2(const BOOL in, const uint32_t mps, USB_EP_TYPE type)
+{
+	if (in) {
+		USB->DIEPCTL2_b.MPS = mps;
+		USB->DIEPCTL2_b.EP_TYPE = type;
+		USB->DIEPCTL2_b.UAE = (mps != 0) ? 1 : 0;
+	} else {
+		USB->DOEPCTL2_b.MPS = mps;
+		USB->DOEPCTL2_b.EP_TYPE = type;
+		USB->DOEPCTL2_b.UAE = (mps != 0) ? 1 : 0;
+	}
+}
+
+void USB_devEP1in(uint32_t size, uint32_t pktcnt, uint32_t pid, void *desc)
+{
+	USB->DIEPTSIZ1_b.SIZE = size;
+	USB->DIEPTSIZ1_b.PACKET_CNT = pktcnt;
+	USB->DIEPDMA1 = (uint32_t)(desc);
+	USB->DIEPCTL1_b.CNAK = 1;
+	USB->DIEPCTL1_b.SET_D0_PID = (pid >> 0) & 0x1;
+	USB->DIEPCTL1_b.SET_D1_PID = (pid >> 1) & 0x1;
+	USB->DIEPCTL1_b.EPE = 1;
+}
+
+void USB_devEP1out(uint32_t size, uint32_t pktcnt, uint32_t pid, uint32_t stpcnt, void *desc, BOOL snoop)
+{
+	USB->DOEPTSIZ1_b.SIZE = size;
+	USB->DOEPTSIZ1_b.PACKET_CNT = pktcnt;
+	USB->DOEPTSIZ1_b.SETUPCNT_PID = stpcnt;
+	USB->DOEPDMA1 = (uint32_t)(desc);
+	USB->DOEPCTL1_b.EC = snoop;
+	USB->DOEPCTL1_b.CNAK = 1;
+	USB->DOEPCTL1_b.SET_D0_PID = (pid >> 0) & 0x1;
+	USB->DOEPCTL1_b.SET_D1_PID = (pid >> 1) & 0x1;
+	USB->DOEPCTL1_b.EPE = 1;
+}
+
+
+void USB_devEP2in(uint32_t size, uint32_t pktcnt, uint32_t pid, void *desc)
+{
+	USB->DIEPTSIZ2_b.SIZE = size;
+	USB->DIEPTSIZ2_b.PACKET_CNT = pktcnt;
+	USB->DIEPDMA2 = (uint32_t)(desc);
+	USB->DIEPCTL2_b.CNAK = 1;
+	USB->DIEPCTL2_b.SET_D0_PID = (pid >> 0) & 0x1;
+	USB->DIEPCTL2_b.SET_D1_PID = (pid >> 1) & 0x1;
+	USB->DIEPCTL2_b.EPE = 1;
+}
+
+void USB_devEP2out(uint32_t size, uint32_t pktcnt, uint32_t pid, uint32_t stpcnt, void *desc, BOOL snoop)
+{
+	USB->DOEPTSIZ2_b.SIZE = size;
+	USB->DOEPTSIZ2_b.PACKET_CNT = pktcnt;
+	USB->DOEPTSIZ2_b.SETUPCNT_PID = stpcnt;
+	USB->DOEPDMA2 = (uint32_t)(desc);
+	USB->DOEPCTL2_b.EC = snoop;
+	USB->DOEPCTL2_b.CNAK = 1;
+	USB->DOEPCTL2_b.SET_D0_PID = (pid >> 0) & 0x1;
+	USB->DOEPCTL2_b.SET_D1_PID = (pid >> 1) & 0x1;
+	USB->DOEPCTL2_b.EPE = 1;
+}
+
+void USB_devNAKhandshake(uint32_t ep, BOOL in, BOOL en)
+{
+	switch (ep) {
+	case 0:
+		if (in) {
+			if (en) USB->DIEPCTL0_b.SNAK = 1; else USB->DIEPCTL0_b.CNAK = 1;
+		} else {
+			if (en) USB->DOEPCTL0_b.SNAK = 1; else USB->DOEPCTL0_b.CNAK = 1;
+		}
+		break;
+	case 1:
+		if (in) {
+			if (en) USB->DIEPCTL1_b.SNAK = 1; else USB->DIEPCTL1_b.CNAK = 1;
+		} else {
+			if (en) USB->DOEPCTL1_b.SNAK = 1; else USB->DOEPCTL1_b.CNAK = 1;
+		}
+		break;
+	case 2:
+		if (in) {
+			if (en) USB->DIEPCTL2_b.SNAK = 1; else USB->DIEPCTL2_b.CNAK = 1;
+		} else {
+			if (en) USB->DOEPCTL2_b.SNAK = 1; else USB->DOEPCTL2_b.CNAK = 1;
+		}
+		break;
+	default:
+		break;
+	}
+}
+
+BOOL USB_devSTALLhandshake(uint32_t ep, BOOL in, BOOL en)
+{
+	BOOL retval = FALSE;
+	switch (ep) {
+	case 0:
+		if (in) {
+			retval = USB->DIEPCTL0_b.STALL;
+			USB->DIEPCTL0_b.STALL = en ? 1 : 0;
+		} else {
+			retval = USB->DOEPCTL0_b.STALL;
+			USB->DOEPCTL0_b.STALL = en ? 1 : 0;
+		}
+		break;
+	case 1:
+		if (in) {
+			retval = USB->DIEPCTL1_b.STALL;
+			USB->DIEPCTL1_b.STALL = en ? 1 : 0;
+		} else {
+			retval = USB->DOEPCTL1_b.STALL;
+			USB->DOEPCTL1_b.STALL = en ? 1 : 0;
+		}
+		break;
+	case 2:
+		if (in) {
+			retval = USB->DIEPCTL2_b.STALL;
+			USB->DIEPCTL2_b.STALL = en ? 1 : 0;
+		} else {
+			retval = USB->DOEPCTL2_b.STALL;
+			USB->DOEPCTL2_b.STALL = en ? 1 : 0;
+		}
+		break;
+	default:
+		break;
+	}
+	return retval;
+}
+
+void USB_devINT_enDone(uint32_t ep, BOOL in, BOOL en)
+{
+	if (in) {
+		USB->DIEPEN_b.TIMEOUT = en ? 1 : 0;
+		USB->DIEPEN_b.TC = en ? 1 : 0;
+		if (en) {
+			USB->GINTEN_b.IEP_INT = 1;
+			USB->DAINT_EN_b.IN_EN |= BIT(ep);
+		} else
+			USB->DAINT_EN_b.IN_EN &= ~BIT(ep);
+	} else {
+		USB->DOEPEN_b.SPD = en ? 1 : 0;
+		USB->DOEPEN_b.TC = en ? 1 : 0;
+		if (en) {
+			USB->GINTEN_b.OEP_INT = 1;
+			USB->DAINT_EN_b.OUT_EN |= BIT(ep);
+		} else
+			USB->DAINT_EN_b.OUT_EN &= ~BIT(ep);
+	}
+}
+
+uint32_t USB_devINT_isDone(uint32_t ep, BOOL in)
+{
+	int32_t retval = 0;
+	if (in) {
+		if (USB->GINTSTS_b.IEP_INT)
+		switch (ep) {
+		case 0:
+			if (USB->DIEPINT0_b.TC) {
+				retval |= 0x1;
+				USB->DIEPINT0 = BIT(0);
+			}
+			if (USB->DIEPINT0_b.BNA) {
+				retval |= 0x2;
+				USB->DIEPINT0 = BIT(9);
+			}
+			break;
+		case 1:
+			if (USB->DIEPINT1_b.TC) {
+				retval |= 0x1;
+				USB->DIEPINT1 = BIT(0);
+			}
+			if (USB->DIEPINT1_b.BNA) {
+				retval |= 0x2;
+				USB->DIEPINT1 = BIT(9);
+			}
+			break;
+		case 2:
+			if (USB->DIEPINT2_b.TC) {
+				retval |= 0x1;
+				USB->DIEPINT2 = BIT(0);
+			}
+			if (USB->DIEPINT2_b.BNA) {
+				retval |= 0x2;
+				USB->DIEPINT2 = BIT(9);
+			}
+		default:
+			break;
+		}
+	} else {
+		if (USB->GINTSTS_b.OEP_INT)
+		switch (ep) {
+		case 0:
+			if (USB->DOEPINT0_b.TC) {
+				retval |= 0x1;
+				USB->DOEPINT0 = BIT(0);
+			}
+			if (USB->DOEPINT0_b.SETUP) {
+				retval |= 0x4;
+				USB->DOEPINT0 = BIT(3);
+			}
+			break;
+		case 1:
+			if (USB->DOEPINT1_b.TC) {
+				retval |= 0x1;
+				USB->DOEPINT1 = BIT(0);
+			}
+			if (USB->DOEPINT1_b.BNA) {
+				retval |= 0x2;
+				USB->DOEPINT1 = BIT(9);
+			}
+			break;
+		case 2:
+			if (USB->DOEPINT2_b.TC) {
+				retval |= 0x1;
+				USB->DOEPINT2 = BIT(0);
+			}
+			if (USB->DOEPINT2_b.BNA) {
+				retval |= 0x2;
+				USB->DOEPINT2 = BIT(9);
+			}
+			break;
+		default:
+			break;
+		}
+	}
+	return retval;
+}
+
+void USB_INT_enOTG(BOOL en)
+{
+	USB->GINTEN_b.OTG_INT = en;
+}
+
+BOOL USB_INT_isOTG()
+{
+	return USB->GINTSTS_b.OTG_INT ? TRUE : FALSE;
+}
+
+BOOL USB_INT_isOTGon(USB_INT_OTG otg)
+{
+	switch (otg) {
+	case USB_INT_OTG_SESEND:
+		return USB->GOTGINT_b.SES_END_DET ? TRUE : FALSE;
+		break;
+	case USB_INT_OTG_STANDAUP:
+		return USB->GOTGINT_b.A_DEV_TOUT_CHG ? TRUE : FALSE;
+		break;
+	case USB_INT_OTG_HNDETECT:
+		return USB->GOTGINT_b.HST_NEG_DET ? TRUE : FALSE;
+		break;
+	case USB_INT_OTG_HNSUCCHG:
+		return USB->GOTGINT_b.HST_NEG_SUC_STS_CHNG ? TRUE : FALSE;
+		break;
+	case USB_INT_OTG_KEEPAPP:
+		return USB->GOTGINT_b.DBNCE_DONE ? TRUE : FALSE;
+		break;
+	default:
+		break;
+	}
+	return FALSE;
+}
+
+void USB_INT_clrOTGon(USB_INT_OTG otg)
+{
+	switch (otg) {
+	case USB_INT_OTG_SESEND:
+		USB->GOTGINT = BIT(2);
+		break;
+ 	case USB_INT_OTG_STANDAUP:
+		USB->GOTGINT = BIT(18);
+		break;
+	case USB_INT_OTG_HNDETECT:
+		USB->GOTGINT = BIT(17);
+		break;
+	case USB_INT_OTG_HNSUCCHG:
+		USB->GOTGINT = BIT(9);
+		break;
+	case USB_INT_OTG_KEEPAPP:
+		USB->GOTGINT = BIT(19);
+		break;
+	default:
+		break;
+	}
+}
+
+void USB_INT_enGP(USB_INT_GP name, BOOL en)
+{
+	switch (name) {
+	case USB_INT_GP_HOST_DISC:
+		USB->GINTEN_b.DD = en ? 1 : 0;
+		break;
+	case USB_INT_GP_DEV_RESET:
+		USB->GINTEN_b.USB_RST = en ? 1 : 0;
+		break;
+	case USB_INT_GP_DEV_ENUMDONE:
+		USB->GINTEN_b.ENUM_DONE = en ? 1 : 0;
+		break;
+	case USB_INT_GP_DEV_SUSP:
+		USB->GINTEN_b.USB_SUS = en ? 1 : 0;
+		break;
+	case USB_INT_GP_DEV_EARLY:
+		USB->GINTEN_b.EARLY_SUS = en ? 1 : 0;
+		break;
+	case USB_INT_GP_SOF:
+		USB->GINTEN_b.SOF = en ? 1 : 0;
+		break;
+	case USB_INT_GP_MIS:
+		USB->GINTEN_b.MODE_MIS = en ? 1 : 0;
+		break;
+	case USB_INT_GP_IDCHG:
+		USB->GINTEN_b.CIDSC = en ? 1 : 0;
+		break;
+	case USB_INT_GP_SESSREQ:
+		USB->GINTEN_b.SR = en ? 1 : 0;
+		break;
+	default:
+		break;
+	}
+}
+
+BOOL USB_INT_isGP(USB_INT_GP name)
+{
+	switch (name) {
+	case USB_INT_GP_HOST_DISC:
+		return USB->GINTSTS_b.DD ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_DEV_RESET:
+		return USB->GINTSTS_b.USB_RST ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_DEV_ENUMDONE:
+		return USB->GINTSTS_b.ENUM_DONE ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_DEV_SUSP:
+		return USB->GINTSTS_b.USB_SUS ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_DEV_EARLY:
+		return USB->GINTSTS_b.EARLY_SUS ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_SOF:
+		return USB->GINTSTS_b.SOF ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_MIS:
+		return USB->GINTSTS_b.MODE_MIS ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_IDCHG:
+		return USB->GINTSTS_b.CIDSC ? TRUE : FALSE;
+		break;
+	case USB_INT_GP_SESSREQ:
+		return USB->GINTSTS_b.SR ? TRUE : FALSE;
+		break;
+	default:
+		break;
+	}
+	return FALSE;
+}
+
+void USB_INT_clrGP(USB_INT_GP name)
+{
+	switch (name) {
+	case USB_INT_GP_HOST_DISC:
+		USB->GINTSTS = BIT(29);
+		break;
+	case USB_INT_GP_DEV_RESET:
+		USB->GINTSTS = BIT(12);
+		break;
+	case USB_INT_GP_DEV_ENUMDONE:
+		USB->GINTSTS = BIT(13);
+		break;
+	case USB_INT_GP_DEV_SUSP:
+		USB->GINTSTS = BIT(11);
+		break;
+	case USB_INT_GP_DEV_EARLY:
+		USB->GINTSTS = BIT(10);
+		break;
+	case USB_INT_GP_SOF:
+		USB->GINTSTS = BIT(3);
+		break;
+	case USB_INT_GP_MIS:
+		USB->GINTSTS = BIT(1);
+		break;
+	case USB_INT_GP_IDCHG:
+		USB->GINTSTS = BIT(28);
+		break;
+	case USB_INT_GP_SESSREQ:
+		USB->GINTSTS = BIT(30);
+		break;
+	default:
+		break;
+	}
+}
+
+BOOL USB_otgControl(USB_OTG_CTL ctl, BOOL val)
+{
+	BOOL retval = FALSE;
+	switch (ctl) {
+	case USB_OTG_DEV_HNSUCC:
+		retval = USB->GOTGCTL_b.HST_NEG_SCS ? TRUE : FALSE;
+		break;
+	case USB_OTG_DEV_HNPREQ:
+		retval = USB->GOTGCTL_b.HNP_REQ ? TRUE : FALSE;
+		USB->GOTGCTL_b.HNP_REQ = val ? 1 : 0;
+		break;
+	case USB_OTG_HST_HNPENABLE:
+		retval = USB->GOTGCTL_b.HST_SET_HNP_EN ? TRUE : FALSE;
+		USB->GOTGCTL_b.HST_SET_HNP_EN = val ? 1 : 0;
+		break;
+	case USB_OTG_DEV_HNPENABLE:
+		retval = USB->GOTGCTL_b.DEV_HNP_EN ? TRUE : FALSE;
+		USB->GOTGCTL_b.DEV_HNP_EN = val ? 1 : 0;
+		break;
+	default:
+		break;
+	}
+	return retval;
+}

+ 63 - 0
bsp/CME_M7/StdPeriph_Driver/src/cmem7_wdg.c

@@ -0,0 +1,63 @@
+/**
+	*****************************************************************************
+	* @file     cmem7_wdg.c
+	*
+	* @brief    CMEM7 watchdog source file
+	*
+	*
+	* @version  V1.0
+	* @date     3. September 2013
+	*
+	* @note               
+	*           
+	*****************************************************************************
+	* @attention
+	*
+	* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+	* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+	* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 
+	* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+	* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+	* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+	*
+	* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
+	*****************************************************************************
+	*/
+	
+#include "cmem7_wdg.h"
+
+static uint32_t wdg_GetClock() {
+	return SYSTEM_CLOCK_FREQ / (1 << (GLOBAL_CTRL->CLK_SEL_0_b.WDG_CLK + 1));
+}
+
+void WDG_DeInit(void){
+  SOFT_RESET->SOFTRST_b.WDT_n = 0;
+	SOFT_RESET->SOFTRST_b.WDT_n = 1;
+}
+
+void WDG_Init(uint8_t trigger, uint16_t ResetMillSecond) {
+	assert_param(IS_WDG_TRIGGER_MODE(trigger));
+	
+	WDG->INT_CTRL_b.TRIGGER_MODE = trigger;
+	WDG->LEN = ((uint64_t)wdg_GetClock()) * ResetMillSecond / 1000;
+}
+
+void WDG_ITConfig(uint8_t Int, BOOL Enable) {
+	assert_param(IS_WDG_INT(Int));
+	
+	WDG->CTRL_b.INT_LEN = Int;
+	WDG->INT_CTRL_b.MASK = !Enable;
+}
+
+BOOL WDG_GetITStatus() {
+	return (WDG->INT_STA_b.STA == 1) ? TRUE : FALSE;
+}
+
+void WDG_ClearITPendingBit() {
+	WDG->INT_STA_b.STA = 1;
+}
+
+void WDG_Cmd(BOOL Enable) {
+	WDG->CTRL_b.EN = Enable;
+}
+

+ 11 - 0
bsp/CME_M7/applications/SConscript

@@ -0,0 +1,11 @@
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd     = os.path.join(str(Dir('#')), 'applications')
+src	= Glob('*.c')
+CPPPATH = [cwd, str(Dir('#'))]
+
+group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')

+ 42 - 0
bsp/CME_M7/applications/application.c

@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2014-08-03     aozima       first implementation
+ */
+
+#include <board.h>
+#include <rtthread.h>
+
+void rt_init_thread_entry(void* parameter)
+{
+    rt_components_init();
+
+#ifdef RT_USING_LWIP
+    cme_m7_eth_init();
+
+    set_if("e0", "192.168.1.99", "192.168.1.1", "255.255.255.0");
+#endif /* RT_USING_LWIP */
+}
+
+int rt_application_init()
+{
+    rt_thread_t tid;
+
+    tid = rt_thread_create("init",
+        rt_init_thread_entry,
+        RT_NULL,
+        2048,
+        RT_THREAD_PRIORITY_MAX/3,
+        20);
+
+    if (tid != RT_NULL)
+        rt_thread_startup(tid);
+
+    return 0;
+}
+
+/*@}*/

+ 39 - 0
bsp/CME_M7/applications/led.c

@@ -0,0 +1,39 @@
+#include <rtthread.h>
+#include <board.h>
+
+static void led_thread_entry(void* parameter)
+{
+    /* Configure GPIO as Output mode */
+    GPIO_Init(GPIO_GROUP_GPIO, 0xFFFFFFFF);
+    GPIO_EnableOutput(GPIO_GROUP_GPIO, 0x81010101);
+
+    // LED4, 200ns period
+    GPIO_InitPwm(GPIO_PWM_CHANNEL_GPIO_31, 100, 100);
+    GPIO_EnablePwm(GPIO_PWM_CHANNEL_GPIO_31, TRUE);
+
+    while(1)
+    {
+        GPIO_Write(GPIO_GROUP_GPIO, 0x01010101, 0x55555555);
+        rt_thread_delay(RT_TICK_PER_SECOND/3);
+        GPIO_Write(GPIO_GROUP_GPIO, 0x01010101, 0xAAAAAAAA);
+        rt_thread_delay(RT_TICK_PER_SECOND/3);
+    }
+}
+
+static int led_thread_init(void)
+{
+    rt_thread_t tid;
+
+    tid = rt_thread_create("led",
+                           led_thread_entry,
+                           RT_NULL,
+                           2048,
+                           RT_THREAD_PRIORITY_MAX - 1,
+                           1);
+
+    if (tid != RT_NULL)
+        rt_thread_startup(tid);
+
+    return 0;
+}
+INIT_APP_EXPORT(led_thread_init);

+ 85 - 0
bsp/CME_M7/applications/startup.c

@@ -0,0 +1,85 @@
+/*
+ * File      : startup.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006-2014, RT-Thread Develop Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2014-08-03     aozima       first implementation
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+
+#include "board.h"
+
+/**
+ * @addtogroup CME_M7
+ */
+
+/*@{*/
+
+extern int  rt_application_init(void);
+
+#ifdef __CC_ARM
+extern int Image$$RW_IRAM1$$ZI$$Limit;
+#define SRAM_BEGIN    (&Image$$RW_IRAM1$$ZI$$Limit)
+#elif __ICCARM__
+#pragma section="HEAP"
+#define SRAM_BEGIN    (__segment_end("HEAP"))
+#else
+extern int __bss_end;
+#define SRAM_BEGIN    (&__bss_end)
+#endif
+
+/**
+ * This function will startup RT-Thread RTOS.
+ */
+void rtthread_startup(void)
+{
+    /* init board */
+    rt_hw_board_init();
+
+    /* show version */
+    rt_show_version();
+
+    /* init timer system */
+    rt_system_timer_init();
+
+    rt_system_heap_init((void*)SRAM_BEGIN, (void*)SRAM_END);
+
+    /* init scheduler system */
+    rt_system_scheduler_init();
+
+    /* init application */
+    rt_application_init();
+
+    /* init timer thread */
+    rt_system_timer_thread_init();
+
+    /* init idle thread */
+    rt_thread_idle_init();
+
+    /* start scheduler */
+    rt_system_scheduler_start();
+
+    /* never reach here */
+    return ;
+}
+
+int main(void)
+{
+    /* disable interrupt first */
+    rt_hw_interrupt_disable();
+
+    /* startup RT-Thread RTOS */
+    rtthread_startup();
+
+    return 0;
+}
+
+/*@}*/

+ 20 - 0
bsp/CME_M7/drivers/SConscript

@@ -0,0 +1,20 @@
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd     = os.path.join(str(Dir('#')), 'drivers')
+
+src	= ['board.c']
+
+# add uart driver.
+src	+= ['uart.c']
+
+# add EMAC driver for Lwip.
+if GetDepend('RT_USING_LWIP') == True:
+    src += ['emac.c', 'app_phy.c']
+
+CPPPATH = [cwd]
+
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')

+ 125 - 0
bsp/CME_M7/drivers/app_phy.c

@@ -0,0 +1,125 @@
+#include <stdio.h>
+#include "app_phy.h"
+
+#define PHY_BASE_ADDR                           0x7
+
+#define PHY_REG_CONTROL             0x0
+#define PHY_REG_STATUS              0x1
+#define PHY_REG_ANE                 0x6
+#define PHY_REG_SPEC_STATUS         0x11
+#define PHY_REG_EXTEND_STATUS               0x1B
+
+#define PHY_BIT_CONTROL_RESET           0x8000          /*!< Control reg : reset */
+#define PHY_BIT_CONTROL_ANEN            0x1000          /*!< Control reg : auto-negotiation enable */
+#define PHY_BIT_CONTROL_RSAN            0x0200          /*!< Control reg : auto-negotiation restart */
+
+#define PHY_BIT_STATUS_ANC              0x0020          /*!< Status reg : auto-negotiation complete */
+#define PHY_BIT_STATUS_LINK             0x0004          /*!< Status reg : link is up */
+
+#define PHY_BIT_ANE_LPAN                0x0001          /*!< ANE reg : link partner can auto-neg */
+
+#define PHY_BIT_SPEED                   0xC000      /*!< specific status reg : speed */
+#define PHY_BIT_DUPLEX                  0x2000      /*!< specific status reg : duplex */
+
+#define PHY_BIT_AUTO_MEDIA_DISABLE      0x8000      /*!< extended status reg : auto media select disable */
+#define PHY_BIT_AUTO_MEDIA_REG_DISABLE  0x0200      /*!< extended status reg : auto media register select disable */
+
+void phy_Reset() {
+    ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_CONTROL, PHY_BIT_CONTROL_RESET);
+
+    while (1) {
+        uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_CONTROL);
+      if ((ret & PHY_BIT_CONTROL_RESET) == 0) {
+            break;
+        }
+    }
+}
+
+void phy_AutoMediaSelect() {
+    uint32_t data;
+
+    // auto media and auto media register selection
+    data = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS);
+    data &= ~PHY_BIT_AUTO_MEDIA_DISABLE;
+    data &= ~PHY_BIT_AUTO_MEDIA_REG_DISABLE;
+    ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS, data);
+}
+
+void phy_AutoNeg()
+{
+    uint32_t data;
+
+    data = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_CONTROL);
+    data |= (PHY_BIT_CONTROL_ANEN | PHY_BIT_CONTROL_RSAN);
+    ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_CONTROL, data);
+
+    while (1)
+    {
+        uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_STATUS);
+        if ((ret & PHY_BIT_STATUS_ANC) == PHY_BIT_STATUS_ANC)
+        {
+            break;
+        }
+        rt_thread_delay(1);
+    }
+}
+
+BOOL phy_IsLink() {
+    uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_STATUS);
+    return (ret & PHY_BIT_STATUS_LINK) ? TRUE : FALSE;
+}
+
+BOOL phy_PartnerCanAutoNeg() {
+    uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_ANE);
+    return (ret & PHY_BIT_ANE_LPAN) ? TRUE : FALSE;
+}
+
+uint32_t phy_GetSpeed() {
+    uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_SPEC_STATUS);
+    return ((ret & PHY_BIT_SPEED) >> 14);
+}
+
+uint32_t phy_GetDuplex() {
+    uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_SPEC_STATUS);
+    return ((ret & PHY_BIT_DUPLEX) >> 13);
+}
+
+BOOL phy_Init() {
+    phy_AutoMediaSelect();
+    phy_AutoNeg();
+
+    if (!phy_PartnerCanAutoNeg()) {
+        printf("Warning:: PHY's partner can't do auto-negotiation\n");
+    }
+
+    if (!phy_IsLink()) {
+        printf("link is down\n");
+        return FALSE;
+    }
+
+    {
+        uint32_t speed = phy_GetSpeed();
+        if (speed == PHY_SPEED_10) {
+            speed = 10;
+        } else if (speed == PHY_SPEED_100) {
+            speed = 100;
+        } else if (speed == PHY_SPEED_1000) {
+            speed = 1000;
+        }
+
+        printf("PHY runs in %dM speed %s duplex\n",
+            speed, (phy_GetDuplex() == PHY_DUPLEX_HALF) ? "half" : "full");
+    }
+
+    // After auto-negcioation, Mawell PHY need some
+    // time to initial itself.
+    // So we have to delay some time since different
+    // connection way, such as direct wire, hub, switch.
+    // If not to delay, the first several sent frame
+    // may be lost.
+    // Please according to actual environment to tune
+    // this delay.
+    udelay(200000);
+
+    return TRUE;
+}

+ 32 - 0
bsp/CME_M7/drivers/app_phy.h

@@ -0,0 +1,32 @@
+#ifndef __APP_PHY_H
+#define __APP_PHY_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "cmem7_includes.h"
+
+#define PHY_SPEED_10                    0x0         /*!< SPEED : 10M  */
+#define PHY_SPEED_100                   0x1         /*!< SPEED : 100M  */
+#define PHY_SPEED_1000                  0x2         /*!< SPEED : 1000M  */
+
+#define PHY_DUPLEX_HALF                 0x0         /*!< DUPLEX : half  */
+#define PHY_DUPLEX_FULL                 0x1         /*!< DUPLEX : full  */
+
+void phy_Reset(void);
+void phy_AutoNeg(void);
+BOOL phy_IsLink(void);
+BOOL phy_PartnerCanAutoNeg(void);
+uint32_t phy_GetSpeed(void);
+uint32_t phy_GetDuplex(void);
+BOOL phy_Init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+

+ 58 - 0
bsp/CME_M7/drivers/board.c

@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2014-08-03     aozima       first implementation
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+
+#include "board.h"
+
+/**
+ * @addtogroup CME_M7
+ */
+
+/*@{*/
+
+/**
+ * This is the timer interrupt service routine.
+ *
+ */
+void SysTick_Handler(void)
+{
+    /* enter interrupt */
+    rt_interrupt_enter();
+
+    rt_tick_increase();
+
+    /* leave interrupt */
+    rt_interrupt_leave();
+}
+
+static void idle_hook(void)
+{
+    __WFI();
+}
+
+/**
+ * This function will initial board.
+ */
+void rt_hw_board_init()
+{
+    //rt_thread_idle_sethook(idle_hook);
+
+    /* Configure the NVIC Preemption Priority Bits */
+    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
+
+    SysTick_Config(SYSTEM_CLOCK_FREQ / RT_TICK_PER_SECOND);
+
+    rt_components_board_init();
+    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+}
+
+/*@}*/

+ 27 - 0
bsp/CME_M7/drivers/board.h

@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2014-08-03     aozima       first implementation
+ */
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
+
+#include "cmem7_includes.h"
+//#include "cmem7_retarget.h"
+
+#define SRAM_SIZE         64    // KB
+#define SRAM_END          (0x20000000 + SRAM_SIZE * 1024)
+
+//#define RT_USING_UART0
+//#define RT_USING_UART1
+#define RT_USING_UART2
+
+void rt_hw_board_init(void);
+
+#endif
+

+ 455 - 0
bsp/CME_M7/drivers/emac.c

@@ -0,0 +1,455 @@
+/*
+ * File      : emac.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006-2021, RT-Thread Develop Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2014-08-29     aozima       first implementation
+ */
+
+#include <rtthread.h>
+#include <netif/ethernetif.h>
+#include "lwipopts.h"
+
+#include "board.h"
+
+#include "app_phy.h"
+
+/* debug option */
+#define ETH_DEBUG
+//#define ETH_RX_DUMP
+//#define ETH_TX_DUMP
+
+#ifdef ETH_DEBUG
+#define CME_ETH_PRINTF          rt_kprintf
+#else
+#define CME_ETH_PRINTF(...)
+#endif
+
+#define MAX_ADDR_LEN 6
+struct rt_cme_eth
+{
+    /* inherit from ethernet device */
+    struct eth_device parent;
+
+    /* interface address info. */
+    rt_uint8_t  dev_addr[MAX_ADDR_LEN];         /* hw address   */
+
+    uint32_t    ETH_Speed;
+    uint32_t    ETH_Mode;
+
+    struct rt_semaphore tx_buf_free;
+    struct rt_mutex     lock;
+};
+static struct rt_cme_eth cme_eth_device;
+
+#if defined(ETH_RX_DUMP) ||  defined(ETH_TX_DUMP)
+static void packet_dump(const char * msg, const struct pbuf* p)
+{
+    const struct pbuf* q;
+    rt_uint32_t i,j;
+    rt_uint8_t *ptr;
+
+    rt_kprintf("%s %d byte\n", msg, p->tot_len);
+
+    i=0;
+    for(q=p; q != RT_NULL; q= q->next)
+    {
+        ptr = q->payload;
+
+        for(j=0; j<q->len; j++)
+        {
+            if( (i%8) == 0 )
+            {
+                rt_kprintf("  ");
+            }
+            if( (i%16) == 0 )
+            {
+                rt_kprintf("\r\n");
+            }
+            rt_kprintf("%02x ",*ptr);
+
+            i++;
+            ptr++;
+        }
+    }
+
+    rt_kprintf("\n\n");
+}
+#else
+#define packet_dump(...)
+#endif /* dump */
+
+/////////////////////////////////////////////////////////////////
+uint32_t rxTotalMemory = 0x2000;
+uint32_t rxDescNum = 3;
+uint32_t rxBufSize = 0x400;
+uint32_t rxBaseAddr = 0x2000C000;// C000-48K
+uint32_t txBaseAddr = 0x2000E000;// E000-56K
+uint32_t txTotalMemory = 0x2000;
+BOOL isRxNoBuf = FALSE;
+
+#define ETH_MAX_PACKET_SIZE    1520    /* ETH_HEADER + ETH_EXTRA + MAX_ETH_PAYLOAD + ETH_CRC */
+#define ETH_RXBUFNB         4
+#define ETH_TXBUFNB         2
+
+struct eth_rx_buffer
+{
+    ETH_RX_DESC desc;
+    uint32_t buffer[ETH_MAX_PACKET_SIZE/4];
+};
+
+struct eth_tx_buffer
+{
+    ETH_TX_DESC desc;
+    uint32_t buffer[ETH_MAX_PACKET_SIZE/4];
+};
+
+static struct eth_rx_buffer rx_buffer[ETH_RXBUFNB];
+static struct eth_tx_buffer tx_buffer[ETH_TXBUFNB];
+
+static void RxDescChainInit(void)
+{
+    uint32_t i;
+
+    // initialize rx descriptor
+    ETH_RX_DESC *desc = &rx_buffer[0].desc;
+
+    for (i = 0; i < ETH_RXBUFNB; i++)
+    {
+        desc->RX_1.RX1_b.SIZE = ETH_MAX_PACKET_SIZE;
+        desc->bufAddr = (uint32_t)rx_buffer[i].buffer;
+
+        if((i+1) == ETH_RXBUFNB)
+            desc->nextDescAddr = (uint32_t)&rx_buffer[0].desc;
+        else
+            desc->nextDescAddr = (uint32_t)&rx_buffer[i+1].desc;
+
+        desc = (ETH_RX_DESC *)desc->nextDescAddr;
+    }
+
+    ETH_SetRxDescRing(&rx_buffer[0].desc);
+}
+
+static void TxDescChainInit(void)
+{
+    uint32_t i;
+
+    // initialize tx descriptor
+    ETH_TX_DESC *desc = &tx_buffer[0].desc;
+
+    for (i = 0; i < ETH_TXBUFNB; i++)
+    {
+        desc->TX_1.TX1_b.SIZE = ETH_MAX_PACKET_SIZE;
+        desc->bufAddr = (uint32_t)tx_buffer[i].buffer;
+
+        if((i+1) == ETH_TXBUFNB)
+            desc->nextDescAddr = (uint32_t)&tx_buffer[0].desc;
+        else
+            desc->nextDescAddr = (uint32_t)&tx_buffer[i+1].desc;
+
+        desc = (ETH_TX_DESC *)desc->nextDescAddr;
+    }
+
+    ETH_SetTxDescRing(&tx_buffer[0].desc);
+}
+
+/////////////////////////////////////////////////////////////////
+
+/* initialize the interface */
+static rt_err_t rt_cme_eth_init(rt_device_t dev)
+{
+    struct rt_cme_eth * cme_eth = (struct rt_cme_eth *)dev;
+
+    ETH_InitTypeDef init;
+    ETH_FrameFilter flt;
+
+    init.ETH_Speed = phy_GetSpeed();
+    init.ETH_Duplex = phy_GetDuplex();
+    init.ETH_LinkUp = phy_IsLink();
+    init.ETH_RxEn = TRUE;
+    init.ETH_TxEn = TRUE;
+    init.ETH_ChecksumOffload = FALSE;
+    init.ETH_JumboFrame = FALSE;
+
+    memcpy(init.ETH_MacAddr, cme_eth->dev_addr, sizeof(init.ETH_MacAddr));
+
+    // Disable broadcast;
+    // TODO: why?
+    memset(&flt, 0, sizeof(ETH_FrameFilter));
+    flt.ETH_BroadcastFilterEnable = FALSE;
+    flt.ETH_OwnFilterEnable = FALSE;
+    flt.ETH_SelfDrop = FALSE;
+    flt.ETH_SourceFilterEnable = FALSE;
+    flt.ETH_SourceDrop = FALSE;
+
+    init.ETH_Filter = &flt;
+
+    if (!phy_Init())
+    {
+        rt_kprintf("phy_Init failed!\n");
+        while (1);
+    }
+
+    if (!ETH_Init(&init))
+    {
+        rt_kprintf("ETH_Init failed!\n");
+        while (1);
+    }
+
+    RxDescChainInit();
+    TxDescChainInit();
+
+    ETH_ITConfig(ETH_INT_BUS_FATAL_ERROR, TRUE);
+
+    ETH_ITConfig(ETH_INT_RX_COMPLETE_FRAME, TRUE);
+    ETH_ITConfig(ETH_INT_RX_BUF_UNAVAI, TRUE);
+    ETH_ITConfig(ETH_INT_RX_STOP, TRUE);
+    ETH_StartRx();
+
+    ETH_ITConfig(ETH_INT_TX_COMPLETE_FRAME, TRUE);
+    ETH_StartTx();
+
+    return RT_EOK;
+}
+
+static rt_err_t rt_cme_eth_open(rt_device_t dev, rt_uint16_t oflag)
+{
+    return RT_EOK;
+}
+
+static rt_err_t rt_cme_eth_close(rt_device_t dev)
+{
+    return RT_EOK;
+}
+
+static rt_size_t rt_cme_eth_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
+{
+    rt_set_errno(-RT_ENOSYS);
+    return 0;
+}
+
+static rt_size_t rt_cme_eth_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
+{
+    rt_set_errno(-RT_ENOSYS);
+    return 0;
+}
+
+static rt_err_t rt_cme_eth_control(rt_device_t dev, int cmd, void *args)
+{
+    switch(cmd)
+    {
+    case NIOCTL_GADDR:
+        /* get mac address */
+        if(args) rt_memcpy(args, cme_eth_device.dev_addr, 6);
+        else return -RT_ERROR;
+        break;
+
+    default :
+        break;
+    }
+
+    return RT_EOK;
+}
+
+/* ethernet device interface */
+/* transmit packet. */
+rt_err_t rt_cme_eth_tx( rt_device_t dev, struct pbuf* p)
+{
+    rt_err_t result = RT_EOK;
+    ETH_TX_DESC *desc;
+    struct rt_cme_eth * cme_eth = (struct rt_cme_eth *)dev;
+
+    rt_mutex_take(&cme_eth->lock, RT_WAITING_FOREVER);
+
+#ifdef ETH_TX_DUMP
+    packet_dump("TX dump", p);
+#endif /* ETH_TX_DUMP */
+
+    /* get free tx buffer */
+    {
+        rt_err_t result;
+        result = rt_sem_take(&cme_eth->tx_buf_free, RT_TICK_PER_SECOND/10);
+        if (result != RT_EOK)
+        {
+            result = -RT_ERROR;
+            goto _exit;
+        }
+    }
+
+    desc = ETH_AcquireFreeTxDesc();
+    if(desc == RT_NULL)
+    {
+        CME_ETH_PRINTF("TxDesc not ready!\n");
+        RT_ASSERT(0);
+            result = -RT_ERROR;
+            goto _exit;
+    }
+
+    desc->TX_0.TX0_b.FS = TRUE;
+    desc->TX_0.TX0_b.LS = TRUE;
+    desc->TX_1.TX1_b.SIZE = p->tot_len;
+
+    pbuf_copy_partial(p, ( void *)(desc->bufAddr), p->tot_len, 0);
+
+    ETH_ReleaseTxDesc(desc);
+    ETH_ResumeTx();
+
+_exit:
+    rt_mutex_release(&cme_eth->lock);
+    return result;
+}
+
+/* reception packet. */
+struct pbuf *rt_cme_eth_rx(rt_device_t dev)
+{
+    struct pbuf* p = RT_NULL;
+    ETH_RX_DESC *desc;
+    uint32_t framelength;
+    struct rt_cme_eth * cme_eth = (struct rt_cme_eth *)dev;
+    rt_err_t result;
+
+    result = rt_mutex_take(&cme_eth->lock, RT_WAITING_FOREVER);
+    if (result == -RT_ETIMEOUT)
+    {
+        rt_kprintf("Take mutex time out.\n");
+        goto _exit;
+    }
+    else if (result == -RT_ERROR)
+    {
+        rt_kprintf("Take mutex error.\n");
+        goto _exit;
+    }
+
+    desc = ETH_AcquireFreeRxDesc();
+    if(desc == RT_NULL)
+    {
+        ETH_ITConfig(ETH_INT_RX_COMPLETE_FRAME, TRUE);
+        ETH_ITConfig(ETH_INT_RX_BUF_UNAVAI, TRUE);
+        ETH_ResumeRx();
+        goto _exit;
+    }
+
+    framelength = desc->RX_0.RX0_b.FL;
+
+    /* allocate buffer */
+    p = pbuf_alloc(PBUF_LINK, framelength, PBUF_RAM);
+    if (p != RT_NULL)
+    {
+        pbuf_take(p, (const void *)(desc->bufAddr), framelength);
+#ifdef ETH_RX_DUMP
+        packet_dump("RX dump", p);
+#endif /* ETH_RX_DUMP */
+    }
+
+    ETH_ReleaseRxDesc(desc);
+
+_exit:
+    rt_mutex_release(&cme_eth->lock);
+    return p;
+}
+
+static void NVIC_Configuration(void)
+{
+    NVIC_InitTypeDef NVIC_InitStructure;
+
+    /* Enable the USARTy Interrupt */
+    NVIC_InitStructure.NVIC_IRQChannel = ETH_INT_IRQn;
+    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
+    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
+    NVIC_InitStructure.NVIC_IRQChannelCmd = TRUE;
+    NVIC_Init(&NVIC_InitStructure);
+}
+
+int cme_m7_eth_init(void)
+{
+//    /* PHY RESET: PA4 */
+//    {
+//        GPIO_ResetBits(GPIOA, GPIO_Pin_4);
+//        rt_thread_delay(2);
+//        GPIO_SetBits(GPIOA, GPIO_Pin_4);
+//        rt_thread_delay(2);
+//    }
+
+//    GPIO_Configuration();
+    NVIC_Configuration();
+
+//    cme_eth_device.ETH_Speed = ETH_Speed_100M;
+//    cme_eth_device.ETH_Mode  = ETH_Mode_FullDuplex;
+
+    /* OUI 00-80-E1 STMICROELECTRONICS. */
+    cme_eth_device.dev_addr[0] = 0x00;
+    cme_eth_device.dev_addr[1] = 0x80;
+    cme_eth_device.dev_addr[2] = 0xE1;
+    /* generate MAC addr from 96bit unique ID (only for test). */
+//    cme_eth_device.dev_addr[3] = *(rt_uint8_t*)(0x1FFF7A10+4);
+//    cme_eth_device.dev_addr[4] = *(rt_uint8_t*)(0x1FFF7A10+2);
+//    cme_eth_device.dev_addr[5] = *(rt_uint8_t*)(0x1FFF7A10+0);
+    cme_eth_device.dev_addr[3] = 12;
+    cme_eth_device.dev_addr[4] = 34;
+    cme_eth_device.dev_addr[5] = 56;
+
+    cme_eth_device.parent.parent.init       = rt_cme_eth_init;
+    cme_eth_device.parent.parent.open       = rt_cme_eth_open;
+    cme_eth_device.parent.parent.close      = rt_cme_eth_close;
+    cme_eth_device.parent.parent.read       = rt_cme_eth_read;
+    cme_eth_device.parent.parent.write      = rt_cme_eth_write;
+    cme_eth_device.parent.parent.control    = rt_cme_eth_control;
+    cme_eth_device.parent.parent.user_data  = RT_NULL;
+
+    cme_eth_device.parent.eth_rx     = rt_cme_eth_rx;
+    cme_eth_device.parent.eth_tx     = rt_cme_eth_tx;
+
+    /* init EMAC lock */
+    rt_mutex_init(&cme_eth_device.lock, "emac0", RT_IPC_FLAG_PRIO);
+
+    /* init tx buffer free semaphore */
+    rt_sem_init(&cme_eth_device.tx_buf_free,
+                "tx_buf",
+                ETH_TXBUFNB,
+                RT_IPC_FLAG_FIFO);
+
+    /* register eth device */
+    eth_device_init(&(cme_eth_device.parent), "e0");
+
+    return RT_EOK;
+}
+
+void ETH_IRQHandler(void)
+{
+    /* enter interrupt */
+    rt_interrupt_enter();
+
+    if (ETH_GetITStatus(ETH_INT_TX_COMPLETE_FRAME))
+    {
+        rt_sem_release(&cme_eth_device.tx_buf_free);
+        ETH_ClearITPendingBit(ETH_INT_TX_COMPLETE_FRAME);
+    }
+
+    if (ETH_GetITStatus(ETH_INT_RX_STOP))
+    {
+        CME_ETH_PRINTF("ETH_INT_RX_STOP\n");
+        ETH_ClearITPendingBit(ETH_INT_RX_STOP);
+    }
+
+    if ((ETH_GetITStatus(ETH_INT_RX_BUF_UNAVAI)) ||
+            (ETH_GetITStatus(ETH_INT_RX_COMPLETE_FRAME)))
+    {
+        /* a frame has been received */
+        eth_device_ready(&(cme_eth_device.parent));
+
+        ETH_ITConfig(ETH_INT_RX_COMPLETE_FRAME, FALSE);
+        ETH_ITConfig(ETH_INT_RX_BUF_UNAVAI, FALSE);
+        ETH_ClearITPendingBit(ETH_INT_RX_BUF_UNAVAI);
+        ETH_ClearITPendingBit(ETH_INT_RX_COMPLETE_FRAME);
+    }
+
+    /* leave interrupt */
+    rt_interrupt_leave();
+}
+

+ 217 - 0
bsp/CME_M7/drivers/uart.c

@@ -0,0 +1,217 @@
+#include <rthw.h>
+#include <rtthread.h>
+#include <rtdevice.h>
+
+#include <board.h>
+
+/* CME-M7 uart driver */
+struct CME_M7_uart
+{
+    UART0_Type* uart_device;
+    IRQn_Type irq;
+};
+
+#ifdef RT_USING_UART0
+struct CME_M7_uart uart0 =
+{
+    UART0,
+    UART0_INT_IRQn,
+};
+static struct rt_serial_device serial0;
+#endif /* RT_USING_UART0 */
+
+#ifdef RT_USING_UART2
+struct CME_M7_uart uart2 =
+{
+    UART2,
+    UART2_INT_IRQn,
+};
+static struct rt_serial_device serial2;
+#endif /* RT_USING_UART2 */
+
+static rt_err_t CME_M7_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
+{
+    struct CME_M7_uart* uart;
+    UART_InitTypeDef init;
+
+    RT_ASSERT(serial != RT_NULL);
+    RT_ASSERT(cfg != RT_NULL);
+
+    uart = (struct CME_M7_uart *)serial->parent.user_data;
+
+    init.UART_BaudRate = cfg->baud_rate;
+    init.UART_StopBits = UART_StopBits_1;
+    init.UART_Parity = UART_Parity_None;
+    init.UART_LoopBack = FALSE;
+    init.UART_RxEn = TRUE;
+    init.UART_CtsEn = FALSE;
+
+    UART_Init(uart->uart_device, &init);
+    uart->uart_device->RX_RESET = 1;
+    UART_Enable(uart->uart_device, TRUE);
+    uart->uart_device->RX_RESET = 0;
+
+    return RT_EOK;
+}
+
+static rt_err_t CME_M7_control(struct rt_serial_device *serial, int cmd, void *arg)
+{
+    struct CME_M7_uart* uart;
+    NVIC_InitTypeDef NVIC_InitStructure;
+
+    RT_ASSERT(serial != RT_NULL);
+    uart = (struct CME_M7_uart *)serial->parent.user_data;
+
+    switch (cmd)
+    {
+    case RT_DEVICE_CTRL_CLR_INT:
+        /* disable rx irq */
+        NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
+        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
+        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
+        NVIC_InitStructure.NVIC_IRQChannelCmd = FALSE;
+        NVIC_Init(&NVIC_InitStructure);
+
+        UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, FALSE);
+        break;
+
+    case RT_DEVICE_CTRL_SET_INT:
+        /* enable rx irq */
+        NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
+        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
+        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
+        NVIC_InitStructure.NVIC_IRQChannelCmd = TRUE;
+        NVIC_Init(&NVIC_InitStructure);
+
+        UART_ClearInt(uart->uart_device, UART_Int_RxNotEmpty);
+        UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, TRUE);
+        break;
+    }
+
+    return RT_EOK;
+}
+
+static int CME_M7_putc(struct rt_serial_device *serial, char ch)
+{
+    struct CME_M7_uart* uart;
+
+    RT_ASSERT(serial != RT_NULL);
+    uart = (struct CME_M7_uart *)serial->parent.user_data;
+
+    while(uart->uart_device->STATUS_b.TF); //waits for transmitter FIFO not full.
+    uart->uart_device->TX_BUF = ch;
+
+    return 1;
+}
+
+static int CME_M7_getc(struct rt_serial_device *serial)
+{
+    int ch;
+    struct CME_M7_uart* uart;
+
+    RT_ASSERT(serial != RT_NULL);
+    uart = (struct CME_M7_uart *)serial->parent.user_data;
+
+    ch = -1;
+
+    if(uart->uart_device->STATUS_b.RNE)
+    {
+        ch = uart->uart_device->RX_BUF & 0x00FF; /* Get Data from UART RX  */
+    }
+
+    return ch;
+}
+
+static const struct rt_uart_ops CME_M7_uart_ops =
+{
+    CME_M7_configure,
+    CME_M7_control,
+    CME_M7_putc,
+    CME_M7_getc,
+};
+
+int rt_hw_uart_init(void)
+{
+    struct CME_M7_uart* uart;
+    struct rt_serial_device *serial;
+    struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
+
+#ifdef RT_USING_UART0
+    uart = &uart0;
+    serial = &serial0;
+
+    serial->ops    = &CME_M7_uart_ops;
+    serial->config = config;
+
+    /* register UART device */
+    rt_hw_serial_register(serial,
+                          "uart0",
+                          RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+                          uart);
+#endif /* RT_USING_UART0 */
+
+#ifdef RT_USING_UART2
+    uart = &uart2;
+    serial = &serial2;
+
+    serial->ops    = &CME_M7_uart_ops;
+    serial->config = config;
+
+    /* register UART device */
+    rt_hw_serial_register(serial,
+                          "uart2",
+                          RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+                          uart);
+#endif /* RT_USING_UART2 */
+
+    return RT_EOK;
+}
+INIT_BOARD_EXPORT(rt_hw_uart_init);
+
+static void CME_UART_IRQHandler(struct rt_serial_device *serial)
+{
+    struct CME_M7_uart* uart;
+
+    RT_ASSERT(serial != RT_NULL);
+    uart = (struct CME_M7_uart *)serial->parent.user_data;
+
+    if(UART_GetIntStatus(uart->uart_device, UART_Int_RxNotEmpty))
+    {
+        UART_ClearInt(uart->uart_device, UART_Int_RxNotEmpty);
+        rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND);
+    }
+
+    if(UART_GetIntStatus(uart->uart_device, UART_Int_RxThresholdReach))
+    {
+        UART_ClearInt(uart->uart_device, UART_Int_RxThresholdReach);
+    }
+
+    if(UART_GetIntStatus(uart->uart_device, UART_Int_OverrunError))
+    {
+        UART_ClearInt(uart->uart_device, UART_Int_OverrunError);
+    }
+
+    if(UART_GetIntStatus(uart->uart_device, UART_Int_FrameError))
+    {
+        UART_ClearInt(uart->uart_device, UART_Int_FrameError);
+    }
+
+    if(UART_GetIntStatus(uart->uart_device, UART_Int_ParityError))
+    {
+        UART_ClearInt(uart->uart_device, UART_Int_ParityError);
+    }
+}
+
+#ifdef RT_USING_UART0
+void UART0_IRQHandler(void)
+{
+    CME_UART_IRQHandler(&serial0);
+}
+#endif /* RT_USING_UART0 */
+
+#ifdef RT_USING_UART2
+void UART2_IRQHandler(void)
+{
+    CME_UART_IRQHandler(&serial2);
+}
+#endif /* RT_USING_UART2 */

+ 170 - 0
bsp/CME_M7/project.uvopt

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
+
+  <SchemaVersion>1.0</SchemaVersion>
+
+  <Header>### uVision Project, (C) Keil Software</Header>
+
+  <Extensions>
+    <cExt>*.c</cExt>
+    <aExt>*.s*; *.src; *.a*</aExt>
+    <oExt>*.obj</oExt>
+    <lExt>*.lib</lExt>
+    <tExt>*.txt; *.h; *.inc</tExt>
+    <pExt>*.plm</pExt>
+    <CppX>*.cpp</CppX>
+  </Extensions>
+
+  <DaveTm>
+    <dwLowDateTime>0</dwLowDateTime>
+    <dwHighDateTime>0</dwHighDateTime>
+  </DaveTm>
+
+  <Target>
+    <TargetName>rtthread</TargetName>
+    <ToolsetNumber>0x4</ToolsetNumber>
+    <ToolsetName>ARM-ADS</ToolsetName>
+    <TargetOption>
+      <CLKADS>10000000</CLKADS>
+      <OPTTT>
+        <gFlags>1</gFlags>
+        <BeepAtEnd>1</BeepAtEnd>
+        <RunSim>0</RunSim>
+        <RunTarget>1</RunTarget>
+      </OPTTT>
+      <OPTHX>
+        <HexSelection>1</HexSelection>
+        <FlashByte>65535</FlashByte>
+        <HexRangeLowAddress>0</HexRangeLowAddress>
+        <HexRangeHighAddress>0</HexRangeHighAddress>
+        <HexOffset>0</HexOffset>
+      </OPTHX>
+      <OPTLEX>
+        <PageWidth>79</PageWidth>
+        <PageLength>66</PageLength>
+        <TabStop>8</TabStop>
+        <ListingPath>.\build\</ListingPath>
+      </OPTLEX>
+      <ListingPage>
+        <CreateCListing>1</CreateCListing>
+        <CreateAListing>1</CreateAListing>
+        <CreateLListing>1</CreateLListing>
+        <CreateIListing>0</CreateIListing>
+        <AsmCond>1</AsmCond>
+        <AsmSymb>1</AsmSymb>
+        <AsmXref>0</AsmXref>
+        <CCond>1</CCond>
+        <CCode>0</CCode>
+        <CListInc>0</CListInc>
+        <CSymb>0</CSymb>
+        <LinkerCodeListing>0</LinkerCodeListing>
+      </ListingPage>
+      <OPTXL>
+        <LMap>1</LMap>
+        <LComments>1</LComments>
+        <LGenerateSymbols>1</LGenerateSymbols>
+        <LLibSym>1</LLibSym>
+        <LLines>1</LLines>
+        <LLocSym>1</LLocSym>
+        <LPubSym>1</LPubSym>
+        <LXref>0</LXref>
+        <LExpSel>0</LExpSel>
+      </OPTXL>
+      <OPTFL>
+        <tvExp>1</tvExp>
+        <tvExpOptDlg>0</tvExpOptDlg>
+        <IsCurrentTarget>1</IsCurrentTarget>
+      </OPTFL>
+      <CpuCode>0</CpuCode>
+      <DebugOpt>
+        <uSim>0</uSim>
+        <uTrg>1</uTrg>
+        <sLdApp>1</sLdApp>
+        <sGomain>1</sGomain>
+        <sRbreak>1</sRbreak>
+        <sRwatch>1</sRwatch>
+        <sRmem>1</sRmem>
+        <sRfunc>1</sRfunc>
+        <sRbox>1</sRbox>
+        <tLdApp>1</tLdApp>
+        <tGomain>1</tGomain>
+        <tRbreak>1</tRbreak>
+        <tRwatch>1</tRwatch>
+        <tRmem>1</tRmem>
+        <tRfunc>0</tRfunc>
+        <tRbox>1</tRbox>
+        <tRtrace>1</tRtrace>
+        <sRSysVw>1</sRSysVw>
+        <tRSysVw>1</tRSysVw>
+        <tPdscDbg>1</tPdscDbg>
+        <sRunDeb>0</sRunDeb>
+        <sLrtime>0</sLrtime>
+        <nTsel>17</nTsel>
+        <sDll></sDll>
+        <sDllPa></sDllPa>
+        <sDlgDll></sDlgDll>
+        <sDlgPa></sDlgPa>
+        <sIfile></sIfile>
+        <tDll></tDll>
+        <tDllPa></tDllPa>
+        <tDlgDll></tDlgDll>
+        <tDlgPa></tDlgPa>
+        <tIfile></tIfile>
+        <pMon>CapitalMicro\BIN\cmagdi.dll</pMon>
+      </DebugOpt>
+      <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>UL2CM3</Key>
+          <Name>-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>Nu_Link</Key>
+          <Name>-S1 -B115200 -O0</Name>
+        </SetRegEntry>
+      </TargetDriverDllRegistry>
+      <Breakpoint/>
+      <Tracepoint>
+        <THDelay>0</THDelay>
+      </Tracepoint>
+      <DebugFlag>
+        <trace>0</trace>
+        <periodic>1</periodic>
+        <aLwin>0</aLwin>
+        <aCover>0</aCover>
+        <aSer1>0</aSer1>
+        <aSer2>0</aSer2>
+        <aPa>0</aPa>
+        <viewmode>0</viewmode>
+        <vrSel>0</vrSel>
+        <aSym>0</aSym>
+        <aTbox>0</aTbox>
+        <AscS1>0</AscS1>
+        <AscS2>0</AscS2>
+        <AscS3>0</AscS3>
+        <aSer3>0</aSer3>
+        <eProf>0</eProf>
+        <aLa>0</aLa>
+        <aPa1>0</aPa1>
+        <AscS4>0</AscS4>
+        <aSer4>0</aSer4>
+        <StkLoc>0</StkLoc>
+        <TrcWin>0</TrcWin>
+        <newCpu>0</newCpu>
+        <uProt>0</uProt>
+      </DebugFlag>
+      <LintExecutable></LintExecutable>
+      <LintConfigFile></LintConfigFile>
+    </TargetOption>
+  </Target>
+
+  <Group>
+    <GroupName>Source Group 1</GroupName>
+    <tvExp>0</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+  </Group>
+
+</ProjectOpt>

+ 1177 - 0
bsp/CME_M7/project.uvproj

@@ -0,0 +1,1177 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
+  <SchemaVersion>1.1</SchemaVersion>
+  <Header>### uVision Project, (C) Keil Software</Header>
+  <Targets>
+    <Target>
+      <TargetName>rtthread</TargetName>
+      <ToolsetNumber>0x4</ToolsetNumber>
+      <ToolsetName>ARM-ADS</ToolsetName>
+      <TargetOption>
+        <TargetCommonOption>
+          <Device>ARMCM3</Device>
+          <Vendor>ARM</Vendor>
+          <PackID>ARM.CMSIS.4.1.0</PackID>
+          <PackURL>http://www.keil.com/pack/</PackURL>
+          <Cpu>CPUTYPE("Cortex-M3") CLOCK(10000000) ESEL ELITTLE</Cpu>
+          <FlashUtilSpec />
+          <StartupFile />
+          <FlashDriverDll />
+          <DeviceId>0</DeviceId>
+          <RegisterFile>$$Device:ARMCM3$Device\ARM\ARMCM3\Include\ARMCM3.h</RegisterFile>
+          <MemoryEnv />
+          <Cmp />
+          <Asm />
+          <Linker />
+          <OHString />
+          <InfinionOptionDll />
+          <SLE66CMisc />
+          <SLE66AMisc />
+          <SLE66LinkerMisc />
+          <SFDFile>$$Device:ARMCM3$Device\ARM\SVD\ARMCM3.svd</SFDFile>
+          <bCustSvd>0</bCustSvd>
+          <UseEnv>0</UseEnv>
+          <BinPath />
+          <IncludePath />
+          <LibPath />
+          <RegisterFilePath />
+          <DBRegisterFilePath />
+          <TargetStatus>
+            <Error>0</Error>
+            <ExitCodeStop>0</ExitCodeStop>
+            <ButtonStop>0</ButtonStop>
+            <NotGenerated>0</NotGenerated>
+            <InvalidFlash>1</InvalidFlash>
+          </TargetStatus>
+          <OutputDirectory>.\build\</OutputDirectory>
+          <OutputName>rtthread</OutputName>
+          <CreateExecutable>1</CreateExecutable>
+          <CreateLib>0</CreateLib>
+          <CreateHexFile>1</CreateHexFile>
+          <DebugInformation>1</DebugInformation>
+          <BrowseInformation>0</BrowseInformation>
+          <ListingPath>.\build\</ListingPath>
+          <HexFormatSelection>1</HexFormatSelection>
+          <Merge32K>0</Merge32K>
+          <CreateBatchFile>0</CreateBatchFile>
+          <BeforeCompile>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name />
+            <UserProg2Name />
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopU1X>0</nStopU1X>
+            <nStopU2X>0</nStopU2X>
+          </BeforeCompile>
+          <BeforeMake>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name />
+            <UserProg2Name />
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopB1X>0</nStopB1X>
+            <nStopB2X>0</nStopB2X>
+          </BeforeMake>
+          <AfterMake>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name>fromelf --bin !L --output rtthread.bin</UserProg1Name>
+            <UserProg2Name />
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+          </AfterMake>
+          <SelectedForBatchBuild>0</SelectedForBatchBuild>
+          <SVCSIdString />
+        </TargetCommonOption>
+        <CommonProperty>
+          <UseCPPCompiler>0</UseCPPCompiler>
+          <RVCTCodeConst>0</RVCTCodeConst>
+          <RVCTZI>0</RVCTZI>
+          <RVCTOtherData>0</RVCTOtherData>
+          <ModuleSelection>0</ModuleSelection>
+          <IncludeInBuild>1</IncludeInBuild>
+          <AlwaysBuild>0</AlwaysBuild>
+          <GenerateAssemblyFile>0</GenerateAssemblyFile>
+          <AssembleAssemblyFile>0</AssembleAssemblyFile>
+          <PublicsOnly>0</PublicsOnly>
+          <StopOnExitCode>3</StopOnExitCode>
+          <CustomArgument />
+          <IncludeLibraryModules />
+          <ComprImg>1</ComprImg>
+        </CommonProperty>
+        <DllOption>
+          <SimDllName>SARMCM3.DLL</SimDllName>
+          <SimDllArguments> </SimDllArguments>
+          <SimDlgDll>DCM.DLL</SimDlgDll>
+          <SimDlgDllArguments>-pCM3</SimDlgDllArguments>
+          <TargetDllName>SARMCM3.DLL</TargetDllName>
+          <TargetDllArguments />
+          <TargetDlgDll>TCM.DLL</TargetDlgDll>
+          <TargetDlgDllArguments>-pCM3</TargetDlgDllArguments>
+        </DllOption>
+        <DebugOption>
+          <OPTHX>
+            <HexSelection>1</HexSelection>
+            <HexRangeLowAddress>0</HexRangeLowAddress>
+            <HexRangeHighAddress>0</HexRangeHighAddress>
+            <HexOffset>0</HexOffset>
+            <Oh166RecLen>16</Oh166RecLen>
+          </OPTHX>
+          <Simulator>
+            <UseSimulator>0</UseSimulator>
+            <LoadApplicationAtStartup>1</LoadApplicationAtStartup>
+            <RunToMain>1</RunToMain>
+            <RestoreBreakpoints>1</RestoreBreakpoints>
+            <RestoreWatchpoints>1</RestoreWatchpoints>
+            <RestoreMemoryDisplay>1</RestoreMemoryDisplay>
+            <RestoreFunctions>1</RestoreFunctions>
+            <RestoreToolbox>1</RestoreToolbox>
+            <LimitSpeedToRealTime>0</LimitSpeedToRealTime>
+            <RestoreSysVw>1</RestoreSysVw>
+          </Simulator>
+          <Target>
+            <UseTarget>1</UseTarget>
+            <LoadApplicationAtStartup>1</LoadApplicationAtStartup>
+            <RunToMain>1</RunToMain>
+            <RestoreBreakpoints>1</RestoreBreakpoints>
+            <RestoreWatchpoints>1</RestoreWatchpoints>
+            <RestoreMemoryDisplay>1</RestoreMemoryDisplay>
+            <RestoreFunctions>0</RestoreFunctions>
+            <RestoreToolbox>1</RestoreToolbox>
+            <RestoreTracepoints>1</RestoreTracepoints>
+            <RestoreSysVw>1</RestoreSysVw>
+            <UsePdscDebugDescription>1</UsePdscDebugDescription>
+          </Target>
+          <RunDebugAfterBuild>0</RunDebugAfterBuild>
+          <TargetSelection>17</TargetSelection>
+          <SimDlls>
+            <CpuDll />
+            <CpuDllArguments />
+            <PeripheralDll />
+            <PeripheralDllArguments />
+            <InitializationFile />
+          </SimDlls>
+          <TargetDlls>
+            <CpuDll />
+            <CpuDllArguments />
+            <PeripheralDll />
+            <PeripheralDllArguments />
+            <InitializationFile />
+            <Driver>CapitalMicro\BIN\cmagdi.dll</Driver>
+          </TargetDlls>
+        </DebugOption>
+        <Utilities>
+          <Flash1>
+            <UseTargetDll>1</UseTargetDll>
+            <UseExternalTool>0</UseExternalTool>
+            <RunIndependent>0</RunIndependent>
+            <UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
+            <Capability>1</Capability>
+            <DriverSelection>4097</DriverSelection>
+          </Flash1>
+          <bUseTDR>0</bUseTDR>
+          <Flash2>BIN\UL2CM3.DLL</Flash2>
+          <Flash3>"" ()</Flash3>
+          <Flash4 />
+          <pFcarmOut />
+          <pFcarmGrp />
+          <pFcArmRoot />
+          <FcArmLst>0</FcArmLst>
+        </Utilities>
+        <TargetArmAds>
+          <ArmAdsMisc>
+            <GenerateListings>0</GenerateListings>
+            <asHll>1</asHll>
+            <asAsm>1</asAsm>
+            <asMacX>1</asMacX>
+            <asSyms>1</asSyms>
+            <asFals>1</asFals>
+            <asDbgD>1</asDbgD>
+            <asForm>1</asForm>
+            <ldLst>0</ldLst>
+            <ldmm>1</ldmm>
+            <ldXref>1</ldXref>
+            <BigEnd>0</BigEnd>
+            <AdsALst>1</AdsALst>
+            <AdsACrf>1</AdsACrf>
+            <AdsANop>0</AdsANop>
+            <AdsANot>0</AdsANot>
+            <AdsLLst>1</AdsLLst>
+            <AdsLmap>1</AdsLmap>
+            <AdsLcgr>1</AdsLcgr>
+            <AdsLsym>1</AdsLsym>
+            <AdsLszi>1</AdsLszi>
+            <AdsLtoi>1</AdsLtoi>
+            <AdsLsun>1</AdsLsun>
+            <AdsLven>1</AdsLven>
+            <AdsLsxf>1</AdsLsxf>
+            <RvctClst>0</RvctClst>
+            <GenPPlst>0</GenPPlst>
+            <AdsCpuType>"Cortex-M3"</AdsCpuType>
+            <RvctDeviceName />
+            <mOS>0</mOS>
+            <uocRom>0</uocRom>
+            <uocRam>0</uocRam>
+            <hadIROM>0</hadIROM>
+            <hadIRAM>0</hadIRAM>
+            <hadXRAM>0</hadXRAM>
+            <uocXRam>0</uocXRam>
+            <RvdsVP>0</RvdsVP>
+            <hadIRAM2>0</hadIRAM2>
+            <hadIROM2>0</hadIROM2>
+            <StupSel>0</StupSel>
+            <useUlib>0</useUlib>
+            <EndSel>1</EndSel>
+            <uLtcg>0</uLtcg>
+            <RoSelD>0</RoSelD>
+            <RwSelD>0</RwSelD>
+            <CodeSel>0</CodeSel>
+            <OptFeed>0</OptFeed>
+            <NoZi1>0</NoZi1>
+            <NoZi2>0</NoZi2>
+            <NoZi3>0</NoZi3>
+            <NoZi4>0</NoZi4>
+            <NoZi5>0</NoZi5>
+            <Ro1Chk>0</Ro1Chk>
+            <Ro2Chk>0</Ro2Chk>
+            <Ro3Chk>0</Ro3Chk>
+            <Ir1Chk>0</Ir1Chk>
+            <Ir2Chk>0</Ir2Chk>
+            <Ra1Chk>0</Ra1Chk>
+            <Ra2Chk>0</Ra2Chk>
+            <Ra3Chk>0</Ra3Chk>
+            <Im1Chk>0</Im1Chk>
+            <Im2Chk>0</Im2Chk>
+            <OnChipMemories>
+              <Ocm1>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm1>
+              <Ocm2>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm2>
+              <Ocm3>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm3>
+              <Ocm4>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm4>
+              <Ocm5>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm5>
+              <Ocm6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm6>
+              <IRAM>
+                <Type>0</Type>
+                <StartAddress>0x20000000</StartAddress>
+                <Size>0x10000</Size>
+              </IRAM>
+              <IROM>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x80000</Size>
+              </IROM>
+              <XRAM>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </XRAM>
+              <OCR_RVCT1>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT1>
+              <OCR_RVCT2>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT2>
+              <OCR_RVCT3>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT3>
+              <OCR_RVCT4>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT4>
+              <OCR_RVCT5>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT5>
+              <OCR_RVCT6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT6>
+              <OCR_RVCT7>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT7>
+              <OCR_RVCT8>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT8>
+              <OCR_RVCT9>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT9>
+              <OCR_RVCT10>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT10>
+            </OnChipMemories>
+            <RvctStartVector />
+          </ArmAdsMisc>
+          <Cads>
+            <interw>1</interw>
+            <Optim>1</Optim>
+            <oTime>0</oTime>
+            <SplitLS>0</SplitLS>
+            <OneElfS>1</OneElfS>
+            <Strict>0</Strict>
+            <EnumInt>0</EnumInt>
+            <PlainCh>0</PlainCh>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <wLevel>2</wLevel>
+            <uThumb>0</uThumb>
+            <uSurpInc>0</uSurpInc>
+            <uC99>0</uC99>
+            <useXO>0</useXO>
+            <VariousControls>
+              <MiscControls />
+              <Define>__RTTHREAD__, RT_USING_ARM_LIBC, __CLK_TCK=RT_TICK_PER_SECOND</Define>
+              <Undefine />
+              <IncludePath>applications;.;CMSIS\CME_M7;CMSIS\CMSIS\Include;..\..\components\libc\compilers\common;..\..\components\libc\compilers\common\extension;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\dfs\include;..\..\components\dfs\filesystems\elmfat;..\..\components\finsh;.;..\..\include;StdPeriph_Driver\inc;..\..\components\net\lwip\lwip-2.0.3\src\include;..\..\components\net\lwip\lwip-2.0.3\src\include\ipv4;..\..\components\net\lwip\lwip-2.0.3\src\include\netif;..\..\components\net\lwip\lwip-2.0.3\src\include\posix;..\..\components\net\lwip\port;..\..\components\libc\posix\io\poll;..\..\components\libc\posix\io\stdio;..\..\components\libc\posix\ipc</IncludePath>
+            </VariousControls>
+          </Cads>
+          <Aads>
+            <interw>1</interw>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <thumb>0</thumb>
+            <SplitLS>0</SplitLS>
+            <SwStkChk>0</SwStkChk>
+            <NoWarn>0</NoWarn>
+            <uSurpInc>0</uSurpInc>
+            <useXO>0</useXO>
+            <VariousControls>
+              <MiscControls />
+              <Define />
+              <Undefine />
+              <IncludePath />
+            </VariousControls>
+          </Aads>
+          <LDads>
+            <umfTarg>0</umfTarg>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <noStLib>0</noStLib>
+            <RepFail>1</RepFail>
+            <useFile>0</useFile>
+            <TextAddressRange>0x00000000</TextAddressRange>
+            <DataAddressRange>0x00000000</DataAddressRange>
+            <pXoBase />
+            <ScatterFile>CME_M7.sct</ScatterFile>
+            <IncludeLibs />
+            <IncludeLibsPath />
+            <Misc />
+            <LinkerInputFile />
+            <DisabledWarnings />
+          </LDads>
+        </TargetArmAds>
+      </TargetOption>
+      <Groups>
+        <Group>
+          <GroupName>Applications</GroupName>
+          <Files>
+            <File>
+              <FileName>led.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>applications\led.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>startup.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>applications\startup.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>application.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>applications\application.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>CMSIS</GroupName>
+          <Files>
+            <File>
+              <FileName>startup_cmem7.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>CMSIS\CME_M7\startup\arm\startup_cmem7.s</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>system_cmem7.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>CMSIS\CME_M7\system_cmem7.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>Compiler</GroupName>
+          <Files>
+            <File>
+              <FileName>syscalls.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\libc\compilers\armlibc\syscalls.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>syscall_mem.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\libc\compilers\armlibc\syscall_mem.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>stdlib.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\libc\compilers\common\stdlib.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>time.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\libc\compilers\common\time.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
+          <Files>
+            <File>
+              <FileName>showmem.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>backtrace.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>div0.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cpuport.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m3\cpuport.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m3\context_rvds.S</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>DeviceDrivers</GroupName>
+          <Files>
+            <File>
+              <FileName>workqueue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\ipc\workqueue.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ringbuffer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\ipc\ringbuffer.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>completion.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\ipc\completion.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ringblk_buf.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\ipc\ringblk_buf.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>pipe.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\ipc\pipe.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dataqueue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\ipc\dataqueue.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>waitqueue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\ipc\waitqueue.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>pin.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>serial.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>Drivers</GroupName>
+          <Files>
+            <File>
+              <FileName>emac.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>drivers\emac.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>uart.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>drivers\uart.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>board.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>drivers\board.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>app_phy.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>drivers\app_phy.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>Filesystem</GroupName>
+          <Files>
+            <File>
+              <FileName>dfs_posix.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dfs_fs.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dfs.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dfs_file.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dfs_elm.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ff.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ffunicode.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\ffunicode.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>Finsh</GroupName>
+          <Files>
+            <File>
+              <FileName>shell.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>msh.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\finsh\msh.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>msh_file.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmd.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
+          <Files>
+            <File>
+              <FileName>device.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\device.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>kservice.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\kservice.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ipc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\ipc.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>thread.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\thread.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>mem.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\mem.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>components.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\components.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>scheduler.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\scheduler.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>clock.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\clock.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>object.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\object.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>irq.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\irq.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>timer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\timer.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>idle.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\idle.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>mempool.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\mempool.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>Libraries</GroupName>
+          <Files>
+            <File>
+              <FileName>cmem7_ddr.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_ddr.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_i2c.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_i2c.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_tim.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_tim.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_eth.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_eth.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_usb.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_usb.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_flash.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_flash.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_dma.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_dma.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_adc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_adc.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_misc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_misc.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_aes.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_aes.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_rtc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_rtc.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_spi.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_spi.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_can.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_can.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_gpio.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_gpio.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_efuse.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_efuse.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_wdg.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_wdg.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>cmem7_uart.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>StdPeriph_Driver\src\cmem7_uart.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>lwIP</GroupName>
+          <Files>
+            <File>
+              <FileName>ping.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\apps\ping\ping.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>netdb.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\netdb.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ip.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ip.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>autoip.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\autoip.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ethernet.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\netif\ethernet.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>netif.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\netif.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>sys.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\sys.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>sockets.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\sockets.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>netifapi.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\netifapi.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>tcpip.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\tcpip.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ip4_addr.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\ip4_addr.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dhcp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\dhcp.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>init.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\init.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>etharp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\etharp.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>memp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\memp.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ip4.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\ip4.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>netbuf.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\netbuf.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>raw.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\raw.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ip4_frag.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\ip4_frag.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>tcp_out.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\tcp_out.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>lowpan6.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\netif\lowpan6.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>icmp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\icmp.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>api_lib.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\api_lib.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>inet_chksum.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\inet_chksum.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>stats.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\stats.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>err.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\err.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>tcp_in.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\tcp_in.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dns.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\dns.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>timeouts.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\timeouts.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>igmp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\ipv4\igmp.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>udp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\udp.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>pbuf.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\pbuf.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>def.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\def.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>api_msg.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\api\api_msg.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>tcp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\lwip-2.0.3\src\core\tcp.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ethernetif.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\port\ethernetif.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>sys_arch.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip\port\sys_arch.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+      </Groups>
+    </Target>
+  </Targets>
+</Project>

+ 0 - 0
components/net/lwip-2.0.2/test/fuzz/config.h → bsp/CME_M7/readme.md


+ 245 - 0
bsp/CME_M7/rtconfig.h

@@ -0,0 +1,245 @@
+#ifndef RT_CONFIG_H__
+#define RT_CONFIG_H__
+
+/* Automatically generated file; DO NOT EDIT. */
+/* RT-Thread Configuration */
+
+/* RT-Thread Kernel */
+
+#define RT_NAME_MAX 8
+#define RT_ALIGN_SIZE 4
+#define RT_THREAD_PRIORITY_32
+#define RT_THREAD_PRIORITY_MAX 32
+#define RT_TICK_PER_SECOND 100
+#define RT_USING_OVERFLOW_CHECK
+#define RT_USING_HOOK
+#define RT_HOOK_USING_FUNC_PTR
+#define RT_USING_IDLE_HOOK
+#define RT_IDLE_HOOK_LIST_SIZE 4
+#define IDLE_THREAD_STACK_SIZE 256
+#define RT_USING_TIMER_SOFT
+#define RT_TIMER_THREAD_PRIO 4
+#define RT_TIMER_THREAD_STACK_SIZE 512
+
+/* kservice optimization */
+
+#define RT_DEBUG
+
+/* Inter-Thread communication */
+
+#define RT_USING_SEMAPHORE
+#define RT_USING_MUTEX
+#define RT_USING_EVENT
+#define RT_USING_MAILBOX
+#define RT_USING_MESSAGEQUEUE
+
+/* Memory Management */
+
+#define RT_USING_MEMPOOL
+#define RT_USING_SMALL_MEM
+#define RT_USING_SMALL_MEM_AS_HEAP
+#define RT_USING_HEAP
+
+/* Kernel Device Object */
+
+#define RT_USING_DEVICE
+#define RT_USING_CONSOLE
+#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLE_DEVICE_NAME "uart2"
+#define RT_VER_NUM 0x40100
+#define ARCH_ARM
+#define RT_USING_CPU_FFS
+#define ARCH_ARM_CORTEX_M
+#define ARCH_ARM_CORTEX_M3
+
+/* RT-Thread Components */
+
+#define RT_USING_COMPONENTS_INIT
+#define RT_USING_MSH
+#define RT_USING_FINSH
+#define FINSH_USING_MSH
+#define FINSH_THREAD_NAME "tshell"
+#define FINSH_THREAD_PRIORITY 20
+#define FINSH_THREAD_STACK_SIZE 4096
+#define FINSH_USING_HISTORY
+#define FINSH_HISTORY_LINES 5
+#define FINSH_USING_SYMTAB
+#define FINSH_CMD_SIZE 80
+#define MSH_USING_BUILT_IN_COMMANDS
+#define FINSH_USING_DESCRIPTION
+#define FINSH_ARG_MAX 10
+#define RT_USING_DFS
+#define DFS_USING_POSIX
+#define DFS_USING_WORKDIR
+#define DFS_FILESYSTEMS_MAX 4
+#define DFS_FILESYSTEM_TYPES_MAX 4
+#define DFS_FD_MAX 16
+#define RT_USING_DFS_ELMFAT
+
+/* elm-chan's FatFs, Generic FAT Filesystem Module */
+
+#define RT_DFS_ELM_CODE_PAGE 437
+#define RT_DFS_ELM_WORD_ACCESS
+#define RT_DFS_ELM_USE_LFN_3
+#define RT_DFS_ELM_USE_LFN 3
+#define RT_DFS_ELM_LFN_UNICODE_0
+#define RT_DFS_ELM_LFN_UNICODE 0
+#define RT_DFS_ELM_MAX_LFN 255
+#define RT_DFS_ELM_DRIVES 2
+#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
+#define RT_DFS_ELM_REENTRANT
+#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
+
+/* Device Drivers */
+
+#define RT_USING_DEVICE_IPC
+#define RT_USING_SERIAL
+#define RT_USING_SERIAL_V1
+#define RT_SERIAL_USING_DMA
+#define RT_SERIAL_RB_BUFSZ 64
+#define RT_USING_PIN
+
+/* Using USB */
+
+
+/* C/C++ and POSIX layer */
+
+#define RT_LIBC_DEFAULT_TIMEZONE 8
+
+/* POSIX (Portable Operating System Interface) layer */
+
+
+/* Interprocess Communication (IPC) */
+
+
+/* Socket is in the 'Network' category */
+
+
+/* Network */
+
+#define NETDEV_USING_PING
+#define RT_USING_LWIP
+#define RT_USING_LWIP203
+#define RT_USING_LWIP_VER_NUM 0x20003
+#define RT_LWIP_MEM_ALIGNMENT 4
+#define RT_LWIP_IGMP
+#define RT_LWIP_ICMP
+#define RT_LWIP_DNS
+#define RT_LWIP_DHCP
+#define IP_SOF_BROADCAST 1
+#define IP_SOF_BROADCAST_RECV 1
+
+/* Static IPv4 Address */
+
+#define RT_LWIP_IPADDR "192.168.1.30"
+#define RT_LWIP_GWADDR "192.168.1.1"
+#define RT_LWIP_MSKADDR "255.255.255.0"
+#define RT_LWIP_UDP
+#define RT_LWIP_TCP
+#define RT_LWIP_RAW
+#define RT_MEMP_NUM_NETCONN 12
+#define RT_LWIP_PBUF_NUM 3
+#define RT_LWIP_RAW_PCB_NUM 2
+#define RT_LWIP_UDP_PCB_NUM 4
+#define RT_LWIP_TCP_PCB_NUM 8
+#define RT_LWIP_TCP_SEG_NUM 40
+#define RT_LWIP_TCP_SND_BUF 4380
+#define RT_LWIP_TCP_WND 4380
+#define RT_LWIP_TCPTHREAD_PRIORITY 12
+#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
+#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
+#define RT_LWIP_ETHTHREAD_PRIORITY 15
+#define RT_LWIP_ETHTHREAD_STACKSIZE 512
+#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
+#define LWIP_NETIF_STATUS_CALLBACK 1
+#define LWIP_NETIF_LINK_CALLBACK 1
+#define SO_REUSE 1
+#define LWIP_SO_RCVTIMEO 1
+#define LWIP_SO_SNDTIMEO 1
+#define LWIP_SO_RCVBUF 1
+#define LWIP_SO_LINGER 0
+#define LWIP_NETIF_LOOPBACK 0
+#define RT_LWIP_USING_PING
+
+/* Utilities */
+
+
+/* RT-Thread Utestcases */
+
+
+/* RT-Thread online packages */
+
+/* IoT - internet of things */
+
+
+/* Wi-Fi */
+
+/* Marvell WiFi */
+
+
+/* Wiced WiFi */
+
+
+/* IoT Cloud */
+
+
+/* security packages */
+
+
+/* language packages */
+
+/* JSON: JavaScript Object Notation, a lightweight data-interchange format */
+
+
+/* XML: Extensible Markup Language */
+
+
+/* multimedia packages */
+
+/* LVGL: powerful and easy-to-use embedded GUI library */
+
+
+/* u8g2: a monochrome graphic library */
+
+
+/* PainterEngine: A cross-platform graphics application framework written in C language */
+
+
+/* tools packages */
+
+
+/* system packages */
+
+/* enhanced kernel services */
+
+
+/* POSIX extension functions */
+
+
+/* acceleration: Assembly language or algorithmic acceleration packages */
+
+
+/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
+
+
+/* Micrium: Micrium software products porting for RT-Thread */
+
+
+/* peripheral libraries and drivers */
+
+
+/* AI packages */
+
+
+/* miscellaneous packages */
+
+/* project laboratory */
+
+/* samples: kernel and components samples */
+
+
+/* entertainment: terminal games and other interesting software packages */
+
+#define SOC_CME_M7
+
+#endif

+ 125 - 0
bsp/CME_M7/rtconfig.py

@@ -0,0 +1,125 @@
+import os
+
+# toolchains options
+ARCH='arm'
+CPU='cortex-m3'
+CROSS_TOOL='keil'
+
+if os.getenv('RTT_CC'):
+	CROSS_TOOL = os.getenv('RTT_CC')
+
+if  CROSS_TOOL == 'gcc':
+	PLATFORM 	= 'gcc'
+	EXEC_PATH 	= r'C:\Program Files\GNU Tools ARM Embedded\4.8 2013q4\bin'
+elif CROSS_TOOL == 'keil':
+	PLATFORM 	= 'armcc'
+	EXEC_PATH 	= 'C:/Keil'
+elif CROSS_TOOL == 'iar':
+	print('================ERROR============================')
+	print('Not support iar yet!')
+	print('=================================================')
+	exit(0)
+
+if os.getenv('RTT_EXEC_PATH'):
+	EXEC_PATH = os.getenv('RTT_EXEC_PATH')
+
+if os.getenv('RTT_ROOT'):
+    RTT_ROOT = os.getenv('RTT_ROOT')
+else:
+    RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
+
+BUILD = 'debug'
+
+if PLATFORM == 'gcc':
+    # toolchains
+    PREFIX = 'arm-none-eabi-'
+    CC = PREFIX + 'gcc'
+    AS = PREFIX + 'gcc'
+    AR = PREFIX + 'ar'
+    LINK = PREFIX + 'gcc'
+    TARGET_EXT = 'elf'
+    SIZE = PREFIX + 'size'
+    OBJDUMP = PREFIX + 'objdump'
+    OBJCPY = PREFIX + 'objcopy'
+
+    DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
+    CFLAGS = DEVICE + ' -g -Wall '
+    AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
+    LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles  -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T CME_M7.ld'
+
+    CPATH = ''
+    LPATH = ''
+
+    if BUILD == 'debug':
+        CFLAGS += ' -O0 -gdwarf-2'
+        AFLAGS += ' -gdwarf-2'
+    else:
+        CFLAGS += ' -O3'
+
+    POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
+
+elif PLATFORM == 'armcc':
+    # toolchains
+    CC = 'armcc'
+    AS = 'armasm'
+    AR = 'armar'
+    LINK = 'armlink'
+    TARGET_EXT = 'axf'
+
+    DEVICE = ' --cpu Cortex-M3'
+    CFLAGS = DEVICE + ' --c99 --apcs=interwork'
+    AFLAGS = DEVICE
+    LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter CME_M7.sct'
+
+    LFLAGS += ' --keep *.o(.rti_fn.*)   --keep *.o(FSymTab) --keep *.o(VSymTab)' 
+
+    EXEC_PATH += '/ARM/ARMCC/bin'
+
+    if BUILD == 'debug':
+        CFLAGS += ' -g -O0'
+        AFLAGS += ' -g'
+    else:
+        CFLAGS += ' -O2'
+
+    POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
+
+elif PLATFORM == 'iar':
+    # toolchains
+    CC = 'iccarm'
+    AS = 'iasmarm'
+    AR = 'iarchive'
+    LINK = 'ilinkarm'
+    TARGET_EXT = 'out'
+
+    DEVICE = ' -D USE_STDPERIPH_DRIVER'
+
+    CFLAGS = DEVICE
+    CFLAGS += ' --diag_suppress Pa050'
+    CFLAGS += ' --no_cse' 
+    CFLAGS += ' --no_unroll' 
+    CFLAGS += ' --no_inline' 
+    CFLAGS += ' --no_code_motion' 
+    CFLAGS += ' --no_tbaa' 
+    CFLAGS += ' --no_clustering' 
+    CFLAGS += ' --no_scheduling' 
+    CFLAGS += ' --debug' 
+    CFLAGS += ' --endian=little' 
+    CFLAGS += ' --cpu=Cortex-M3' 
+    CFLAGS += ' -e' 
+    CFLAGS += ' --fpu=None'
+    CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'    
+    CFLAGS += ' -Ol'    
+        
+    AFLAGS = ''
+    AFLAGS += ' -s+' 
+    AFLAGS += ' -w+' 
+    AFLAGS += ' -r' 
+    AFLAGS += ' --cpu Cortex-M3' 
+    AFLAGS += ' --fpu None' 
+
+    LFLAGS = ' --config CME_M7.icf'
+    LFLAGS += ' --semihosting' 
+    LFLAGS += ' --entry __iar_program_start'    
+
+    EXEC_PATH = EXEC_PATH + '/arm/bin/'
+    POST_ACTION = ''

+ 170 - 0
bsp/CME_M7/template.uvopt

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
+
+  <SchemaVersion>1.0</SchemaVersion>
+
+  <Header>### uVision Project, (C) Keil Software</Header>
+
+  <Extensions>
+    <cExt>*.c</cExt>
+    <aExt>*.s*; *.src; *.a*</aExt>
+    <oExt>*.obj</oExt>
+    <lExt>*.lib</lExt>
+    <tExt>*.txt; *.h; *.inc</tExt>
+    <pExt>*.plm</pExt>
+    <CppX>*.cpp</CppX>
+  </Extensions>
+
+  <DaveTm>
+    <dwLowDateTime>0</dwLowDateTime>
+    <dwHighDateTime>0</dwHighDateTime>
+  </DaveTm>
+
+  <Target>
+    <TargetName>rtthread</TargetName>
+    <ToolsetNumber>0x4</ToolsetNumber>
+    <ToolsetName>ARM-ADS</ToolsetName>
+    <TargetOption>
+      <CLKADS>10000000</CLKADS>
+      <OPTTT>
+        <gFlags>1</gFlags>
+        <BeepAtEnd>1</BeepAtEnd>
+        <RunSim>0</RunSim>
+        <RunTarget>1</RunTarget>
+      </OPTTT>
+      <OPTHX>
+        <HexSelection>1</HexSelection>
+        <FlashByte>65535</FlashByte>
+        <HexRangeLowAddress>0</HexRangeLowAddress>
+        <HexRangeHighAddress>0</HexRangeHighAddress>
+        <HexOffset>0</HexOffset>
+      </OPTHX>
+      <OPTLEX>
+        <PageWidth>79</PageWidth>
+        <PageLength>66</PageLength>
+        <TabStop>8</TabStop>
+        <ListingPath>.\build\</ListingPath>
+      </OPTLEX>
+      <ListingPage>
+        <CreateCListing>1</CreateCListing>
+        <CreateAListing>1</CreateAListing>
+        <CreateLListing>1</CreateLListing>
+        <CreateIListing>0</CreateIListing>
+        <AsmCond>1</AsmCond>
+        <AsmSymb>1</AsmSymb>
+        <AsmXref>0</AsmXref>
+        <CCond>1</CCond>
+        <CCode>0</CCode>
+        <CListInc>0</CListInc>
+        <CSymb>0</CSymb>
+        <LinkerCodeListing>0</LinkerCodeListing>
+      </ListingPage>
+      <OPTXL>
+        <LMap>1</LMap>
+        <LComments>1</LComments>
+        <LGenerateSymbols>1</LGenerateSymbols>
+        <LLibSym>1</LLibSym>
+        <LLines>1</LLines>
+        <LLocSym>1</LLocSym>
+        <LPubSym>1</LPubSym>
+        <LXref>0</LXref>
+        <LExpSel>0</LExpSel>
+      </OPTXL>
+      <OPTFL>
+        <tvExp>1</tvExp>
+        <tvExpOptDlg>0</tvExpOptDlg>
+        <IsCurrentTarget>1</IsCurrentTarget>
+      </OPTFL>
+      <CpuCode>0</CpuCode>
+      <DebugOpt>
+        <uSim>0</uSim>
+        <uTrg>1</uTrg>
+        <sLdApp>1</sLdApp>
+        <sGomain>1</sGomain>
+        <sRbreak>1</sRbreak>
+        <sRwatch>1</sRwatch>
+        <sRmem>1</sRmem>
+        <sRfunc>1</sRfunc>
+        <sRbox>1</sRbox>
+        <tLdApp>1</tLdApp>
+        <tGomain>1</tGomain>
+        <tRbreak>1</tRbreak>
+        <tRwatch>1</tRwatch>
+        <tRmem>1</tRmem>
+        <tRfunc>0</tRfunc>
+        <tRbox>1</tRbox>
+        <tRtrace>1</tRtrace>
+        <sRSysVw>1</sRSysVw>
+        <tRSysVw>1</tRSysVw>
+        <tPdscDbg>1</tPdscDbg>
+        <sRunDeb>0</sRunDeb>
+        <sLrtime>0</sLrtime>
+        <nTsel>17</nTsel>
+        <sDll></sDll>
+        <sDllPa></sDllPa>
+        <sDlgDll></sDlgDll>
+        <sDlgPa></sDlgPa>
+        <sIfile></sIfile>
+        <tDll></tDll>
+        <tDllPa></tDllPa>
+        <tDlgDll></tDlgDll>
+        <tDlgPa></tDlgPa>
+        <tIfile></tIfile>
+        <pMon>CapitalMicro\BIN\cmagdi.dll</pMon>
+      </DebugOpt>
+      <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>UL2CM3</Key>
+          <Name>-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>Nu_Link</Key>
+          <Name>-S1 -B115200 -O0</Name>
+        </SetRegEntry>
+      </TargetDriverDllRegistry>
+      <Breakpoint/>
+      <Tracepoint>
+        <THDelay>0</THDelay>
+      </Tracepoint>
+      <DebugFlag>
+        <trace>0</trace>
+        <periodic>1</periodic>
+        <aLwin>0</aLwin>
+        <aCover>0</aCover>
+        <aSer1>0</aSer1>
+        <aSer2>0</aSer2>
+        <aPa>0</aPa>
+        <viewmode>0</viewmode>
+        <vrSel>0</vrSel>
+        <aSym>0</aSym>
+        <aTbox>0</aTbox>
+        <AscS1>0</AscS1>
+        <AscS2>0</AscS2>
+        <AscS3>0</AscS3>
+        <aSer3>0</aSer3>
+        <eProf>0</eProf>
+        <aLa>0</aLa>
+        <aPa1>0</aPa1>
+        <AscS4>0</AscS4>
+        <aSer4>0</aSer4>
+        <StkLoc>0</StkLoc>
+        <TrcWin>0</TrcWin>
+        <newCpu>0</newCpu>
+        <uProt>0</uProt>
+      </DebugFlag>
+      <LintExecutable></LintExecutable>
+      <LintConfigFile></LintConfigFile>
+    </TargetOption>
+  </Target>
+
+  <Group>
+    <GroupName>Source Group 1</GroupName>
+    <tvExp>0</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+  </Group>
+
+</ProjectOpt>

+ 416 - 0
bsp/CME_M7/template.uvproj

@@ -0,0 +1,416 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
+
+  <SchemaVersion>1.1</SchemaVersion>
+
+  <Header>### uVision Project, (C) Keil Software</Header>
+
+  <Targets>
+    <Target>
+      <TargetName>rtthread</TargetName>
+      <ToolsetNumber>0x4</ToolsetNumber>
+      <ToolsetName>ARM-ADS</ToolsetName>
+      <TargetOption>
+        <TargetCommonOption>
+          <Device>ARMCM3</Device>
+          <Vendor>ARM</Vendor>
+          <PackID>ARM.CMSIS.4.1.0</PackID>
+          <PackURL>http://www.keil.com/pack/</PackURL>
+          <Cpu>CPUTYPE("Cortex-M3") CLOCK(10000000) ESEL ELITTLE</Cpu>
+          <FlashUtilSpec></FlashUtilSpec>
+          <StartupFile></StartupFile>
+          <FlashDriverDll></FlashDriverDll>
+          <DeviceId>0</DeviceId>
+          <RegisterFile>$$Device:ARMCM3$Device\ARM\ARMCM3\Include\ARMCM3.h</RegisterFile>
+          <MemoryEnv></MemoryEnv>
+          <Cmp></Cmp>
+          <Asm></Asm>
+          <Linker></Linker>
+          <OHString></OHString>
+          <InfinionOptionDll></InfinionOptionDll>
+          <SLE66CMisc></SLE66CMisc>
+          <SLE66AMisc></SLE66AMisc>
+          <SLE66LinkerMisc></SLE66LinkerMisc>
+          <SFDFile>$$Device:ARMCM3$Device\ARM\SVD\ARMCM3.svd</SFDFile>
+          <bCustSvd>0</bCustSvd>
+          <UseEnv>0</UseEnv>
+          <BinPath></BinPath>
+          <IncludePath></IncludePath>
+          <LibPath></LibPath>
+          <RegisterFilePath></RegisterFilePath>
+          <DBRegisterFilePath></DBRegisterFilePath>
+          <TargetStatus>
+            <Error>0</Error>
+            <ExitCodeStop>0</ExitCodeStop>
+            <ButtonStop>0</ButtonStop>
+            <NotGenerated>0</NotGenerated>
+            <InvalidFlash>1</InvalidFlash>
+          </TargetStatus>
+          <OutputDirectory>.\build\</OutputDirectory>
+          <OutputName>rtthread</OutputName>
+          <CreateExecutable>1</CreateExecutable>
+          <CreateLib>0</CreateLib>
+          <CreateHexFile>1</CreateHexFile>
+          <DebugInformation>1</DebugInformation>
+          <BrowseInformation>0</BrowseInformation>
+          <ListingPath>.\build\</ListingPath>
+          <HexFormatSelection>1</HexFormatSelection>
+          <Merge32K>0</Merge32K>
+          <CreateBatchFile>0</CreateBatchFile>
+          <BeforeCompile>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name></UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopU1X>0</nStopU1X>
+            <nStopU2X>0</nStopU2X>
+          </BeforeCompile>
+          <BeforeMake>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name></UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopB1X>0</nStopB1X>
+            <nStopB2X>0</nStopB2X>
+          </BeforeMake>
+          <AfterMake>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name>fromelf --bin !L --output rtthread.bin</UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+          </AfterMake>
+          <SelectedForBatchBuild>0</SelectedForBatchBuild>
+          <SVCSIdString></SVCSIdString>
+        </TargetCommonOption>
+        <CommonProperty>
+          <UseCPPCompiler>0</UseCPPCompiler>
+          <RVCTCodeConst>0</RVCTCodeConst>
+          <RVCTZI>0</RVCTZI>
+          <RVCTOtherData>0</RVCTOtherData>
+          <ModuleSelection>0</ModuleSelection>
+          <IncludeInBuild>1</IncludeInBuild>
+          <AlwaysBuild>0</AlwaysBuild>
+          <GenerateAssemblyFile>0</GenerateAssemblyFile>
+          <AssembleAssemblyFile>0</AssembleAssemblyFile>
+          <PublicsOnly>0</PublicsOnly>
+          <StopOnExitCode>3</StopOnExitCode>
+          <CustomArgument></CustomArgument>
+          <IncludeLibraryModules></IncludeLibraryModules>
+          <ComprImg>1</ComprImg>
+        </CommonProperty>
+        <DllOption>
+          <SimDllName>SARMCM3.DLL</SimDllName>
+          <SimDllArguments> </SimDllArguments>
+          <SimDlgDll>DCM.DLL</SimDlgDll>
+          <SimDlgDllArguments>-pCM3</SimDlgDllArguments>
+          <TargetDllName>SARMCM3.DLL</TargetDllName>
+          <TargetDllArguments></TargetDllArguments>
+          <TargetDlgDll>TCM.DLL</TargetDlgDll>
+          <TargetDlgDllArguments>-pCM3</TargetDlgDllArguments>
+        </DllOption>
+        <DebugOption>
+          <OPTHX>
+            <HexSelection>1</HexSelection>
+            <HexRangeLowAddress>0</HexRangeLowAddress>
+            <HexRangeHighAddress>0</HexRangeHighAddress>
+            <HexOffset>0</HexOffset>
+            <Oh166RecLen>16</Oh166RecLen>
+          </OPTHX>
+          <Simulator>
+            <UseSimulator>0</UseSimulator>
+            <LoadApplicationAtStartup>1</LoadApplicationAtStartup>
+            <RunToMain>1</RunToMain>
+            <RestoreBreakpoints>1</RestoreBreakpoints>
+            <RestoreWatchpoints>1</RestoreWatchpoints>
+            <RestoreMemoryDisplay>1</RestoreMemoryDisplay>
+            <RestoreFunctions>1</RestoreFunctions>
+            <RestoreToolbox>1</RestoreToolbox>
+            <LimitSpeedToRealTime>0</LimitSpeedToRealTime>
+            <RestoreSysVw>1</RestoreSysVw>
+          </Simulator>
+          <Target>
+            <UseTarget>1</UseTarget>
+            <LoadApplicationAtStartup>1</LoadApplicationAtStartup>
+            <RunToMain>1</RunToMain>
+            <RestoreBreakpoints>1</RestoreBreakpoints>
+            <RestoreWatchpoints>1</RestoreWatchpoints>
+            <RestoreMemoryDisplay>1</RestoreMemoryDisplay>
+            <RestoreFunctions>0</RestoreFunctions>
+            <RestoreToolbox>1</RestoreToolbox>
+            <RestoreTracepoints>1</RestoreTracepoints>
+            <RestoreSysVw>1</RestoreSysVw>
+            <UsePdscDebugDescription>1</UsePdscDebugDescription>
+          </Target>
+          <RunDebugAfterBuild>0</RunDebugAfterBuild>
+          <TargetSelection>17</TargetSelection>
+          <SimDlls>
+            <CpuDll></CpuDll>
+            <CpuDllArguments></CpuDllArguments>
+            <PeripheralDll></PeripheralDll>
+            <PeripheralDllArguments></PeripheralDllArguments>
+            <InitializationFile></InitializationFile>
+          </SimDlls>
+          <TargetDlls>
+            <CpuDll></CpuDll>
+            <CpuDllArguments></CpuDllArguments>
+            <PeripheralDll></PeripheralDll>
+            <PeripheralDllArguments></PeripheralDllArguments>
+            <InitializationFile></InitializationFile>
+            <Driver>CapitalMicro\BIN\cmagdi.dll</Driver>
+          </TargetDlls>
+        </DebugOption>
+        <Utilities>
+          <Flash1>
+            <UseTargetDll>1</UseTargetDll>
+            <UseExternalTool>0</UseExternalTool>
+            <RunIndependent>0</RunIndependent>
+            <UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
+            <Capability>1</Capability>
+            <DriverSelection>4097</DriverSelection>
+          </Flash1>
+          <bUseTDR>0</bUseTDR>
+          <Flash2>BIN\UL2CM3.DLL</Flash2>
+          <Flash3>"" ()</Flash3>
+          <Flash4></Flash4>
+          <pFcarmOut></pFcarmOut>
+          <pFcarmGrp></pFcarmGrp>
+          <pFcArmRoot></pFcArmRoot>
+          <FcArmLst>0</FcArmLst>
+        </Utilities>
+        <TargetArmAds>
+          <ArmAdsMisc>
+            <GenerateListings>0</GenerateListings>
+            <asHll>1</asHll>
+            <asAsm>1</asAsm>
+            <asMacX>1</asMacX>
+            <asSyms>1</asSyms>
+            <asFals>1</asFals>
+            <asDbgD>1</asDbgD>
+            <asForm>1</asForm>
+            <ldLst>0</ldLst>
+            <ldmm>1</ldmm>
+            <ldXref>1</ldXref>
+            <BigEnd>0</BigEnd>
+            <AdsALst>1</AdsALst>
+            <AdsACrf>1</AdsACrf>
+            <AdsANop>0</AdsANop>
+            <AdsANot>0</AdsANot>
+            <AdsLLst>1</AdsLLst>
+            <AdsLmap>1</AdsLmap>
+            <AdsLcgr>1</AdsLcgr>
+            <AdsLsym>1</AdsLsym>
+            <AdsLszi>1</AdsLszi>
+            <AdsLtoi>1</AdsLtoi>
+            <AdsLsun>1</AdsLsun>
+            <AdsLven>1</AdsLven>
+            <AdsLsxf>1</AdsLsxf>
+            <RvctClst>0</RvctClst>
+            <GenPPlst>0</GenPPlst>
+            <AdsCpuType>"Cortex-M3"</AdsCpuType>
+            <RvctDeviceName></RvctDeviceName>
+            <mOS>0</mOS>
+            <uocRom>0</uocRom>
+            <uocRam>0</uocRam>
+            <hadIROM>0</hadIROM>
+            <hadIRAM>0</hadIRAM>
+            <hadXRAM>0</hadXRAM>
+            <uocXRam>0</uocXRam>
+            <RvdsVP>0</RvdsVP>
+            <hadIRAM2>0</hadIRAM2>
+            <hadIROM2>0</hadIROM2>
+            <StupSel>0</StupSel>
+            <useUlib>0</useUlib>
+            <EndSel>1</EndSel>
+            <uLtcg>0</uLtcg>
+            <RoSelD>0</RoSelD>
+            <RwSelD>0</RwSelD>
+            <CodeSel>0</CodeSel>
+            <OptFeed>0</OptFeed>
+            <NoZi1>0</NoZi1>
+            <NoZi2>0</NoZi2>
+            <NoZi3>0</NoZi3>
+            <NoZi4>0</NoZi4>
+            <NoZi5>0</NoZi5>
+            <Ro1Chk>0</Ro1Chk>
+            <Ro2Chk>0</Ro2Chk>
+            <Ro3Chk>0</Ro3Chk>
+            <Ir1Chk>0</Ir1Chk>
+            <Ir2Chk>0</Ir2Chk>
+            <Ra1Chk>0</Ra1Chk>
+            <Ra2Chk>0</Ra2Chk>
+            <Ra3Chk>0</Ra3Chk>
+            <Im1Chk>0</Im1Chk>
+            <Im2Chk>0</Im2Chk>
+            <OnChipMemories>
+              <Ocm1>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm1>
+              <Ocm2>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm2>
+              <Ocm3>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm3>
+              <Ocm4>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm4>
+              <Ocm5>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm5>
+              <Ocm6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm6>
+              <IRAM>
+                <Type>0</Type>
+                <StartAddress>0x20000000</StartAddress>
+                <Size>0x10000</Size>
+              </IRAM>
+              <IROM>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x80000</Size>
+              </IROM>
+              <XRAM>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </XRAM>
+              <OCR_RVCT1>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT1>
+              <OCR_RVCT2>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT2>
+              <OCR_RVCT3>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT3>
+              <OCR_RVCT4>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT4>
+              <OCR_RVCT5>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT5>
+              <OCR_RVCT6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT6>
+              <OCR_RVCT7>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT7>
+              <OCR_RVCT8>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT8>
+              <OCR_RVCT9>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT9>
+              <OCR_RVCT10>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT10>
+            </OnChipMemories>
+            <RvctStartVector></RvctStartVector>
+          </ArmAdsMisc>
+          <Cads>
+            <interw>1</interw>
+            <Optim>1</Optim>
+            <oTime>0</oTime>
+            <SplitLS>0</SplitLS>
+            <OneElfS>1</OneElfS>
+            <Strict>0</Strict>
+            <EnumInt>0</EnumInt>
+            <PlainCh>0</PlainCh>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <wLevel>2</wLevel>
+            <uThumb>0</uThumb>
+            <uSurpInc>0</uSurpInc>
+            <uC99>0</uC99>
+            <useXO>0</useXO>
+            <VariousControls>
+              <MiscControls></MiscControls>
+              <Define></Define>
+              <Undefine></Undefine>
+              <IncludePath></IncludePath>
+            </VariousControls>
+          </Cads>
+          <Aads>
+            <interw>1</interw>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <thumb>0</thumb>
+            <SplitLS>0</SplitLS>
+            <SwStkChk>0</SwStkChk>
+            <NoWarn>0</NoWarn>
+            <uSurpInc>0</uSurpInc>
+            <useXO>0</useXO>
+            <VariousControls>
+              <MiscControls></MiscControls>
+              <Define></Define>
+              <Undefine></Undefine>
+              <IncludePath></IncludePath>
+            </VariousControls>
+          </Aads>
+          <LDads>
+            <umfTarg>0</umfTarg>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <noStLib>0</noStLib>
+            <RepFail>1</RepFail>
+            <useFile>0</useFile>
+            <TextAddressRange>0x00000000</TextAddressRange>
+            <DataAddressRange>0x00000000</DataAddressRange>
+            <pXoBase></pXoBase>
+            <ScatterFile>CME_M7.sct</ScatterFile>
+            <IncludeLibs></IncludeLibs>
+            <IncludeLibsPath></IncludeLibsPath>
+            <Misc></Misc>
+            <LinkerInputFile></LinkerInputFile>
+            <DisabledWarnings></DisabledWarnings>
+          </LDads>
+        </TargetArmAds>
+      </TargetOption>
+      <Groups>
+        <Group>
+          <GroupName>Source Group 1</GroupName>
+        </Group>
+      </Groups>
+    </Target>
+  </Targets>
+
+</Project>

+ 833 - 0
bsp/Copyright_Notice.md

@@ -0,0 +1,833 @@
+# 版权声明 Copyright Notice
+
+RT-Thread 是一套开源、开放的操作系统平台,自 3.1.1 版本开始以 Apache License v2.0 许可协议发布。
+
+芯片厂商外设函数库或者厂商固件,按厂商的许可进行授权,并以原有许可协议发布。
+
+RT-Thread is an open source operating system, which is released under Apache License V2.0 since version 3.1.1.
+
+The peripheral library or firmware library of the chip manufacturer is authorized according to the manufacturer's license, and these files are released according to the original license agreement.
+
+## BSP's License and Copyright:
+
+### acm32f0x0-nucleo
+
+License:  bsd-new
+
+Copyright: Copyright (c) 2021, AisinoChip
+
+Path:
+
+- bsp/acm32f0x0-nucleo/libraries
+
+### apm32
+
+bsp 列表:
+- apm32f103xe-minibroard
+
+------
+
+License: GEEHY SOFTWARE PACKAGE LICENSE
+
+Copyright: Copyright (C) 2020-2022 Geehy Semiconductor
+
+Path:
+
+- bsp\apm32\libraries\APM32F10x_Library\APM32F10x_StdPeriphDriver
+- bsp\apm32\libraries\APM32F10x_Library\Device
+- bsp\apm32\libraries\APM32F10x_Library\USB_Device_Lib
+
+------
+
+License: bsd-new
+
+Copyright (c) 2009-2018 Arm Limited
+
+Path:
+
+- bsp\apm32\libraries\APM32F10x_Library\CMSIS\Include
+
+### apollo2
+
+License:  bsd-new
+
+Copyright: Copyright (c) 2017, Ambiq Micro
+
+Path:
+
+- bsp/apollo2/libraries
+
+### at32
+
+License: st-mcd-2.0
+
+Copyright: (c) COPYRIGHT 2018 ArteryTek
+
+Path:
+
+- bsp/at32/at32f407-start/board/msp
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2010-2015 ARM Limited
+
+Path:
+
+- bsp/at32/Libraries/AT32_Std_Driver/CMSIS
+
+### avr32uc3b0
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 Atmel Corporation
+
+Path:
+
+- bsp/avr32uc3b0/SOFTWARE_FRAMEWORK
+
+### CME_M7
+
+License: st-mcd-2.0
+
+Copyright: (c) COPYRIGHT 2013 Capital-micro
+
+Path:
+
+- bsp/CME_M7/CMSIS/CME_M7
+- bsp/CME_M7/StdPeriph_Driver
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 - 2013 ARM LIMITED
+
+Path:
+
+- bsp/CME_M7/CMSIS/CMSIS
+
+### efm32
+
+License: zlib
+
+Copyright: (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com
+
+Path:
+
+- bsp/efm32/EFM32_Gxxx_DK
+- bsp/efm32/EFM32GG_DK3750
+- bsp/efm32/graphics
+- bsp/efm32/Libraries/Device/EnergyMicro
+- bsp/efm32/Libraries/emlib
+
+------
+
+License: arm-cortex-mx
+
+Copyright: Copyright (c) 2009-2012 ARM Limited
+
+Path:
+
+- bsp/efm32/Libraries/CMSIS/Include
+
+### essemi
+
+License: 未注明
+
+Copyright: Copyright (c) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+
+Path:
+
+- bsp/essemi/es32f0271/libraries/CMSIS/Device
+- bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver
+- bsp/essemi/es32f0271/libraries/usblib
+- bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver
+- bsp/essemi/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver
+- bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver
+- bsp/essemi/es8p508x/libraries/CMSIS
+- bsp/essemi/es8p508x/libraries/Library
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2013 ARM LIMITED
+
+Path:
+
+- bsp/essemi/es32f0271/libraries/CMSIS/RTOS
+- bsp/essemi/es32f0334/libraries/CMSIS/Include
+- bsp/essemi/es32f0654/libraries/CMSIS/Include
+- bsp/essemi/es8p508x/libraries/CMSIS
+
+###fm33lc026
+
+License: Mulan PSL v1
+
+Copyright: Copyright (c) [2019] [Fudan Microelectronics]
+
+Path:
+
+- bsp/fm33lc026\libraries\FM33LC0xx_FL_Driver
+- bsp/fm33lc026\libraries\FM
+
+### frdm-k64f
+
+License: bsd-new
+
+Copyright: Copyright (c) 2015, Freescale Semiconductor, Inc.
+
+Path:
+
+- bsp/frdm-k64f/board
+- bsp/frdm-k64f/device
+
+### gd32
+
+bsp 列表:
+- gd32103c-eval
+- gd32303e-eval
+- gd32450z-eval
+- gd32e230k-start
+- gd32vf103v-eval
+
+------
+
+License: 未注明
+
+Copyright: Copyright (c) 2017 GigaDevice
+
+Path:
+
+- bsp/gd32450z-eval/Libraries/GD32F4xx_standard_peripheral
+- bsp/gd32450z-eval/Libraries/GD32F4xx_usb_driver
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2018, GigaDevice Semiconductor Inc.
+
+Path:
+
+- bsp/gd32e230k-start/Libraries/CMSIS/GD
+- bsp/gd32e230k-start/Libraries/GD32E230_standard_peripheral
+- bsp/gd32vf103v-eval/board/gd32vf103_libopt.h
+- bsp/gd32vf103v-eval/libraries/GD32VF103_standard_peripheral
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2012 ARM LIMITED
+
+Path:
+
+- bsp/gd32103c-eval/Libraries/CMSIS/core_cm3.h
+- bsp/gd32303e-eval/Libraries/CMSIS/core
+- bsp/gd32303e-eval/Libraries/CMSIS/GD/GD32F30x/Include
+- bsp/gd32450z-eval/Libraries/CMSIS/core
+- bsp/gd32e230k-start/Libraries/CMSIS/GD/GD32E230/Include/system
+
+------
+
+License: arm-cortex-mx
+
+Copyright: Copyright (c) 2009-2012 ARM Limited
+
+Path:
+
+- bsp/gd32103c-eval/Libraries/CMSIS/core
+- bsp/gd32303e-eval/Libraries/CMSIS/core
+
+### hc32f4a0
+
+License: bsd-new
+
+Copyright: Copyright (c) 2020, Huada Semiconductor Co., Ltd.
+
+Path:
+
+- bsp/hc32f4a0/Libraries/CMSIS
+- bsp/hc32f4a0/Libraries/HC32F4A0_StdPeriph_Driver
+
+### hc32f460
+
+License: bsd-new
+
+Copyright: Copyright (c) 2020, Huada Semiconductor Co., Ltd.
+
+Path:
+
+- bsp/hc32f460/Libraries/CMSIS
+- bsp/hc32f460/Libraries/HC32F460_StdPeriph_Driver
+
+### hc32l196
+
+License: bsd-new
+
+Copyright: Copyright (c) 2020, Huada Semiconductor Co., Ltd.
+
+Path:
+
+- bsp/hc32l196/Libraries/CMSIS
+- bsp/hc32l196/Libraries/HC32L196_StdPeriph_Driver
+
+### hk32
+
+License: free-unknown
+
+Copyright: Copyright (c) HKMicroChip
+
+Path:
+
+- bsp/hk32/libraries/HK32F0xx_StdPeriph_Driver
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 - 2013 ARM LIMITED
+
+Path:
+
+- bsp/hk32/libraries/HK32F0xx_StdPeriph_Driver/CMSIS
+
+### imx6sx
+
+License:  other-permissive
+
+Copyright: Copyright (c) 2012, Freescale Semiconductor, Inc.
+
+Path:
+
+- bsp/imx6sx/cortex-a9/board
+
+------
+
+License: bsd-new、robert-hubley、other-permissive、proprietary-license
+
+Copyright: Copyright (c) 2012, Freescale Semiconductor, Inc.
+
+Path:
+
+- bsp/imx6sx/iMX6_Platform_SDK
+
+### imx6ul
+
+License: bsd-new、proprietary-license、robert-hubley
+
+Copyright: Copyright (c) 2012, Freescale Semiconductor, Inc.
+
+Path:
+
+- bsp/imx6ul/platform
+
+### imxrt
+
+License: clear-bsd
+
+Copyright: Copyright 2016 - 2017 NXP
+
+Path:
+
+- bsp/imxrt/imxrt1052-nxp-evk/xip
+
+------
+
+License: bsd-new
+
+Copyright: Copyright 2016 - 2017 NXP
+
+Path:
+
+- bsp/imxrt/imxrt1064-nxp-evk/board/MCUX_Config/clock_config.c
+- bsp/imxrt/imxrt1064-nxp-evk/xip
+- bsp/imxrt/libraries/drivers/drv_sdram.c
+- bsp/imxrt/libraries/drivers/usb
+- bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052
+- bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064
+
+### lm
+
+bsp 列表:
+
+- lm3s9b9x
+- lm3s8962
+- lm4f232
+
+------
+
+License: unknown-license-reference 或 proprietary-license
+
+Copyright: Copyright (c) 2005-2011 Texas Instruments Incorporated
+
+Path:
+
+- bsp/lm3s8962/Libraries
+- bsp/lm3s9b9x/Libraries
+- bsp/lm4f232/Libraries
+
+###  lpcxxx
+
+bsp 列表:
+
+- lpc408x
+- lpc54114-lite
+- lpc54608-LPCXpresso
+- lpc55sxx
+
+------
+
+License: arm-cortex-mx
+
+Copyright: Copyright (c) 2009 ARM Limited
+
+Path:
+
+- bsp/lpc176x/CMSIS/CM3
+- bsp/lpc178x/CMSIS/CM3
+- bsp/lpc408x/Libraries/CMSIS
+
+------
+
+License: nxp-warranty-disclaimer
+
+Copyright: Copyright (c) 2011, NXP Semiconductor
+
+Path:
+
+- bsp/lpc178x/CMSIS/CM3
+- bsp/lpc178x/drivers
+- bsp/lpc408x/Libraries/Device/NXP/LPC407x_8x_177x_8x
+- bsp/lpc43xx/Libraries/Device/NXP/LPC43xx
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 - 2013 ARM Limited
+
+Path:
+
+- bsp/lpc176x/CMSIS/CMSI
+- bsp/lpc43xx/Libraries/CMSIS
+- bsp/lpc5410x/Libraries/CMSIS
+- bsp/lpc54608-LPCXpresso/SDK_2.2_LPCXpresso54608 (Copyright 2016-2017 NXP)
+- bsp/lpc55sxx/Libraries/LPC55S6X (Copyright 2016-2018 NXP)
+
+------
+
+License: nxp-microcontroller-proprietary
+
+Copyright: Copyright (c) 2011, NXP Semiconductor
+
+Path:
+
+- bsp/lpc408x/Libraries/Drivers
+- bsp/lpc5410x/Libraries
+- bsp/lpc824/Libraries
+
+------
+
+License: clear-bsd
+
+Copyright: Copyright 2016-2018 NXP
+
+Path:
+
+- bsp/lpc54114-lite/Libraries/devices/LPC54114
+
+------
+
+License: zlib
+
+Copyright: Copyright (c) 2013-2014 ARM Ltd.
+
+Path:
+
+- bsp/lpc54608-LPCXpresso/SDK_2.2_LPCXpresso54608
+
+### maxim
+
+License: bsd-new
+
+Copyright: Copyright (c) 2016 Maxim Integrated Products, Inc.
+
+Path:
+
+- bsp/maxim/libraries/MAX32660PeriphDriver/CMSIS/Core
+
+------
+
+License: x11-xconsortium
+
+Copyright: Copyright (c) 2016 Maxim Integrated Products, Inc.
+
+Path:
+
+- bsp/maxim/libraries/MAX32660PeriphDriver
+
+### mb9bf
+
+bsp 列表:
+
+- mb9bf500r
+- mb9bf506r
+- mb9bf568r
+- mb9bf618s
+
+------
+
+License: arm-cortex-mx
+
+Copyright: Copyright (c) 2009-2010 ARM Limited
+
+Path:
+
+- bsp/mb9bf500r/CMSIS/core_xx
+- bsp/mb9bf506r/CMSIS/core_xx
+- bsp/mb9bf506r/libraries/CMSIS
+- bsp/mb9bf568r/CMSIS/Include/core_xx
+
+------
+
+License: free-unknown
+
+Copyright: (c) Fujitsu Semiconductor Europe GmbH
+
+Path:
+
+- bsp/mb9bf500r/CMSIS
+- sp/mb9bf506r/libraries/Device
+- bsp/mb9bf618s/CMSIS/DeviceSupport
+
+------
+
+License: warranty-disclaimer
+
+Copyright: Copyright (c) 2013 Spansion LLC.
+
+Path:
+
+- bsp/mb9bf568r/CMSIS/DeviceSupport
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 - 2013 ARM LIMITED
+
+Path:
+
+- bsp/mb9bf618s/CMSIS/Include
+
+### mm32
+
+bsp 列表:
+
+- mm32l07x
+- mm32l3xx
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 - 2013 ARM LIMITED
+
+Path:
+
+- bsp/mm32l07x/Libraries/CMSIS
+- bsp/mm32l3xx/Libraries/CMSIS/IAR_CORE
+
+------
+
+License: st-mcd-2.0
+
+Copyright: (c) COPYRIGHT 2017 MindMotion
+
+Path:
+
+- bsp/mm32l07x/Libraries/MM32L0xx
+- bsp/mm32l3xx/Libraries/MM32L3xx
+
+### nrf
+
+bsp 列表:
+
+- nrf5x
+- nrf51822
+
+------
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 - 2013 ARM LIMITED
+
+Path:
+
+- bsp/nrf5x/libraries/cmsis
+- bsp/nrf51822/Libraries/CMSIS
+- bsp/nrf51822/Libraries/nrf51822 (Copyright (c) 2013, Nordic Semiconductor ASA)
+
+### nuvoton
+
+License: bsd-new
+
+Copyright: Copyright (c) 2014 - 2015 Bosch Sensortec GmbH
+
+Path:
+
+- bsp/nuvoton/libraries/nu_packages/BMX055/libraries/BMG160_driver
+- bsp/nuvoton/libraries/nu_packages/BMX055/libraries/BMM050_driver
+
+------
+
+License: warranty-disclaimer
+
+Copyright: Copyright (c) 2015 - 2016 Bosch Sensortec GmbH
+
+Path:
+
+- bsp/nuvoton/libraries/nu_packages/BMX055/libraries/BMA2x2_driver
+
+------
+
+License: x11-xconsortium
+
+Copyright: Copyright (c) 2019 Maxim Integrated Products, Inc.
+
+Path:
+
+- bsp/nuvoton/libraries/nu_packages/MAX31875/libraries
+
+### raspberry-pi
+
+License: mit
+
+Copyright: Copyright (c) 2018 bzt
+
+Path:
+
+- bsp/raspberry-pi/raspi3-64/applications/test
+
+### raspberry-pico
+
+License: bsd-new、mit
+
+Copyright: Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
+
+Path: bsp/raspberry-pico/libraries/pico-sdk
+
+### rm48x50
+
+License: 未注明
+
+Copyright: (c) Texas Instruments 2009-2013
+
+Path:
+
+- bsp/rm48x50/HALCoGen
+
+### rv32m1_vega
+
+License: bsd-new
+
+Copyright: Copyright 2016-2017 NXP
+
+Path:
+
+- bsp/rv32m1_vega/ri5cy/board
+- bsp/rv32m1_vega/rv32m1_sdk_riscv
+
+### rx
+
+License: 未注明
+
+Copyright: Copyright, 2011. Renesas Electronics Corporation and Renesas Solutions Corporation
+
+Path: 
+
+- bsp/rx/RPDL
+
+### sam7x
+
+License: bsd-atmel
+
+Copyright: Copyright (c) 2006, Atmel Corporation
+
+Copyright: Copyright: Copyright (c) 2006, Atmel Corporation
+
+Path:
+
+- bsp/sam7x/drivers
+
+### samd21
+
+License: bsd-new
+
+Copyright: Copyright (c) 2014-2015 Atmel Corporation
+
+Path:
+
+- bsp/samd21/asflib_config
+- bsp/samd21/sam_d2x_asflib
+
+### simulator
+
+License: bsd-new、bsd-original-uc
+
+Copyright: Copyright (c) 2006 Paolo Abeni (Italy)、Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 The Regents of the University of California
+
+Path:
+
+- bsp/simulator/pcap
+
+------
+
+License: zlib
+
+Copyright: Copyright (c) 1997-2017 Sam Lantinga <slouken@libsdl.org>
+
+Path:
+
+- bsp/simulator/SDL2-2.0.7
+
+### smartfusion2
+
+License: arm-cortex-mx
+
+Copyright: Copyright (c) 2009 ARM Limited
+
+Path:
+
+- bsp/smartfusion2/CMSIS/core
+
+### stm32
+
+License: bsd-new
+
+Copyright:
+
+Path:
+
+- bsp/stm32/libraries/STM32xxxx_HAL
+- bsp/stm32/libraries/templates
+- bsp/stm32/stm32_bsp_name/board/CubeMX_Config
+
+------
+
+License: mit
+
+Copyright: COPYRIGHT 2011 STMicroelectronics
+
+Path:
+
+- bsp/stm32/libraries (exclude bsp/stm32/libraries/HAL_Drivers)
+
+### SYNWIT
+
+bsp 列表:
+
+- swm320
+
+------
+
+License: st-mcd-2.0
+
+Copyright: COPYRIGHT 2012 Synwit Technology
+
+Path:
+
+- bsp/swm320/libraries/CMSIS/DeviceSupport
+
+------
+
+License: bsd-new
+
+Copyright:  Copyright (c) 2009 - 2014 ARM LIMITED
+
+Path:
+
+- bsp/swm320/libraries/CMSIS
+
+### tae32f5300
+
+License: BSD 3-Clause
+
+Copyright (c) 2020 Tai-Action.
+
+Path:
+
+- bsp/tae32f5300/Libraries/TAE32F53xx_StdPeriph_Driver
+
+### tm4c
+
+License: unknown-license-reference(bsd-new)
+
+Copyright: Copyright (c) 2012-2017 Texas Instruments Incorporated
+
+Path:
+
+- bsp/tm4c123bsp/libraries
+- bsp/tm4c129x/libraries
+
+### tms320f28379d
+
+License: bsd-new
+
+Copyright: Copyright (c) 2013-2018 Texas Instruments Incorporated - http://www.ti.com
+
+Path:
+
+- bsp/tms320f28379d/libraries
+
+### xplorer4330
+
+License: bsd-new
+
+Copyright: Copyright (c) 2009 - 2013 ARM LIMITED
+
+Path:
+
+- bsp/xplorer4330/Libraries/CMSIS/Include
+
+------
+
+License: nxp-warranty-disclaimer
+
+Copyright: Copyright (c) 2011, NXP Semiconductor
+
+Path:
+
+- bsp/xplorer4330/Libraries/Device/NXP/LPC43xx
+
+### zynqmp-r5-axu4ev
+
+License: mit
+
+Copyright: Copyright (c) 2014 - 2020 Xilinx, Inc.
+
+Path:
+
+- bsp/zynqmp-r5-axu4ev/drivers/Zynq_HAL_Driver
+
+### n32
+
+License: 未注明
+
+Copyright: Copyright (c) 2019, Nations Technologies Inc.
+
+Path:
+
+- bsp/n32g452xx/n32g452xx-mini-system/board/msp
+
+License: bsd-new
+
+Copyright: Copyright (c) 2010-2015 ARM Limited
+
+Path:
+
+- bsp/n32g452xx/Libraries/N32_Std_Driver/CMSIS

+ 666 - 0
bsp/Vango/v85xx/.config

@@ -0,0 +1,666 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# RT-Thread Configuration
+#
+
+#
+# RT-Thread Kernel
+#
+CONFIG_RT_NAME_MAX=8
+# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
+# CONFIG_RT_USING_SMP is not set
+CONFIG_RT_ALIGN_SIZE=4
+# CONFIG_RT_THREAD_PRIORITY_8 is not set
+CONFIG_RT_THREAD_PRIORITY_32=y
+# CONFIG_RT_THREAD_PRIORITY_256 is not set
+CONFIG_RT_THREAD_PRIORITY_MAX=32
+CONFIG_RT_TICK_PER_SECOND=100
+CONFIG_RT_USING_OVERFLOW_CHECK=y
+CONFIG_RT_USING_HOOK=y
+CONFIG_RT_HOOK_USING_FUNC_PTR=y
+CONFIG_RT_USING_IDLE_HOOK=y
+CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
+CONFIG_IDLE_THREAD_STACK_SIZE=256
+CONFIG_RT_USING_TIMER_SOFT=y
+CONFIG_RT_TIMER_THREAD_PRIO=4
+CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
+
+#
+# kservice optimization
+#
+# CONFIG_RT_KSERVICE_USING_STDLIB is not set
+# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
+# CONFIG_RT_USING_TINY_FFS is not set
+# CONFIG_RT_PRINTF_LONGLONG is not set
+CONFIG_RT_DEBUG=y
+# CONFIG_RT_DEBUG_COLOR is not set
+# CONFIG_RT_DEBUG_INIT_CONFIG is not set
+# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
+# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
+# CONFIG_RT_DEBUG_IPC_CONFIG is not set
+# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
+# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
+# CONFIG_RT_DEBUG_MEM_CONFIG is not set
+# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
+# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
+# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
+
+#
+# Inter-Thread communication
+#
+CONFIG_RT_USING_SEMAPHORE=y
+CONFIG_RT_USING_MUTEX=y
+CONFIG_RT_USING_EVENT=y
+CONFIG_RT_USING_MAILBOX=y
+CONFIG_RT_USING_MESSAGEQUEUE=y
+# CONFIG_RT_USING_SIGNALS is not set
+
+#
+# Memory Management
+#
+CONFIG_RT_USING_MEMPOOL=y
+CONFIG_RT_USING_SMALL_MEM=y
+# CONFIG_RT_USING_SLAB is not set
+# CONFIG_RT_USING_MEMHEAP is not set
+CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y
+# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
+# CONFIG_RT_USING_SLAB_AS_HEAP is not set
+# CONFIG_RT_USING_USERHEAP is not set
+# CONFIG_RT_USING_NOHEAP is not set
+# CONFIG_RT_USING_MEMTRACE is not set
+# CONFIG_RT_USING_HEAP_ISR is not set
+CONFIG_RT_USING_HEAP=y
+
+#
+# Kernel Device Object
+#
+CONFIG_RT_USING_DEVICE=y
+# CONFIG_RT_USING_DEVICE_OPS is not set
+# CONFIG_RT_USING_INTERRUPT_INFO is not set
+CONFIG_RT_USING_CONSOLE=y
+CONFIG_RT_CONSOLEBUF_SIZE=128
+CONFIG_RT_CONSOLE_DEVICE_NAME="uart"
+CONFIG_RT_VER_NUM=0x40100
+# CONFIG_RT_USING_CPU_FFS is not set
+# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
+
+#
+# RT-Thread Components
+#
+CONFIG_RT_USING_COMPONENTS_INIT=y
+CONFIG_RT_USING_USER_MAIN=y
+CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
+CONFIG_RT_MAIN_THREAD_PRIORITY=10
+# CONFIG_RT_USING_LEGACY is not set
+CONFIG_RT_USING_MSH=y
+CONFIG_RT_USING_FINSH=y
+CONFIG_FINSH_USING_MSH=y
+CONFIG_FINSH_THREAD_NAME="tshell"
+CONFIG_FINSH_THREAD_PRIORITY=20
+CONFIG_FINSH_THREAD_STACK_SIZE=4096
+CONFIG_FINSH_USING_HISTORY=y
+CONFIG_FINSH_HISTORY_LINES=5
+CONFIG_FINSH_USING_SYMTAB=y
+CONFIG_FINSH_CMD_SIZE=80
+CONFIG_MSH_USING_BUILT_IN_COMMANDS=y
+CONFIG_FINSH_USING_DESCRIPTION=y
+# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
+# CONFIG_FINSH_USING_AUTH is not set
+CONFIG_FINSH_ARG_MAX=10
+CONFIG_RT_USING_DFS=y
+CONFIG_DFS_USING_POSIX=y
+CONFIG_DFS_USING_WORKDIR=y
+CONFIG_DFS_FILESYSTEMS_MAX=4
+CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
+CONFIG_DFS_FD_MAX=16
+# CONFIG_RT_USING_DFS_MNTTABLE is not set
+# CONFIG_RT_USING_DFS_ELMFAT is not set
+CONFIG_RT_USING_DFS_DEVFS=y
+# CONFIG_RT_USING_DFS_ROMFS is not set
+# CONFIG_RT_USING_DFS_RAMFS is not set
+# CONFIG_RT_USING_FAL is not set
+
+#
+# Device Drivers
+#
+CONFIG_RT_USING_DEVICE_IPC=y
+# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
+CONFIG_RT_USING_SERIAL=y
+CONFIG_RT_USING_SERIAL_V1=y
+# CONFIG_RT_USING_SERIAL_V2 is not set
+CONFIG_RT_SERIAL_USING_DMA=y
+CONFIG_RT_SERIAL_RB_BUFSZ=64
+# CONFIG_RT_USING_CAN is not set
+# CONFIG_RT_USING_HWTIMER is not set
+# CONFIG_RT_USING_CPUTIME is not set
+# CONFIG_RT_USING_I2C is not set
+# CONFIG_RT_USING_PHY is not set
+CONFIG_RT_USING_PIN=y
+# CONFIG_RT_USING_ADC is not set
+# CONFIG_RT_USING_DAC is not set
+# CONFIG_RT_USING_PWM is not set
+# CONFIG_RT_USING_MTD_NOR is not set
+# CONFIG_RT_USING_MTD_NAND is not set
+# CONFIG_RT_USING_PM is not set
+# CONFIG_RT_USING_RTC is not set
+# CONFIG_RT_USING_SDIO is not set
+# CONFIG_RT_USING_SPI is not set
+# CONFIG_RT_USING_WDT is not set
+# CONFIG_RT_USING_AUDIO is not set
+# CONFIG_RT_USING_SENSOR is not set
+# CONFIG_RT_USING_TOUCH is not set
+# CONFIG_RT_USING_HWCRYPTO is not set
+# CONFIG_RT_USING_PULSE_ENCODER is not set
+# CONFIG_RT_USING_INPUT_CAPTURE is not set
+# CONFIG_RT_USING_WIFI is not set
+
+#
+# Using USB
+#
+# CONFIG_RT_USING_USB is not set
+# CONFIG_RT_USING_USB_HOST is not set
+# CONFIG_RT_USING_USB_DEVICE is not set
+
+#
+# C/C++ and POSIX layer
+#
+CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
+
+#
+# POSIX (Portable Operating System Interface) layer
+#
+# CONFIG_RT_USING_POSIX_FS is not set
+# CONFIG_RT_USING_POSIX_DELAY is not set
+# CONFIG_RT_USING_POSIX_CLOCK is not set
+# CONFIG_RT_USING_POSIX_TIMER is not set
+# CONFIG_RT_USING_PTHREADS is not set
+# CONFIG_RT_USING_MODULE is not set
+
+#
+# Interprocess Communication (IPC)
+#
+# CONFIG_RT_USING_POSIX_PIPE is not set
+# CONFIG_RT_USING_POSIX_MESSAGE_QUEUE is not set
+# CONFIG_RT_USING_POSIX_MESSAGE_SEMAPHORE is not set
+
+#
+# Socket is in the 'Network' category
+#
+# CONFIG_RT_USING_CPLUSPLUS is not set
+
+#
+# Network
+#
+# CONFIG_RT_USING_SAL is not set
+# CONFIG_RT_USING_NETDEV is not set
+# CONFIG_RT_USING_LWIP is not set
+# CONFIG_RT_USING_AT is not set
+
+#
+# Utilities
+#
+# CONFIG_RT_USING_RYM is not set
+# CONFIG_RT_USING_ULOG is not set
+# CONFIG_RT_USING_UTEST is not set
+# CONFIG_RT_USING_VAR_EXPORT is not set
+# CONFIG_RT_USING_RT_LINK is not set
+# CONFIG_RT_USING_VBUS is not set
+
+#
+# RT-Thread Utestcases
+#
+# CONFIG_RT_USING_UTESTCASES is not set
+
+#
+# RT-Thread online packages
+#
+
+#
+# IoT - internet of things
+#
+# CONFIG_PKG_USING_LWIP is not set
+# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
+# CONFIG_PKG_USING_PAHOMQTT is not set
+# CONFIG_PKG_USING_UMQTT is not set
+# CONFIG_PKG_USING_WEBCLIENT is not set
+# CONFIG_PKG_USING_WEBNET is not set
+# CONFIG_PKG_USING_MONGOOSE is not set
+# CONFIG_PKG_USING_MYMQTT is not set
+# CONFIG_PKG_USING_KAWAII_MQTT is not set
+# CONFIG_PKG_USING_BC28_MQTT is not set
+# CONFIG_PKG_USING_WEBTERMINAL is not set
+# CONFIG_PKG_USING_LIBMODBUS is not set
+# CONFIG_PKG_USING_FREEMODBUS is not set
+# CONFIG_PKG_USING_NANOPB is not set
+
+#
+# Wi-Fi
+#
+
+#
+# Marvell WiFi
+#
+# CONFIG_PKG_USING_WLANMARVELL is not set
+
+#
+# Wiced WiFi
+#
+# CONFIG_PKG_USING_WLAN_WICED is not set
+# CONFIG_PKG_USING_RW007 is not set
+# CONFIG_PKG_USING_COAP is not set
+# CONFIG_PKG_USING_NOPOLL is not set
+# CONFIG_PKG_USING_NETUTILS is not set
+# CONFIG_PKG_USING_CMUX is not set
+# CONFIG_PKG_USING_PPP_DEVICE is not set
+# CONFIG_PKG_USING_AT_DEVICE is not set
+# CONFIG_PKG_USING_ATSRV_SOCKET is not set
+# CONFIG_PKG_USING_WIZNET is not set
+# CONFIG_PKG_USING_ZB_COORDINATOR is not set
+
+#
+# IoT Cloud
+#
+# CONFIG_PKG_USING_ONENET is not set
+# CONFIG_PKG_USING_GAGENT_CLOUD is not set
+# CONFIG_PKG_USING_ALI_IOTKIT is not set
+# CONFIG_PKG_USING_AZURE is not set
+# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set
+# CONFIG_PKG_USING_JIOT-C-SDK is not set
+# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
+# CONFIG_PKG_USING_JOYLINK is not set
+# CONFIG_PKG_USING_EZ_IOT_OS is not set
+# CONFIG_PKG_USING_NIMBLE is not set
+# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
+# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
+# CONFIG_PKG_USING_IPMSG is not set
+# CONFIG_PKG_USING_LSSDP is not set
+# CONFIG_PKG_USING_AIRKISS_OPEN is not set
+# CONFIG_PKG_USING_LIBRWS is not set
+# CONFIG_PKG_USING_TCPSERVER is not set
+# CONFIG_PKG_USING_PROTOBUF_C is not set
+# CONFIG_PKG_USING_DLT645 is not set
+# CONFIG_PKG_USING_QXWZ is not set
+# CONFIG_PKG_USING_SMTP_CLIENT is not set
+# CONFIG_PKG_USING_ABUP_FOTA is not set
+# CONFIG_PKG_USING_LIBCURL2RTT is not set
+# CONFIG_PKG_USING_CAPNP is not set
+# CONFIG_PKG_USING_AGILE_TELNET is not set
+# CONFIG_PKG_USING_NMEALIB is not set
+# CONFIG_PKG_USING_PDULIB is not set
+# CONFIG_PKG_USING_BTSTACK is not set
+# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
+# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
+# CONFIG_PKG_USING_MAVLINK is not set
+# CONFIG_PKG_USING_BSAL is not set
+# CONFIG_PKG_USING_AGILE_MODBUS is not set
+# CONFIG_PKG_USING_AGILE_FTP is not set
+# CONFIG_PKG_USING_EMBEDDEDPROTO is not set
+# CONFIG_PKG_USING_RT_LINK_HW is not set
+# CONFIG_PKG_USING_LORA_PKT_FWD is not set
+# CONFIG_PKG_USING_LORA_GW_DRIVER_LIB is not set
+# CONFIG_PKG_USING_LORA_PKT_SNIFFER is not set
+# CONFIG_PKG_USING_HM is not set
+# CONFIG_PKG_USING_SMALL_MODBUS is not set
+# CONFIG_PKG_USING_NET_SERVER is not set
+
+#
+# security packages
+#
+# CONFIG_PKG_USING_MBEDTLS is not set
+# CONFIG_PKG_USING_LIBSODIUM is not set
+# CONFIG_PKG_USING_TINYCRYPT is not set
+# CONFIG_PKG_USING_TFM is not set
+# CONFIG_PKG_USING_YD_CRYPTO is not set
+
+#
+# language packages
+#
+
+#
+# JSON: JavaScript Object Notation, a lightweight data-interchange format
+#
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
+
+#
+# XML: Extensible Markup Language
+#
+# CONFIG_PKG_USING_SIMPLE_XML is not set
+# CONFIG_PKG_USING_EZXML is not set
+# CONFIG_PKG_USING_LUATOS_SOC is not set
+# CONFIG_PKG_USING_LUA is not set
+# CONFIG_PKG_USING_JERRYSCRIPT is not set
+# CONFIG_PKG_USING_MICROPYTHON is not set
+# CONFIG_PKG_USING_PIKASCRIPT is not set
+
+#
+# multimedia packages
+#
+
+#
+# LVGL: powerful and easy-to-use embedded GUI library
+#
+# CONFIG_PKG_USING_LVGL is not set
+# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
+# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
+
+#
+# u8g2: a monochrome graphic library
+#
+# CONFIG_PKG_USING_U8G2_OFFICIAL is not set
+# CONFIG_PKG_USING_U8G2 is not set
+# CONFIG_PKG_USING_OPENMV is not set
+# CONFIG_PKG_USING_MUPDF is not set
+# CONFIG_PKG_USING_STEMWIN is not set
+# CONFIG_PKG_USING_WAVPLAYER is not set
+# CONFIG_PKG_USING_TJPGD is not set
+# CONFIG_PKG_USING_PDFGEN is not set
+# CONFIG_PKG_USING_HELIX is not set
+# CONFIG_PKG_USING_AZUREGUIX is not set
+# CONFIG_PKG_USING_TOUCHGFX2RTT is not set
+# CONFIG_PKG_USING_NUEMWIN is not set
+# CONFIG_PKG_USING_MP3PLAYER is not set
+# CONFIG_PKG_USING_TINYJPEG is not set
+# CONFIG_PKG_USING_UGUI is not set
+
+#
+# PainterEngine: A cross-platform graphics application framework written in C language
+#
+# CONFIG_PKG_USING_PAINTERENGINE is not set
+# CONFIG_PKG_USING_PAINTERENGINE_AUX is not set
+# CONFIG_PKG_USING_MCURSES is not set
+# CONFIG_PKG_USING_TERMBOX is not set
+# CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
+
+#
+# tools packages
+#
+# CONFIG_PKG_USING_CMBACKTRACE is not set
+# CONFIG_PKG_USING_EASYFLASH is not set
+# CONFIG_PKG_USING_EASYLOGGER is not set
+# CONFIG_PKG_USING_SYSTEMVIEW is not set
+# CONFIG_PKG_USING_SEGGER_RTT is not set
+# CONFIG_PKG_USING_RDB is not set
+# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
+# CONFIG_PKG_USING_ULOG_FILE is not set
+# CONFIG_PKG_USING_LOGMGR is not set
+# CONFIG_PKG_USING_ADBD is not set
+# CONFIG_PKG_USING_COREMARK is not set
+# CONFIG_PKG_USING_DHRYSTONE is not set
+# CONFIG_PKG_USING_MEMORYPERF is not set
+# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
+# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
+# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
+# CONFIG_PKG_USING_BS8116A is not set
+# CONFIG_PKG_USING_GPS_RMC is not set
+# CONFIG_PKG_USING_URLENCODE is not set
+# CONFIG_PKG_USING_UMCN is not set
+# CONFIG_PKG_USING_LWRB2RTT is not set
+# CONFIG_PKG_USING_CPU_USAGE is not set
+# CONFIG_PKG_USING_GBK2UTF8 is not set
+# CONFIG_PKG_USING_VCONSOLE is not set
+# CONFIG_PKG_USING_KDB is not set
+# CONFIG_PKG_USING_WAMR is not set
+# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set
+# CONFIG_PKG_USING_LWLOG is not set
+# CONFIG_PKG_USING_ANV_TRACE is not set
+# CONFIG_PKG_USING_ANV_MEMLEAK is not set
+# CONFIG_PKG_USING_ANV_TESTSUIT is not set
+# CONFIG_PKG_USING_ANV_BENCH is not set
+# CONFIG_PKG_USING_DEVMEM is not set
+# CONFIG_PKG_USING_REGEX is not set
+# CONFIG_PKG_USING_MEM_SANDBOX is not set
+# CONFIG_PKG_USING_SOLAR_TERMS is not set
+# CONFIG_PKG_USING_GAN_ZHI is not set
+# CONFIG_PKG_USING_FDT is not set
+# CONFIG_PKG_USING_CBOX is not set
+# CONFIG_PKG_USING_SNOWFLAKE is not set
+
+#
+# system packages
+#
+
+#
+# enhanced kernel services
+#
+# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
+# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
+# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
+
+#
+# POSIX extension functions
+#
+# CONFIG_PKG_USING_POSIX_GETLINE is not set
+# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
+# CONFIG_PKG_USING_POSIX_ITOA is not set
+# CONFIG_PKG_USING_POSIX_STRINGS is not set
+
+#
+# acceleration: Assembly language or algorithmic acceleration packages
+#
+# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
+# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
+# CONFIG_PKG_USING_QFPLIB_M3 is not set
+
+#
+# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
+#
+# CONFIG_PKG_USING_CMSIS_5 is not set
+# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
+
+#
+# Micrium: Micrium software products porting for RT-Thread
+#
+# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set
+# CONFIG_PKG_USING_UCOSII_WRAPPER is not set
+# CONFIG_PKG_USING_UC_CRC is not set
+# CONFIG_PKG_USING_UC_CLK is not set
+# CONFIG_PKG_USING_UC_COMMON is not set
+# CONFIG_PKG_USING_UC_MODBUS is not set
+# CONFIG_PKG_USING_RTDUINO is not set
+# CONFIG_PKG_USING_CAIRO is not set
+# CONFIG_PKG_USING_PIXMAN is not set
+# CONFIG_PKG_USING_PARTITION is not set
+# CONFIG_PKG_USING_FLASHDB is not set
+# CONFIG_PKG_USING_SQLITE is not set
+# CONFIG_PKG_USING_RTI is not set
+# CONFIG_PKG_USING_DFS_YAFFS is not set
+# CONFIG_PKG_USING_LITTLEFS is not set
+# CONFIG_PKG_USING_DFS_JFFS2 is not set
+# CONFIG_PKG_USING_DFS_UFFS is not set
+# CONFIG_PKG_USING_LWEXT4 is not set
+# CONFIG_PKG_USING_THREAD_POOL is not set
+# CONFIG_PKG_USING_ROBOTS is not set
+# CONFIG_PKG_USING_EV is not set
+# CONFIG_PKG_USING_SYSWATCH is not set
+# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
+# CONFIG_PKG_USING_PLCCORE is not set
+# CONFIG_PKG_USING_RAMDISK is not set
+# CONFIG_PKG_USING_MININI is not set
+# CONFIG_PKG_USING_QBOOT is not set
+# CONFIG_PKG_USING_PPOOL is not set
+# CONFIG_PKG_USING_OPENAMP is not set
+# CONFIG_PKG_USING_LPM is not set
+# CONFIG_PKG_USING_TLSF is not set
+# CONFIG_PKG_USING_EVENT_RECORDER is not set
+# CONFIG_PKG_USING_ARM_2D is not set
+# CONFIG_PKG_USING_MCUBOOT is not set
+# CONFIG_PKG_USING_TINYUSB is not set
+# CONFIG_PKG_USING_CHERRYUSB is not set
+# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+
+#
+# peripheral libraries and drivers
+#
+# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
+# CONFIG_PKG_USING_REALTEK_AMEBA is not set
+# CONFIG_PKG_USING_SHT2X is not set
+# CONFIG_PKG_USING_SHT3X is not set
+# CONFIG_PKG_USING_AS7341 is not set
+# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_ICM20608 is not set
+# CONFIG_PKG_USING_BUTTON is not set
+# CONFIG_PKG_USING_PCF8574 is not set
+# CONFIG_PKG_USING_SX12XX is not set
+# CONFIG_PKG_USING_SIGNAL_LED is not set
+# CONFIG_PKG_USING_LEDBLINK is not set
+# CONFIG_PKG_USING_LITTLED is not set
+# CONFIG_PKG_USING_LKDGUI is not set
+# CONFIG_PKG_USING_NRF5X_SDK is not set
+# CONFIG_PKG_USING_NRFX is not set
+# CONFIG_PKG_USING_WM_LIBRARIES is not set
+# CONFIG_PKG_USING_KENDRYTE_SDK is not set
+# CONFIG_PKG_USING_INFRARED is not set
+# CONFIG_PKG_USING_MULTI_INFRARED is not set
+# CONFIG_PKG_USING_AGILE_BUTTON is not set
+# CONFIG_PKG_USING_AGILE_LED is not set
+# CONFIG_PKG_USING_AT24CXX is not set
+# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
+# CONFIG_PKG_USING_AD7746 is not set
+# CONFIG_PKG_USING_PCA9685 is not set
+# CONFIG_PKG_USING_I2C_TOOLS is not set
+# CONFIG_PKG_USING_NRF24L01 is not set
+# CONFIG_PKG_USING_TOUCH_DRIVERS is not set
+# CONFIG_PKG_USING_MAX17048 is not set
+# CONFIG_PKG_USING_RPLIDAR is not set
+# CONFIG_PKG_USING_AS608 is not set
+# CONFIG_PKG_USING_RC522 is not set
+# CONFIG_PKG_USING_WS2812B is not set
+# CONFIG_PKG_USING_EMBARC_BSP is not set
+# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set
+# CONFIG_PKG_USING_MULTI_RTIMER is not set
+# CONFIG_PKG_USING_MAX7219 is not set
+# CONFIG_PKG_USING_BEEP is not set
+# CONFIG_PKG_USING_EASYBLINK is not set
+# CONFIG_PKG_USING_PMS_SERIES is not set
+# CONFIG_PKG_USING_CAN_YMODEM is not set
+# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set
+# CONFIG_PKG_USING_QLED is not set
+# CONFIG_PKG_USING_PAJ7620 is not set
+# CONFIG_PKG_USING_AGILE_CONSOLE is not set
+# CONFIG_PKG_USING_LD3320 is not set
+# CONFIG_PKG_USING_WK2124 is not set
+# CONFIG_PKG_USING_LY68L6400 is not set
+# CONFIG_PKG_USING_DM9051 is not set
+# CONFIG_PKG_USING_SSD1306 is not set
+# CONFIG_PKG_USING_QKEY is not set
+# CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_RS232 is not set
+# CONFIG_PKG_USING_NES is not set
+# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
+# CONFIG_PKG_USING_VDEVICE is not set
+# CONFIG_PKG_USING_SGM706 is not set
+# CONFIG_PKG_USING_STM32WB55_SDK is not set
+# CONFIG_PKG_USING_RDA58XX is not set
+# CONFIG_PKG_USING_LIBNFC is not set
+# CONFIG_PKG_USING_MFOC is not set
+# CONFIG_PKG_USING_TMC51XX is not set
+# CONFIG_PKG_USING_TCA9534 is not set
+# CONFIG_PKG_USING_KOBUKI is not set
+# CONFIG_PKG_USING_ROSSERIAL is not set
+# CONFIG_PKG_USING_MICRO_ROS is not set
+# CONFIG_PKG_USING_MCP23008 is not set
+# CONFIG_PKG_USING_BLUETRUM_SDK is not set
+# CONFIG_PKG_USING_MISAKA_AT24CXX is not set
+# CONFIG_PKG_USING_MISAKA_RGB_BLING is not set
+# CONFIG_PKG_USING_LORA_MODEM_DRIVER is not set
+# CONFIG_PKG_USING_BL_MCU_SDK is not set
+# CONFIG_PKG_USING_SOFT_SERIAL is not set
+# CONFIG_PKG_USING_MB85RS16 is not set
+# CONFIG_PKG_USING_CW2015 is not set
+# CONFIG_PKG_USING_RFM300 is not set
+
+#
+# AI packages
+#
+# CONFIG_PKG_USING_LIBANN is not set
+# CONFIG_PKG_USING_NNOM is not set
+# CONFIG_PKG_USING_ONNX_BACKEND is not set
+# CONFIG_PKG_USING_ONNX_PARSER is not set
+# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
+# CONFIG_PKG_USING_ELAPACK is not set
+# CONFIG_PKG_USING_ULAPACK is not set
+# CONFIG_PKG_USING_QUEST is not set
+# CONFIG_PKG_USING_NAXOS is not set
+
+#
+# miscellaneous packages
+#
+
+#
+# project laboratory
+#
+
+#
+# samples: kernel and components samples
+#
+# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
+# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
+# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
+# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+
+#
+# entertainment: terminal games and other interesting software packages
+#
+# CONFIG_PKG_USING_CMATRIX is not set
+# CONFIG_PKG_USING_SL is not set
+# CONFIG_PKG_USING_CAL is not set
+# CONFIG_PKG_USING_ACLOCK is not set
+# CONFIG_PKG_USING_THREES is not set
+# CONFIG_PKG_USING_2048 is not set
+# CONFIG_PKG_USING_SNAKE is not set
+# CONFIG_PKG_USING_TETRIS is not set
+# CONFIG_PKG_USING_DONUT is not set
+# CONFIG_PKG_USING_COWSAY is not set
+# CONFIG_PKG_USING_LIBCSV is not set
+# CONFIG_PKG_USING_OPTPARSE is not set
+# CONFIG_PKG_USING_FASTLZ is not set
+# CONFIG_PKG_USING_MINILZO is not set
+# CONFIG_PKG_USING_QUICKLZ is not set
+# CONFIG_PKG_USING_LZMA is not set
+# CONFIG_PKG_USING_MULTIBUTTON is not set
+# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
+# CONFIG_PKG_USING_CANFESTIVAL is not set
+# CONFIG_PKG_USING_ZLIB is not set
+# CONFIG_PKG_USING_MINIZIP is not set
+# CONFIG_PKG_USING_HEATSHRINK is not set
+# CONFIG_PKG_USING_DSTR is not set
+# CONFIG_PKG_USING_TINYFRAME is not set
+# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
+# CONFIG_PKG_USING_DIGITALCTRL is not set
+# CONFIG_PKG_USING_UPACKER is not set
+# CONFIG_PKG_USING_UPARAM is not set
+# CONFIG_PKG_USING_HELLO is not set
+# CONFIG_PKG_USING_VI is not set
+# CONFIG_PKG_USING_KI is not set
+# CONFIG_PKG_USING_ARMv7M_DWT is not set
+# CONFIG_PKG_USING_UKAL is not set
+# CONFIG_PKG_USING_CRCLIB is not set
+# CONFIG_PKG_USING_LWGPS is not set
+# CONFIG_PKG_USING_STATE_MACHINE is not set
+# CONFIG_PKG_USING_DESIGN_PATTERN is not set
+# CONFIG_PKG_USING_CONTROLLER is not set
+# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
+# CONFIG_PKG_USING_MFBD is not set
+CONFIG_SOC_SERIES_V85XX=y
+CONFIG_SOC_V85XX=y
+
+#
+# On-chip Peripheral Drivers
+#
+CONFIG_BSP_USING_UART=y
+# CONFIG_BSP_USING_UART0 is not set
+# CONFIG_BSP_USING_UART1 is not set
+CONFIG_BSP_USING_UART2=y
+# CONFIG_BSP_USING_UART3 is not set
+# CONFIG_BSP_USING_UART4 is not set
+# CONFIG_BSP_USING_ADC is not set
+# CONFIG_BSP_USING_HWTIMER is not set
+# CONFIG_BSP_USING_WDT is not set
+# CONFIG_BSP_USING_RTC is not set

+ 109 - 0
bsp/Vango/v85xx/Kconfig

@@ -0,0 +1,109 @@
+mainmenu "RT-Thread Configuration"
+
+config BSP_DIR
+    string
+    option env="BSP_ROOT"
+    default "."
+
+config RTT_DIR
+    string
+    option env="RTT_ROOT"
+    default "../../.."
+    
+# you can change the RTT_ROOT default: "rt-thread"
+# example : default "F:/git_repositories/rt-thread"
+
+config PKGS_DIR
+    string
+    option env="PKGS_ROOT"
+    default "packages"
+
+source "$RTT_DIR/Kconfig"
+source "$PKGS_DIR/Kconfig"
+
+config SOC_SERIES_V85XX
+    bool
+    default y
+
+config SOC_V85XX
+    bool
+    select RT_USING_COMPONENTS_INIT
+    select RT_USING_USER_MAIN
+    select SOC_SERIES_V85XX
+    default y
+
+menu "On-chip Peripheral Drivers"
+    menuconfig BSP_USING_UART
+        bool "Enable UART"
+        default y
+        select RT_USING_SERIAL
+        if BSP_USING_UART
+            config BSP_USING_UART0
+                bool "using uart0"
+                default n
+            config BSP_USING_UART1
+                bool "using uart1"
+                default n
+            config BSP_USING_UART2
+                bool "using uart2"
+                default y
+            config BSP_USING_UART3
+                bool "using uart3"
+                default n
+            config BSP_USING_UART4
+                bool "using uart4"
+                default n
+        endif
+    menuconfig BSP_USING_ADC
+        bool "Enable ADC"
+        default n
+        select RT_USING_ADC
+        if BSP_USING_ADC
+            config BSP_USING_ADC0
+                bool "using adc0"
+                default n
+            config BSP_USING_ADC1
+                bool "using adc1"
+                default n
+        endif
+    menuconfig BSP_USING_HWTIMER
+        bool "Enable hwtimer"
+        default n
+        select RT_USING_HWTIMER
+        if BSP_USING_HWTIMER
+            config BSP_USING_HWTIMER0
+                bool "using hwtimer0"
+                default n
+            config BSP_USING_HWTIMER1
+                bool "using hwtimer1"
+                default n
+            config BSP_USING_HWTIMER2
+                bool "using hwtimer2"
+                default n
+            config BSP_USING_HWTIMER3
+                bool "using hwtimer3"
+                default n
+            config BSP_USING_HWTIMER4
+                bool "using hwtimer4"
+                default n
+            config BSP_USING_HWTIMER5
+                bool "using hwtimer5"
+                default n
+            config BSP_USING_HWTIMER6
+                bool "using hwtimer6"
+                default n
+            config BSP_USING_HWTIMER7
+                bool "using hwtimer7"
+                default n
+        endif
+    config BSP_USING_WDT
+        bool "Enable Watchdog Timer"
+        select RT_USING_WDT
+        default n
+
+    config BSP_USING_RTC
+        bool "using internal rtc"
+        default n
+        select RT_USING_RTC
+
+endmenu

+ 7 - 0
bsp/Vango/v85xx/Libraries/.ignore_format.yml

@@ -0,0 +1,7 @@
+# files format check exclude path, please follow the instructions below to modify;
+# If you need to exclude an entire folder, add the folder path in dir_path;
+# If you need to exclude a file, add the path to the file in file_path.
+
+dir_path:
+- CMSIS
+- VangoV85xx_standard_peripheral

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff