Prechádzať zdrojové kódy

Merge pull request #8 from RT-Thread/master

pr
Meco Man 5 rokov pred
rodič
commit
4a4f00de6b
100 zmenil súbory, kde vykonal 23555 pridanie a 4136 odobranie
  1. 1 1
      bsp/gd32450z-eval/drivers/drv_spi.c
  2. 64 70
      bsp/lpc176x/project.ewp
  3. 104 111
      bsp/lpc176x/project.uvproj
  4. 113 120
      bsp/lpc178x/project.uvproj
  5. 96 103
      bsp/lpc2478/project.uvproj
  6. 168 165
      bsp/lpc408x/project.uvproj
  7. 168 165
      bsp/lpc408x/project.uvprojx
  8. 209 216
      bsp/lpc5410x/project.uvprojx
  9. 275 275
      bsp/lpc54114-lite/project.uvprojx
  10. 451 450
      bsp/lpc54608-LPCXpresso/project.uvprojx
  11. 0 1632
      bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvoptx
  12. 385 294
      bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvprojx
  13. 197 214
      bsp/lpc55sxx/lpc55s69_nxp_evk_ns/project.uvprojx
  14. 37 5
      bsp/ls2kdev/.config
  15. 22 3
      bsp/ls2kdev/README.md
  16. 47 0
      bsp/ls2kdev/applications/mnt.c
  17. 14 0
      bsp/ls2kdev/drivers/ata/SConscript
  18. 281 0
      bsp/ls2kdev/drivers/ata/ahci.h
  19. 20 0
      bsp/ls2kdev/drivers/ata/ata_debug.h
  20. 101 0
      bsp/ls2kdev/drivers/ata/ata_interface.h
  21. 127 0
      bsp/ls2kdev/drivers/ata/blk_device.c
  22. 48 0
      bsp/ls2kdev/drivers/ata/blk_device.h
  23. 1234 0
      bsp/ls2kdev/drivers/ata/dwc_ahsata.c
  24. 25 0
      bsp/ls2kdev/drivers/ata/dwc_ahsata.h
  25. 323 0
      bsp/ls2kdev/drivers/ata/dwc_ahsata_priv.h
  26. 152 0
      bsp/ls2kdev/drivers/ata/fis.h
  27. 150 0
      bsp/ls2kdev/drivers/ata/libata.c
  28. 653 0
      bsp/ls2kdev/drivers/ata/libata.h
  29. 10 0
      bsp/ls2kdev/drivers/pci/SConscript
  30. 20 0
      bsp/ls2kdev/drivers/pci/pci.c
  31. 42 0
      bsp/ls2kdev/drivers/pci/pci.h
  32. 6 3
      bsp/ls2kdev/rtconfig.h
  33. 12 1
      bsp/nrf5x/libraries/templates/nrf52x/applications/ble_nus_app.c
  34. 3 2
      bsp/nuvoton/README.md
  35. 2 2
      bsp/nuvoton/libraries/m480/StdDriver/src/nu_can.c
  36. 1 1
      bsp/nuvoton/libraries/m480/USBHostLib/inc/usbh_lib.h
  37. 1 1
      bsp/nuvoton/libraries/m480/USBHostLib/src/usb_core.c
  38. 7 0
      bsp/nuvoton/libraries/m480/rtt_port/Kconfig
  39. 4 2
      bsp/nuvoton/libraries/m480/rtt_port/drv_bpwm_capture.c
  40. 41 30
      bsp/nuvoton/libraries/m480/rtt_port/drv_can.c
  41. 20 40
      bsp/nuvoton/libraries/m480/rtt_port/drv_clk.c
  42. 13 10
      bsp/nuvoton/libraries/m480/rtt_port/drv_crc.c
  43. 0 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_crc.h
  44. 239 60
      bsp/nuvoton/libraries/m480/rtt_port/drv_crypto.c
  45. 5 4
      bsp/nuvoton/libraries/m480/rtt_port/drv_ecap.c
  46. 8 7
      bsp/nuvoton/libraries/m480/rtt_port/drv_epwm_capture.c
  47. 6 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_fmc.c
  48. 28 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_gpio.c
  49. 3 3
      bsp/nuvoton/libraries/m480/rtt_port/drv_i2c.c
  50. 76 33
      bsp/nuvoton/libraries/m480/rtt_port/drv_pdma.c
  51. 1 0
      bsp/nuvoton/libraries/m480/rtt_port/drv_pdma.h
  52. 5 5
      bsp/nuvoton/libraries/m480/rtt_port/drv_rtc.c
  53. 24 11
      bsp/nuvoton/libraries/m480/rtt_port/drv_spi.c
  54. 14 10
      bsp/nuvoton/libraries/m480/rtt_port/drv_timer_capture.c
  55. 1 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_trng.c
  56. 0 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_trng.h
  57. 2 2
      bsp/nuvoton/libraries/m480/rtt_port/drv_uart.c
  58. 1 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_usbd.c
  59. 72 32
      bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c
  60. 1 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_uspi.c
  61. 12 11
      bsp/nuvoton/libraries/m480/rtt_port/drv_wdt.c
  62. 12 5
      bsp/nuvoton/libraries/nu_packages/AudioCodec/SConscript
  63. 448 0
      bsp/nuvoton/libraries/nu_packages/AudioCodec/acodec_nau8822.c
  64. 32 0
      bsp/nuvoton/libraries/nu_packages/AudioCodec/acodec_nau8822.h
  65. 2 0
      bsp/nuvoton/libraries/nu_packages/Demo/SConscript
  66. 113 0
      bsp/nuvoton/libraries/nu_packages/Demo/slcd_show_tick.c
  67. 70 0
      bsp/nuvoton/libraries/nu_packages/Demo/usbd_cdc_vcom_echo.c
  68. 13 14
      bsp/nuvoton/libraries/nu_packages/Demo/usbd_hid_dance_mouse.c
  69. 9 0
      bsp/nuvoton/libraries/nu_packages/ILI9341/ili9341_ebi.c
  70. 8 2
      bsp/nuvoton/libraries/nu_packages/ILI9341/ili9341_spi.c
  71. 52 10
      bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.c
  72. 8 2
      bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.h
  73. 13 0
      bsp/nuvoton/libraries/nu_packages/Kconfig
  74. 4 2
      bsp/nuvoton/libraries/nu_packages/NuUtils/inc/nu_bitutil.h
  75. 12 0
      bsp/nuvoton/libraries/nu_packages/SLCD/SConscript
  76. 780 0
      bsp/nuvoton/libraries/nu_packages/SLCD/slcd_rhe6616tp01.c
  77. 139 0
      bsp/nuvoton/libraries/nu_packages/SLCD/slcd_rhe6616tp01.h
  78. 49 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/NuMicro.h
  79. 2063 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/emac_reg.h
  80. 110 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_adc.h
  81. 461 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_can.h
  82. 471 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_cap.h
  83. 1456 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_crypto.h
  84. 418 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_ebi.h
  85. 396 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_emac.h
  86. 869 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_etimer.h
  87. 835 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_gpio.h
  88. 541 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_i2c.h
  89. 133 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_i2s.h
  90. 1249 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_pdma.h
  91. 271 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_pwm.h
  92. 929 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_qspi.h
  93. 445 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_rtc.h
  94. 425 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_sc.h
  95. 333 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_scuart.h
  96. 721 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_sdh.h
  97. 852 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_spi.h
  98. 838 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_sys.h
  99. 888 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_uart.h
  100. 942 0
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_usbd.h

+ 1 - 1
bsp/gd32450z-eval/drivers/drv_spi.c

@@ -130,7 +130,7 @@ static rt_err_t configure(struct rt_spi_device* device,
         }
     } /* baudrate */
     
-    switch(configuration->mode)
+    switch(configuration->mode & RT_SPI_MODE_3)
     {
     case RT_SPI_MODE_0:
         spi_init_struct.clock_polarity_phase = SPI_CK_PL_LOW_PH_1EDGE;

+ 64 - 70
bsp/lpc176x/project.ewp

@@ -155,6 +155,7 @@
         <option>
           <name>CCDefines</name>
           <state />
+          <state>__RTTHREAD__</state>
         </option>
         <option>
           <name>CCPreprocFile</name>
@@ -284,14 +285,13 @@
         <option>
           <name>CCIncludePath2</name>
           <state />
-          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\ipv4</state>
           <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src</state>
-          <state>$PROJ_DIR$\applications</state>
+          <state>$PROJ_DIR$\..\..\include</state>
           <state>$PROJ_DIR$\CMSIS\CM3\DeviceSupport\NXP\LPC17xx</state>
           <state>$PROJ_DIR$\drivers</state>
-          <state>$PROJ_DIR$\..\..\components\libc\compilers\common</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\ipv4</state>
           <state>$PROJ_DIR$\.</state>
-          <state>$PROJ_DIR$\..\..\include</state>
+          <state>$PROJ_DIR$\applications</state>
           <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\netif</state>
           <state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m3</state>
           <state>$PROJ_DIR$\CMSIS\CMSIS\Include</state>
@@ -1037,6 +1037,7 @@
         <option>
           <name>CCDefines</name>
           <state>NDEBUG</state>
+          <state>__RTTHREAD__</state>
         </option>
         <option>
           <name>CCPreprocFile</name>
@@ -1166,14 +1167,13 @@
         <option>
           <name>CCIncludePath2</name>
           <state />
-          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\ipv4</state>
           <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src</state>
-          <state>$PROJ_DIR$\applications</state>
+          <state>$PROJ_DIR$\..\..\include</state>
           <state>$PROJ_DIR$\CMSIS\CM3\DeviceSupport\NXP\LPC17xx</state>
           <state>$PROJ_DIR$\drivers</state>
-          <state>$PROJ_DIR$\..\..\components\libc\compilers\common</state>
+          <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\ipv4</state>
           <state>$PROJ_DIR$\.</state>
-          <state>$PROJ_DIR$\..\..\include</state>
+          <state>$PROJ_DIR$\applications</state>
           <state>$PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\netif</state>
           <state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m3</state>
           <state>$PROJ_DIR$\CMSIS\CMSIS\Include</state>
@@ -1765,155 +1765,149 @@
     </settings>
   </configuration>
   <group>
-    <name>Kernel</name>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\clock.c</name>
-    </file>
+    <name>Applications</name>
     <file>
-      <name>$PROJ_DIR$\..\..\src\components.c</name>
+      <name>$PROJ_DIR$\applications\application.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\cpu.c</name>
+      <name>$PROJ_DIR$\applications\platform.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\device.c</name>
+      <name>$PROJ_DIR$\applications\startup.c</name>
     </file>
+  </group>
+  <group>
+    <name>CMSIS</name>
     <file>
-      <name>$PROJ_DIR$\..\..\src\idle.c</name>
+      <name>$PROJ_DIR$\CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\ipc.c</name>
+      <name>$PROJ_DIR$\CMSIS\CM3\DeviceSupport\NXP\LPC17xx\startup\iar\startup_LPC17xx.s</name>
     </file>
+  </group>
+  <group>
+    <name>CPU</name>
     <file>
-      <name>$PROJ_DIR$\..\..\src\irq.c</name>
+      <name>$PROJ_DIR$\..\..\libcpu\arm\common\backtrace.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\kservice.c</name>
+      <name>$PROJ_DIR$\..\..\libcpu\arm\common\div0.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\mem.c</name>
+      <name>$PROJ_DIR$\..\..\libcpu\arm\common\showmem.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\memheap.c</name>
+      <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m3\cpuport.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\mempool.c</name>
+      <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m3\context_iar.S</name>
     </file>
+  </group>
+  <group>
+    <name>Drivers</name>
     <file>
-      <name>$PROJ_DIR$\..\..\src\object.c</name>
+      <name>$PROJ_DIR$\drivers\board.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\scheduler.c</name>
+      <name>$PROJ_DIR$\drivers\emac.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\signal.c</name>
+      <name>$PROJ_DIR$\drivers\led.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\thread.c</name>
+      <name>$PROJ_DIR$\drivers\spi.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\src\timer.c</name>
+      <name>$PROJ_DIR$\drivers\uart.c</name>
     </file>
   </group>
   <group>
-    <name>Applications</name>
+    <name>finsh</name>
     <file>
-      <name>$PROJ_DIR$\applications\application.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\shell.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\applications\platform.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\cmd.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\applications\startup.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_compiler.c</name>
     </file>
-  </group>
-  <group>
-    <name>CMSIS</name>
     <file>
-      <name>$PROJ_DIR$\CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\CMSIS\CM3\DeviceSupport\NXP\LPC17xx\startup\iar\startup_LPC17xx.s</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.c</name>
     </file>
-  </group>
-  <group>
-    <name>Drivers</name>
     <file>
-      <name>$PROJ_DIR$\drivers\board.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_init.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\drivers\emac.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\drivers\led.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\drivers\spi.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\drivers\uart.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.c</name>
     </file>
-  </group>
-  <group>
-    <name>cpu</name>
     <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\common\backtrace.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\common\div0.c</name>
+      <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.c</name>
     </file>
+  </group>
+  <group>
+    <name>Kernel</name>
     <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\common\showmem.c</name>
+      <name>$PROJ_DIR$\..\..\src\clock.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m3\cpuport.c</name>
+      <name>$PROJ_DIR$\..\..\src\components.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m3\context_iar.S</name>
+      <name>$PROJ_DIR$\..\..\src\device.c</name>
     </file>
-  </group>
-  <group>
-    <name>finsh</name>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\shell.c</name>
+      <name>$PROJ_DIR$\..\..\src\idle.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\cmd.c</name>
+      <name>$PROJ_DIR$\..\..\src\ipc.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_compiler.c</name>
+      <name>$PROJ_DIR$\..\..\src\irq.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.c</name>
+      <name>$PROJ_DIR$\..\..\src\kservice.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.c</name>
+      <name>$PROJ_DIR$\..\..\src\mem.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_init.c</name>
+      <name>$PROJ_DIR$\..\..\src\memheap.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.c</name>
+      <name>$PROJ_DIR$\..\..\src\mempool.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.c</name>
+      <name>$PROJ_DIR$\..\..\src\object.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.c</name>
+      <name>$PROJ_DIR$\..\..\src\scheduler.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.c</name>
+      <name>$PROJ_DIR$\..\..\src\signal.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.c</name>
+      <name>$PROJ_DIR$\..\..\src\thread.c</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.c</name>
+      <name>$PROJ_DIR$\..\..\src\timer.c</name>
     </file>
   </group>
-  <group>
-    <name>libc</name>
-  </group>
   <group>
     <name>lwIP</name>
     <file>

+ 104 - 111
bsp/lpc176x/project.uvproj

@@ -352,9 +352,9 @@
             <uSurpInc>0</uSurpInc>
             <VariousControls>
               <MiscControls />
-              <Define />
+              <Define>__RTTHREAD__</Define>
               <Undefine />
-              <IncludePath>.;..\..\include;applications;.;CMSIS\CM3\DeviceSupport\NXP\LPC17xx;CMSIS\CMSIS\Include;drivers;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\finsh;..\..\components\libc\compilers\common;..\..\components\net\lwip-2.0.2\src;..\..\components\net\lwip-2.0.2\src\include;..\..\components\net\lwip-2.0.2\src\include\ipv4;..\..\components\net\lwip-2.0.2\src\arch\include;..\..\components\net\lwip-2.0.2\src\include\netif;..\..\components\net\lwip-2.0.2\src\include\posix</IncludePath>
+              <IncludePath>applications;.;CMSIS\CM3\DeviceSupport\NXP\LPC17xx;CMSIS\CMSIS\Include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;drivers;..\..\components\finsh;.;..\..\include;..\..\components\net\lwip-2.0.2\src;..\..\components\net\lwip-2.0.2\src\include;..\..\components\net\lwip-2.0.2\src\include\ipv4;..\..\components\net\lwip-2.0.2\src\arch\include;..\..\components\net\lwip-2.0.2\src\include\netif;..\..\components\net\lwip-2.0.2\src\include\posix</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -393,321 +393,314 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>application.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\components.c</FilePath>
+              <FilePath>applications\application.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpu.c</FileName>
+              <FileName>platform.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\cpu.c</FilePath>
+              <FilePath>applications\platform.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>startup.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\device.c</FilePath>
+              <FilePath>applications\startup.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CMSIS</GroupName>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
+              <FileName>system_LPC17xx.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\idle.c</FilePath>
+              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\ipc.c</FilePath>
+              <FileName>startup_LPC17xx.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\startup\arm\startup_LPC17xx.s</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\irq.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mem.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>memheap.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\memheap.c</FilePath>
+              <FilePath>..\..\libcpu\arm\cortex-m3\cpuport.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\mempool.c</FilePath>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m3\context_rvds.S</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>object.c</FileName>
+              <FileName>board.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\object.c</FilePath>
+              <FilePath>drivers\board.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>emac.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\scheduler.c</FilePath>
+              <FilePath>drivers\emac.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>led.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\signal.c</FilePath>
+              <FilePath>drivers\led.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>spi.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\thread.c</FilePath>
+              <FilePath>drivers\spi.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\timer.c</FilePath>
+              <FilePath>drivers\uart.c</FilePath>
             </File>
           </Files>
         </Group>
         <Group>
-          <GroupName>Applications</GroupName>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>application.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\application.c</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>platform.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\platform.c</FilePath>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup.c</FileName>
+              <FileName>finsh_compiler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\startup.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>CMSIS</GroupName>
           <Files>
             <File>
-              <FileName>system_LPC17xx.c</FileName>
+              <FileName>finsh_error.c</FileName>
               <FileType>1</FileType>
-              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup_LPC17xx.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\startup\arm\startup_LPC17xx.s</FilePath>
+              <FileName>finsh_heap.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>board.c</FileName>
+              <FileName>finsh_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\board.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>emac.c</FileName>
+              <FileName>finsh_node.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\emac.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>led.c</FileName>
+              <FileName>finsh_ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\led.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi.c</FileName>
+              <FileName>finsh_parser.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\spi.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>uart.c</FileName>
+              <FileName>finsh_var.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\uart.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>finsh_vm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>finsh_token.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m3\cpuport.c</FilePath>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m3\context_rvds.S</FilePath>
+              <FileName>device.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\shell.c</FilePath>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_compiler.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_error.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_heap.c</FileName>
+              <FileName>mem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
+              <FilePath>..\..\src\mem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_init.c</FileName>
+              <FileName>memheap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
+              <FilePath>..\..\src\memheap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_node.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_ops.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_parser.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_var.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_vm.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_token.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
         </Group>

+ 113 - 120
bsp/lpc178x/project.uvproj

@@ -341,9 +341,9 @@
             <uThumb>0</uThumb>
             <VariousControls>
               <MiscControls />
-              <Define />
+              <Define>__RTTHREAD__</Define>
               <Undefine />
-              <IncludePath>.;..\..\include;applications;.;CMSIS\CM3\CoreSupport;CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x;drivers;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\finsh;..\..\components\libc\compilers\common</IncludePath>
+              <IncludePath>applications;.;CMSIS\CM3\CoreSupport;CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;drivers;..\..\components\finsh;.;..\..\include</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -381,349 +381,342 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>clock.c</FileName>
+              <FileName>application.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\clock.c</FilePath>
+              <FilePath>applications\application.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>startup.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\components.c</FilePath>
+              <FilePath>applications\startup.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CMSIS</GroupName>
           <Files>
             <File>
-              <FileName>cpu.c</FileName>
+              <FileName>core_cm3.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\cpu.c</FilePath>
+              <FilePath>CMSIS\CM3\CoreSupport\core_cm3.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>system_LPC177x_8x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\device.c</FilePath>
+              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x\system_LPC177x_8x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\idle.c</FilePath>
+              <FileName>startup_LPC177x_8x.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x\startup\arm\startup_LPC177x_8x.s</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\ipc.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\irq.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mem.c</FilePath>
+              <FilePath>..\..\libcpu\arm\cortex-m3\cpuport.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>memheap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\memheap.c</FilePath>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m3\context_rvds.S</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
+              <FileName>board.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mempool.c</FilePath>
+              <FilePath>drivers\board.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
+              <FileName>drv_glcd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\object.c</FilePath>
+              <FilePath>drivers\drv_glcd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>lpc177x_8x_clkpwr.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\scheduler.c</FilePath>
+              <FilePath>drivers\lpc177x_8x_clkpwr.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>lpc177x_8x_emc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\signal.c</FilePath>
+              <FilePath>drivers\lpc177x_8x_emc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>lpc177x_8x_pinsel.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\thread.c</FilePath>
+              <FilePath>drivers\lpc177x_8x_pinsel.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>lpc177x_8x_uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\timer.c</FilePath>
+              <FilePath>drivers\lpc177x_8x_uart.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>application.c</FileName>
+              <FileName>lpc17xx_lcd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\application.c</FilePath>
+              <FilePath>drivers\lpc17xx_lcd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup.c</FileName>
+              <FileName>sdram.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\startup.c</FilePath>
+              <FilePath>drivers\sdram.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>CMSIS</GroupName>
           <Files>
             <File>
-              <FileName>core_cm3.c</FileName>
+              <FileName>uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>CMSIS\CM3\CoreSupport\core_cm3.c</FilePath>
+              <FilePath>drivers\uart.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>system_LPC177x_8x.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x\system_LPC177x_8x.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>startup_LPC177x_8x.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x\startup\arm\startup_LPC177x_8x.s</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>board.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\board.c</FilePath>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_glcd.c</FileName>
+              <FileName>finsh_compiler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\drv_glcd.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc177x_8x_clkpwr.c</FileName>
+              <FileName>finsh_error.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\lpc177x_8x_clkpwr.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc177x_8x_emc.c</FileName>
+              <FileName>finsh_heap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\lpc177x_8x_emc.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc177x_8x_pinsel.c</FileName>
+              <FileName>finsh_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\lpc177x_8x_pinsel.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc177x_8x_uart.c</FileName>
+              <FileName>finsh_node.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\lpc177x_8x_uart.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc17xx_lcd.c</FileName>
+              <FileName>finsh_ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\lpc17xx_lcd.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sdram.c</FileName>
+              <FileName>finsh_parser.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\sdram.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>uart.c</FileName>
+              <FileName>finsh_var.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\uart.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>finsh_vm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>finsh_token.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m3\cpuport.c</FilePath>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m3\context_rvds.S</FilePath>
+              <FileName>device.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\shell.c</FilePath>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_compiler.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_error.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_heap.c</FileName>
+              <FileName>mem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
+              <FilePath>..\..\src\mem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_init.c</FileName>
+              <FileName>memheap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
+              <FilePath>..\..\src\memheap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_node.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_ops.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_parser.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_var.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_vm.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_token.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
         </Group>

+ 96 - 103
bsp/lpc2478/project.uvproj

@@ -352,9 +352,9 @@
             <uSurpInc>0</uSurpInc>
             <VariousControls>
               <MiscControls />
-              <Define />
+              <Define>__RTTHREAD__</Define>
               <Undefine />
-              <IncludePath>.;..\..\include;applications;.;drivers;..\..\libcpu\arm\common;..\..\libcpu\arm\lpc24xx;..\..\components\finsh;..\..\components\libc\compilers\common</IncludePath>
+              <IncludePath>applications;.;..\..\libcpu\arm\common;..\..\libcpu\arm\lpc24xx;drivers;..\..\components\finsh;.;..\..\include</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -393,297 +393,290 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>clock.c</FileName>
+              <FileName>application.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\clock.c</FilePath>
+              <FilePath>applications\application.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>startup.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\components.c</FilePath>
+              <FilePath>applications\startup.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>cpu.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\cpu.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\device.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\idle.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>cpu.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\ipc.c</FilePath>
+              <FilePath>..\..\libcpu\arm\lpc24xx\cpu.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
+              <FileName>interrupt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\irq.c</FilePath>
+              <FilePath>..\..\libcpu\arm\lpc24xx\interrupt.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>stack.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\libcpu\arm\lpc24xx\stack.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem.c</FileName>
+              <FileName>trap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mem.c</FilePath>
+              <FilePath>..\..\libcpu\arm\lpc24xx\trap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\mempool.c</FilePath>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\lpc24xx\context_rvds.S</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\object.c</FilePath>
+              <FileName>start_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\lpc24xx\start_rvds.S</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>board.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\scheduler.c</FilePath>
+              <FilePath>drivers\board.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>serial.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\signal.c</FilePath>
+              <FilePath>drivers\serial.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\thread.c</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\timer.c</FilePath>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>application.c</FileName>
+              <FileName>finsh_compiler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\application.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup.c</FileName>
+              <FileName>finsh_error.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\startup.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>board.c</FileName>
+              <FileName>finsh_heap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\board.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>serial.c</FileName>
+              <FileName>finsh_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers\serial.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>finsh_node.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>finsh_ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>finsh_parser.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc24xx_cpu.c</FileName>
+              <FileName>finsh_var.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\lpc24xx\cpu.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>interrupt.c</FileName>
+              <FileName>finsh_vm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\lpc24xx\interrupt.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>stack.c</FileName>
+              <FileName>finsh_token.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\lpc24xx\stack.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>trap.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\lpc24xx\trap.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\lpc24xx\context_rvds.S</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>start_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\lpc24xx\start_rvds.S</FilePath>
+              <FileName>components.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>device.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\shell.c</FilePath>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_compiler.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_error.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_heap.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_init.c</FileName>
+              <FileName>mem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
+              <FilePath>..\..\src\mem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_node.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_ops.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_parser.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_var.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_vm.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_token.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
         </Group>

+ 168 - 165
bsp/lpc408x/project.uvproj

@@ -357,9 +357,9 @@
             <useXO>0</useXO>
             <VariousControls>
               <MiscControls />
-              <Define>CORE_M4</Define>
+              <Define>CORE_M4, __RTTHREAD__</Define>
               <Undefine />
-              <IncludePath>.;..\..\include;applications;.;drivers;Libraries\Device\NXP\LPC407x_8x_177x_8x\Include;Libraries\CMSIS\Include;Libraries\Drivers\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\common</IncludePath>
+              <IncludePath>applications;.;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\common;Libraries\Device\NXP\LPC407x_8x_177x_8x\Include;Libraries\CMSIS\Include;Libraries\Drivers\include</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -400,120 +400,116 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>main.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\components.c</FilePath>
+              <FilePath>applications\main.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>cpu.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\cpu.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\device.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\idle.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\ipc.c</FilePath>
+              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\irq.c</FilePath>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>pin.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>memheap.c</FileName>
+              <FileName>serial.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\memheap.c</FilePath>
+              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
+              <FileName>completion.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mempool.c</FilePath>
+              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
+              <FileName>dataqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\object.c</FilePath>
+              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>pipe.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\scheduler.c</FilePath>
+              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>ringblk_buf.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\signal.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>ringbuffer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\thread.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>waitqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\timer.c</FilePath>
+              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>main.c</FileName>
+              <FileName>workqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\main.c</FilePath>
+              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
             </File>
           </Files>
         </Group>
@@ -535,388 +531,395 @@
           </Files>
         </Group>
         <Group>
-          <GroupName>Libraries</GroupName>
+          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>system_LPC407x_8x_177x_8x.c</FileName>
+              <FileName>dfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\system_LPC407x_8x_177x_8x.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup_LPC407x_8x_177x_8x.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\ARM\startup_LPC407x_8x_177x_8x.s</FilePath>
+              <FileName>dfs_file.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_adc.c</FileName>
+              <FileName>dfs_fs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_adc.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_bod.c</FileName>
+              <FileName>dfs_posix.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_bod.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_can.c</FileName>
+              <FileName>devfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_can.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_clkpwr.c</FileName>
+              <FileName>dfs_elm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_clkpwr.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_crc.c</FileName>
+              <FileName>ff.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_crc.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>lpc_dac.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_dac.c</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_eeprom.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_eeprom.c</FilePath>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_emc.c</FileName>
+              <FileName>msh.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_emc.c</FilePath>
+              <FilePath>..\..\components\finsh\msh.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_exti.c</FileName>
+              <FileName>msh_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_exti.c</FilePath>
+              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>lpc_gpdma.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_gpdma.c</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_gpio.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_gpio.c</FilePath>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_i2c.c</FileName>
+              <FileName>device.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_i2c.c</FilePath>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_i2s.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_i2s.c</FilePath>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_iap.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_iap.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_lcd.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_lcd.c</FilePath>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_mcpwm.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_mcpwm.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_nvic.c</FileName>
+              <FileName>memheap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_nvic.c</FilePath>
+              <FilePath>..\..\src\memheap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_pinsel.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_pinsel.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_pwm.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_pwm.c</FilePath>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_qei.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_qei.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_rtc.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_rtc.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_ssp.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_ssp.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_systick.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_systick.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>libc</GroupName>
           <Files>
             <File>
-              <FileName>lpc_timer.c</FileName>
+              <FileName>time.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_timer.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\common\time.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Libraries</GroupName>
           <Files>
             <File>
-              <FileName>lpc_uart.c</FileName>
+              <FileName>system_LPC407x_8x_177x_8x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_uart.c</FilePath>
+              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\system_LPC407x_8x_177x_8x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_wwdt.c</FileName>
+              <FileName>startup_LPC407x_8x_177x_8x.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\ARM\startup_LPC407x_8x_177x_8x.s</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>lpc_adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_wwdt.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_adc.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>lpc_bod.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_bod.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>lpc_can.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_can.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>lpc_clkpwr.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_clkpwr.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>lpc_crc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_crc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
+              <FileName>lpc_dac.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>Libraries\Drivers\source\lpc_dac.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>dfs.c</FileName>
+              <FileName>lpc_eeprom.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_eeprom.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_file.c</FileName>
+              <FileName>lpc_emc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_emc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_fs.c</FileName>
+              <FileName>lpc_exti.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_exti.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_posix.c</FileName>
+              <FileName>lpc_gpdma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_gpdma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>devfs.c</FileName>
+              <FileName>lpc_gpio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_gpio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_elm.c</FileName>
+              <FileName>lpc_i2c.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_i2c.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ff.c</FileName>
+              <FileName>lpc_i2s.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_i2s.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>pin.c</FileName>
+              <FileName>lpc_iap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_iap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>serial.c</FileName>
+              <FileName>lpc_lcd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_lcd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>completion.c</FileName>
+              <FileName>lpc_mcpwm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_mcpwm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dataqueue.c</FileName>
+              <FileName>lpc_nvic.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_nvic.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pipe.c</FileName>
+              <FileName>lpc_pinsel.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_pinsel.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringblk_buf.c</FileName>
+              <FileName>lpc_pwm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_pwm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringbuffer.c</FileName>
+              <FileName>lpc_qei.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_qei.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>waitqueue.c</FileName>
+              <FileName>lpc_rtc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_rtc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>workqueue.c</FileName>
+              <FileName>lpc_ssp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_ssp.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>lpc_systick.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\shell.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_systick.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>lpc_timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_timer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh.c</FileName>
+              <FileName>lpc_uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\msh.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_uart.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh_file.c</FileName>
+              <FileName>lpc_wwdt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_wwdt.c</FilePath>
             </File>
           </Files>
         </Group>

+ 168 - 165
bsp/lpc408x/project.uvprojx

@@ -331,9 +331,9 @@
             <v6Rtti>0</v6Rtti>
             <VariousControls>
               <MiscControls>--library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186</MiscControls>
-              <Define>CORE_M4</Define>
+              <Define>CORE_M4, __RTTHREAD__</Define>
               <Undefine />
-              <IncludePath>.;..\..\include;applications;.;drivers;Libraries\Device\NXP\LPC407x_8x_177x_8x\Include;Libraries\CMSIS\Include;Libraries\Drivers\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\common</IncludePath>
+              <IncludePath>applications;.;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\common;Libraries\Device\NXP\LPC407x_8x_177x_8x\Include;Libraries\CMSIS\Include;Libraries\Drivers\include</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -375,120 +375,116 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>main.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\components.c</FilePath>
+              <FilePath>applications\main.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>cpu.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\cpu.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\device.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\idle.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\ipc.c</FilePath>
+              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\irq.c</FilePath>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>pin.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>memheap.c</FileName>
+              <FileName>serial.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\memheap.c</FilePath>
+              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
+              <FileName>completion.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mempool.c</FilePath>
+              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
+              <FileName>dataqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\object.c</FilePath>
+              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>pipe.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\scheduler.c</FilePath>
+              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>ringblk_buf.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\signal.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>ringbuffer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\thread.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>waitqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\timer.c</FilePath>
+              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>main.c</FileName>
+              <FileName>workqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\main.c</FilePath>
+              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
             </File>
           </Files>
         </Group>
@@ -510,388 +506,395 @@
           </Files>
         </Group>
         <Group>
-          <GroupName>Libraries</GroupName>
+          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>system_LPC407x_8x_177x_8x.c</FileName>
+              <FileName>dfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\system_LPC407x_8x_177x_8x.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup_LPC407x_8x_177x_8x.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\ARM\startup_LPC407x_8x_177x_8x.s</FilePath>
+              <FileName>dfs_file.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_adc.c</FileName>
+              <FileName>dfs_fs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_adc.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_bod.c</FileName>
+              <FileName>dfs_posix.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_bod.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_can.c</FileName>
+              <FileName>devfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_can.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_clkpwr.c</FileName>
+              <FileName>dfs_elm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_clkpwr.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_crc.c</FileName>
+              <FileName>ff.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_crc.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>lpc_dac.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_dac.c</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_eeprom.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_eeprom.c</FilePath>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_emc.c</FileName>
+              <FileName>msh.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_emc.c</FilePath>
+              <FilePath>..\..\components\finsh\msh.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_exti.c</FileName>
+              <FileName>msh_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_exti.c</FilePath>
+              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>lpc_gpdma.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_gpdma.c</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_gpio.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_gpio.c</FilePath>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_i2c.c</FileName>
+              <FileName>device.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_i2c.c</FilePath>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_i2s.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_i2s.c</FilePath>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_iap.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_iap.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_lcd.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_lcd.c</FilePath>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_mcpwm.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_mcpwm.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_nvic.c</FileName>
+              <FileName>memheap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_nvic.c</FilePath>
+              <FilePath>..\..\src\memheap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_pinsel.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_pinsel.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_pwm.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_pwm.c</FilePath>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_qei.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_qei.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_rtc.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_rtc.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_ssp.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_ssp.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_systick.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_systick.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>libc</GroupName>
           <Files>
             <File>
-              <FileName>lpc_timer.c</FileName>
+              <FileName>time.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_timer.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\common\time.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Libraries</GroupName>
           <Files>
             <File>
-              <FileName>lpc_uart.c</FileName>
+              <FileName>system_LPC407x_8x_177x_8x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_uart.c</FilePath>
+              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\system_LPC407x_8x_177x_8x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lpc_wwdt.c</FileName>
+              <FileName>startup_LPC407x_8x_177x_8x.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>Libraries\Device\NXP\LPC407x_8x_177x_8x\Source\Templates\ARM\startup_LPC407x_8x_177x_8x.s</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>lpc_adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Drivers\source\lpc_wwdt.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_adc.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>lpc_bod.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_bod.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>lpc_can.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_can.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>lpc_clkpwr.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_clkpwr.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>lpc_crc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_crc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
+              <FileName>lpc_dac.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>Libraries\Drivers\source\lpc_dac.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>dfs.c</FileName>
+              <FileName>lpc_eeprom.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_eeprom.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_file.c</FileName>
+              <FileName>lpc_emc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_emc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_fs.c</FileName>
+              <FileName>lpc_exti.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_exti.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_posix.c</FileName>
+              <FileName>lpc_gpdma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_gpdma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>devfs.c</FileName>
+              <FileName>lpc_gpio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_gpio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_elm.c</FileName>
+              <FileName>lpc_i2c.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_i2c.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ff.c</FileName>
+              <FileName>lpc_i2s.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_i2s.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>pin.c</FileName>
+              <FileName>lpc_iap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_iap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>serial.c</FileName>
+              <FileName>lpc_lcd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_lcd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>completion.c</FileName>
+              <FileName>lpc_mcpwm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_mcpwm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dataqueue.c</FileName>
+              <FileName>lpc_nvic.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_nvic.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pipe.c</FileName>
+              <FileName>lpc_pinsel.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_pinsel.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringblk_buf.c</FileName>
+              <FileName>lpc_pwm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_pwm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringbuffer.c</FileName>
+              <FileName>lpc_qei.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_qei.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>waitqueue.c</FileName>
+              <FileName>lpc_rtc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_rtc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>workqueue.c</FileName>
+              <FileName>lpc_ssp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_ssp.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>lpc_systick.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\shell.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_systick.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>lpc_timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_timer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh.c</FileName>
+              <FileName>lpc_uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\msh.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_uart.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh_file.c</FileName>
+              <FileName>lpc_wwdt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
+              <FilePath>Libraries\Drivers\source\lpc_wwdt.c</FilePath>
             </File>
           </Files>
         </Group>

+ 209 - 216
bsp/lpc5410x/project.uvprojx

@@ -345,9 +345,9 @@
             <uSurpInc>0</uSurpInc>
             <VariousControls>
               <MiscControls />
-              <Define>CORE_M4</Define>
+              <Define>CORE_M4, __RTTHREAD__</Define>
               <Undefine />
-              <IncludePath>.;..\..\include;applications;.;drivers;Libraries\CMSIS\Include;Libraries\lpc_chip\chip_common;Libraries\lpc_chip\chip_5410x;Libraries\lpc_chip\chip_5410x\config;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\common</IncludePath>
+              <IncludePath>applications;.;Libraries\CMSIS\Include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\finsh;.;..\..\include;Libraries\lpc_chip\chip_common;Libraries\lpc_chip\chip_5410x;Libraries\lpc_chip\chip_5410x\config</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -386,148 +386,147 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>application.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\components.c</FilePath>
+              <FilePath>applications\application.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpu.c</FileName>
+              <FileName>board.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\cpu.c</FilePath>
+              <FilePath>applications\board.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>demo_thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\device.c</FilePath>
+              <FilePath>applications\demo_thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
+              <FileName>startup.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\idle.c</FilePath>
+              <FilePath>applications\startup.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CMSIS</GroupName>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>sysinit.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\ipc.c</FilePath>
+              <FilePath>Libraries\Device\startup\sysinit.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\irq.c</FilePath>
+              <FileName>keil_startup_lpc5410x.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>Libraries\Device\startup\keil_startup_lpc5410x.s</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mem.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>memheap.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\memheap.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mempool.c</FilePath>
+              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\object.c</FilePath>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>serial.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\scheduler.c</FilePath>
+              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>completion.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\signal.c</FilePath>
+              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>dataqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\thread.c</FilePath>
+              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>pipe.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\timer.c</FilePath>
+              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>application.c</FileName>
+              <FileName>ringblk_buf.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\application.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>board.c</FileName>
+              <FileName>ringbuffer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\board.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>demo_thread.c</FileName>
+              <FileName>waitqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\demo_thread.c</FilePath>
+              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup.c</FileName>
+              <FileName>workqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\startup.c</FilePath>
+              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
             </File>
           </Files>
         </Group>
@@ -549,528 +548,522 @@
           </Files>
         </Group>
         <Group>
-          <GroupName>CMSIS</GroupName>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>sysinit.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\Device\startup\sysinit.c</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>keil_startup_lpc5410x.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>Libraries\Device\startup\keil_startup_lpc5410x.s</FilePath>
+              <FileName>cmd.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Libraries</GroupName>
           <Files>
             <File>
-              <FileName>fpu_init.c</FileName>
+              <FileName>finsh_compiler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_common\fpu_init.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>iap.c</FileName>
+              <FileName>finsh_error.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_common\iap.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ring_buffer.c</FileName>
+              <FileName>finsh_heap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_common\ring_buffer.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>rtc_ut.c</FileName>
+              <FileName>finsh_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_common\rtc_ut.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>chip_5410x.c</FileName>
+              <FileName>finsh_node.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\chip_5410x.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>clock_5410x.c</FileName>
+              <FileName>finsh_ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\clock_5410x.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>crc_5410x.c</FileName>
+              <FileName>finsh_parser.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\crc_5410x.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fifo_5410x.c</FileName>
+              <FileName>finsh_var.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\fifo_5410x.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>gpiogroup_5410x.c</FileName>
+              <FileName>finsh_vm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\gpiogroup_5410x.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>gpio_5410x.c</FileName>
+              <FileName>finsh_token.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\gpio_5410x.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>hw_adc.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_adc.c</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_dmaaltd.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_dmaaltd.c</FilePath>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_dmaaltd_rom_api.c</FileName>
+              <FileName>device.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_dmaaltd_rom_api.c</FilePath>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_i2cmd.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmd.c</FilePath>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_i2cmd_rom_api.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmd_rom_api.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_i2cmond.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmond.c</FilePath>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_i2cmond_rom_api.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmond_rom_api.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_i2csd.c</FileName>
+              <FileName>mem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2csd.c</FilePath>
+              <FilePath>..\..\src\mem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_i2csd_rom_api.c</FileName>
+              <FileName>memheap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2csd_rom_api.c</FilePath>
+              <FilePath>..\..\src\memheap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_spimd.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spimd.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_spimd_rom_api.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spimd_rom_api.c</FilePath>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_spisd.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spisd.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_spisd_rom_api.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spisd_rom_api.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>hw_uart.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\hw_uart.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>iocon_5410x.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\iocon_5410x.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Libraries</GroupName>
           <Files>
             <File>
-              <FileName>pinint_5410x.c</FileName>
+              <FileName>fpu_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\pinint_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_common\fpu_init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pll_5410x.c</FileName>
+              <FileName>iap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\pll_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_common\iap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ritimer_5410x.c</FileName>
+              <FileName>ring_buffer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\ritimer_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_common\ring_buffer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_adc.c</FileName>
+              <FileName>rtc_ut.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_adc.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_common\rtc_ut.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_dma.c</FileName>
+              <FileName>chip_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_dma.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\chip_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_i2cm.c</FileName>
+              <FileName>clock_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_i2cm.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\clock_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_i2cmon.c</FileName>
+              <FileName>crc_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_i2cmon.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\crc_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_i2cs.c</FileName>
+              <FileName>fifo_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_i2cs.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\fifo_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_spim.c</FileName>
+              <FileName>gpiogroup_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_spim.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\gpiogroup_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_spis.c</FileName>
+              <FileName>gpio_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_spis.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\gpio_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romapi_uart.c</FileName>
+              <FileName>hw_adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_uart.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_adc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>rtc_5410x.c</FileName>
+              <FileName>hw_dmaaltd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\rtc_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_dmaaltd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sct_5410x.c</FileName>
+              <FileName>hw_dmaaltd_rom_api.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\sct_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_dmaaltd_rom_api.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sct_pwm_5410x.c</FileName>
+              <FileName>hw_i2cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\sct_pwm_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>stopwatch_5410x.c</FileName>
+              <FileName>hw_i2cmd_rom_api.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\stopwatch_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmd_rom_api.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>syscon_5410x.c</FileName>
+              <FileName>hw_i2cmond.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\syscon_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmond.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sysinit_5410x.c</FileName>
+              <FileName>hw_i2cmond_rom_api.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\sysinit_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2cmond_rom_api.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer_5410x.c</FileName>
+              <FileName>hw_i2csd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\timer_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2csd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>utick_5410x.c</FileName>
+              <FileName>hw_i2csd_rom_api.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\utick_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_i2csd_rom_api.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>wwdt_5410x.c</FileName>
+              <FileName>hw_spimd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\wwdt_5410x.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spimd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lib_power.lib</FileName>
-              <FileType>4</FileType>
-              <FilePath>Libraries\lpc_chip\chip_5410x\power_lib\keil\lib_power.lib</FilePath>
+              <FileName>hw_spimd_rom_api.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spimd_rom_api.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>hw_spisd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spisd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>hw_spisd_rom_api.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_spisd_rom_api.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>hw_uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\hw_uart.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>iocon_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\iocon_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
+              <FileName>pinint_5410x.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>Libraries\lpc_chip\chip_5410x\pinint_5410x.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>serial.c</FileName>
+              <FileName>pll_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\pll_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>completion.c</FileName>
+              <FileName>ritimer_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\ritimer_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dataqueue.c</FileName>
+              <FileName>romapi_adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_adc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pipe.c</FileName>
+              <FileName>romapi_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringblk_buf.c</FileName>
+              <FileName>romapi_i2cm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_i2cm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringbuffer.c</FileName>
+              <FileName>romapi_i2cmon.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_i2cmon.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>waitqueue.c</FileName>
+              <FileName>romapi_i2cs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_i2cs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>workqueue.c</FileName>
+              <FileName>romapi_spim.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_spim.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>romapi_spis.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\shell.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_spis.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>romapi_uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\romapi_uart.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_compiler.c</FileName>
+              <FileName>rtc_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\rtc_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_error.c</FileName>
+              <FileName>sct_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\sct_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_heap.c</FileName>
+              <FileName>sct_pwm_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\sct_pwm_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_init.c</FileName>
+              <FileName>stopwatch_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\stopwatch_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_node.c</FileName>
+              <FileName>syscon_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\syscon_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_ops.c</FileName>
+              <FileName>sysinit_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\sysinit_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_parser.c</FileName>
+              <FileName>timer_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\timer_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_var.c</FileName>
+              <FileName>utick_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\utick_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_vm.c</FileName>
+              <FileName>wwdt_5410x.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
+              <FilePath>Libraries\lpc_chip\chip_5410x\wwdt_5410x.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_token.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
+              <FileName>lib_power.lib</FileName>
+              <FileType>4</FileType>
+              <FilePath>Libraries\lpc_chip\chip_5410x\power_lib\keil\lib_power.lib</FilePath>
             </File>
           </Files>
         </Group>

+ 275 - 275
bsp/lpc54114-lite/project.uvprojx

@@ -333,9 +333,9 @@
             <v6Rtti>0</v6Rtti>
             <VariousControls>
               <MiscControls>--library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186</MiscControls>
-              <Define>SDK_DEBUGCONSOLE=0, CPU_LPC54114, CORE_M4, RT_USING_ARM_LIBC, CPU_LPC54114J256BD64_cm4=1</Define>
+              <Define>CPU_LPC54114, CORE_M4, SDK_DEBUGCONSOLE=0, __RTTHREAD__, CPU_LPC54114J256BD64_cm4=1, RT_USING_ARM_LIBC</Define>
               <Undefine />
-              <IncludePath>.;..\..\include;applications;.;drivers;Libraries\CMSIS\Include;Libraries\devices\LPC54114\drivers;Libraries\devices\LPC54114\utilities;Libraries\devices\LPC54114;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\dfs\filesystems\romfs;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\spi;..\..\components\drivers\include;..\..\components\drivers\spi\sfud\inc;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common</IncludePath>
+              <IncludePath>applications;.;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\spi;..\..\components\drivers\include;..\..\components\drivers\spi\sfud\inc;..\..\components\drivers\include;drivers;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\dfs\filesystems\romfs;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common;Libraries\CMSIS\Include;Libraries\devices\LPC54114\drivers;Libraries\devices\LPC54114\utilities;Libraries\devices\LPC54114</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -377,129 +377,193 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>clock.c</FileName>
+              <FileName>main.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\clock.c</FilePath>
+              <FilePath>applications\main.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>mnt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\components.c</FilePath>
+              <FilePath>applications\mnt.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>cpu.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\cpu.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\device.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\idle.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\ipc.c</FilePath>
+              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>DeviceDrivers</GroupName>
+          <Files>
+            <File>
+              <FileName>i2c_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\irq.c</FilePath>
+              <FilePath>..\..\components\drivers\i2c\i2c_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>i2c_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\components\drivers\i2c\i2c_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem.c</FileName>
+              <FileName>i2c-bit-ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mem.c</FilePath>
+              <FilePath>..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
+              <FileName>pin.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\mempool.c</FilePath>
+              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
+              <FileName>serial.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\object.c</FilePath>
+              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>spi_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\scheduler.c</FilePath>
+              <FilePath>..\..\components\drivers\spi\spi_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>spi_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\signal.c</FilePath>
+              <FilePath>..\..\components\drivers\spi\spi_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>spi_msd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\thread.c</FilePath>
+              <FilePath>..\..\components\drivers\spi\spi_msd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>spi_flash_sfud.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\src\timer.c</FilePath>
+              <FilePath>..\..\components\drivers\spi\spi_flash_sfud.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>main.c</FileName>
+              <FileName>sfud.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\main.c</FilePath>
+              <FilePath>..\..\components\drivers\spi\sfud\src\sfud.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mnt.c</FileName>
+              <FileName>completion.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications\mnt.c</FilePath>
+              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>dataqueue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>pipe.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ringblk_buf.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>ringbuffer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>waitqueue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>workqueue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
             </File>
           </Files>
+          <GroupOption>
+            <GroupArmAds>
+              <Cads>
+                <VariousControls>
+                  <MiscControls> --c99</MiscControls>
+                  <Define> </Define>
+                  <Undefine> </Undefine>
+                  <IncludePath> </IncludePath>
+                </VariousControls>
+              </Cads>
+            </GroupArmAds>
+          </GroupOption>
         </Group>
         <Group>
           <GroupName>Drivers</GroupName>
@@ -561,634 +625,570 @@
           </Files>
         </Group>
         <Group>
-          <GroupName>Libraries</GroupName>
+          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>fsl_adc.c</FileName>
+              <FileName>dfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_adc.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_clock.c</FileName>
+              <FileName>dfs_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_clock.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_common.c</FileName>
+              <FileName>dfs_fs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_common.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_crc.c</FileName>
+              <FileName>dfs_posix.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_crc.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_ctimer.c</FileName>
+              <FileName>poll.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_ctimer.c</FilePath>
+              <FilePath>..\..\components\dfs\src\poll.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_dma.c</FileName>
+              <FileName>select.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_dma.c</FilePath>
+              <FilePath>..\..\components\dfs\src\select.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_dmic.c</FileName>
+              <FileName>devfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_dmic.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_dmic_dma.c</FileName>
+              <FileName>dfs_elm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_dmic_dma.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_flashiap.c</FileName>
+              <FileName>ff.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_flashiap.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_flexcomm.c</FileName>
+              <FileName>ccsbcs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_flexcomm.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\option\ccsbcs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_fmeas.c</FileName>
+              <FileName>dfs_romfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_fmeas.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\romfs\dfs_romfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_gint.c</FileName>
+              <FileName>romfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_gint.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\romfs\romfs.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>fsl_gpio.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_gpio.c</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2c.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2c.c</FilePath>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2c_dma.c</FileName>
+              <FileName>msh.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2c_dma.c</FilePath>
+              <FilePath>..\..\components\finsh\msh.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2s.c</FileName>
+              <FileName>msh_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2s.c</FilePath>
+              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2s_dma.c</FileName>
+              <FileName>finsh_compiler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2s_dma.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_inputmux.c</FileName>
+              <FileName>finsh_error.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_inputmux.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_mrt.c</FileName>
+              <FileName>finsh_heap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_mrt.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_pint.c</FileName>
+              <FileName>finsh_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_pint.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_power.c</FileName>
+              <FileName>finsh_node.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_power.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_reset.c</FileName>
+              <FileName>finsh_ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_reset.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_rtc.c</FileName>
+              <FileName>finsh_parser.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_rtc.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_sctimer.c</FileName>
+              <FileName>finsh_var.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_sctimer.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_spi.c</FileName>
+              <FileName>finsh_vm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_spi.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_spi_dma.c</FileName>
+              <FileName>finsh_token.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_spi_dma.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>fsl_usart.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_usart.c</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_usart_dma.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_usart_dma.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>fsl_utick.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_utick.c</FilePath>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_wwdt.c</FileName>
+              <FileName>device.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\drivers\fsl_wwdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>startup_LPC54114_cm4.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>Libraries\devices\LPC54114\arm\startup_LPC54114_cm4.s</FilePath>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>system_LPC54114_cm4.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>Libraries\devices\LPC54114\system_LPC54114_cm4.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>keil_lib_power.lib</FileName>
-              <FileType>4</FileType>
-              <FilePath>Libraries\devices\LPC54114\arm\keil_lib_power.lib</FilePath>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>mem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
+              <FilePath>..\..\src\mem.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>dfs.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_file.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_fs.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_posix.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>poll.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\poll.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>select.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\src\select.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>libc</GroupName>
           <Files>
             <File>
-              <FileName>devfs.c</FileName>
+              <FileName>libc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\libc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_elm.c</FileName>
+              <FileName>mem_std.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\mem_std.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ff.c</FileName>
+              <FileName>stdio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\stdio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ccsbcs.c</FileName>
+              <FileName>stubs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\elmfat\option\ccsbcs.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\stubs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_romfs.c</FileName>
+              <FileName>time.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\romfs\dfs_romfs.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\common\time.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>romfs.c</FileName>
+              <FileName>unistd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\dfs\filesystems\romfs\romfs.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\common\unistd.c</FilePath>
             </File>
           </Files>
         </Group>
         <Group>
-          <GroupName>DeviceDrivers</GroupName>
-          <Files>
-            <File>
-              <FileName>i2c_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\i2c\i2c_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\i2c\i2c_dev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c-bit-ops.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
-            </File>
-          </Files>
+          <GroupName>Libraries</GroupName>
           <Files>
             <File>
-              <FileName>pin.c</FileName>
+              <FileName>fsl_adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_adc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>serial.c</FileName>
+              <FileName>fsl_clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_core.c</FileName>
+              <FileName>fsl_common.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\spi\spi_core.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_common.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_dev.c</FileName>
+              <FileName>fsl_crc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\spi\spi_dev.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_crc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_msd.c</FileName>
+              <FileName>fsl_ctimer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\spi\spi_msd.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_ctimer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_flash_sfud.c</FileName>
+              <FileName>fsl_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\spi\spi_flash_sfud.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sfud.c</FileName>
+              <FileName>fsl_dmic.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\spi\sfud\src\sfud.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_dmic.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>completion.c</FileName>
+              <FileName>fsl_dmic_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_dmic_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dataqueue.c</FileName>
+              <FileName>fsl_flashiap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_flashiap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pipe.c</FileName>
+              <FileName>fsl_flexcomm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_flexcomm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringblk_buf.c</FileName>
+              <FileName>fsl_fmeas.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_fmeas.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringbuffer.c</FileName>
+              <FileName>fsl_gint.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_gint.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>waitqueue.c</FileName>
+              <FileName>fsl_gpio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_gpio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>workqueue.c</FileName>
+              <FileName>fsl_i2c.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2c.c</FilePath>
             </File>
           </Files>
-          <GroupOption>
-            <GroupArmAds>
-              <Cads>
-                <VariousControls>
-                  <MiscControls> --c99</MiscControls>
-                  <Define> </Define>
-                  <Undefine> </Undefine>
-                  <IncludePath> </IncludePath>
-                </VariousControls>
-              </Cads>
-            </GroupArmAds>
-          </GroupOption>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>fsl_i2c_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\shell.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2c_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>fsl_i2s.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2s.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh.c</FileName>
+              <FileName>fsl_i2s_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\msh.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_i2s_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh_file.c</FileName>
+              <FileName>fsl_inputmux.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_inputmux.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_compiler.c</FileName>
+              <FileName>fsl_mrt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_mrt.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_error.c</FileName>
+              <FileName>fsl_pint.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_pint.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_heap.c</FileName>
+              <FileName>fsl_power.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_power.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_init.c</FileName>
+              <FileName>fsl_reset.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_reset.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_node.c</FileName>
+              <FileName>fsl_rtc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_rtc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_ops.c</FileName>
+              <FileName>fsl_sctimer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_sctimer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_parser.c</FileName>
+              <FileName>fsl_spi.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_spi.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_var.c</FileName>
+              <FileName>fsl_spi_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_spi_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_vm.c</FileName>
+              <FileName>fsl_usart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_usart.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_token.c</FileName>
+              <FileName>fsl_usart_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_usart_dma.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>libc</GroupName>
           <Files>
             <File>
-              <FileName>libc.c</FileName>
+              <FileName>fsl_utick.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\libc\compilers\armlibc\libc.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_utick.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem_std.c</FileName>
+              <FileName>fsl_wwdt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\libc\compilers\armlibc\mem_std.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\drivers\fsl_wwdt.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>stdio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\components\libc\compilers\armlibc\stdio.c</FilePath>
+              <FileName>startup_LPC54114_cm4.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>Libraries\devices\LPC54114\arm\startup_LPC54114_cm4.s</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>stubs.c</FileName>
+              <FileName>system_LPC54114_cm4.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\components\libc\compilers\armlibc\stubs.c</FilePath>
+              <FilePath>Libraries\devices\LPC54114\system_LPC54114_cm4.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>time.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\components\libc\compilers\common\time.c</FilePath>
+              <FileName>keil_lib_power.lib</FileName>
+              <FileType>4</FileType>
+              <FilePath>Libraries\devices\LPC54114\arm\keil_lib_power.lib</FilePath>
             </File>
           </Files>
         </Group>

+ 451 - 450
bsp/lpc54608-LPCXpresso/project.uvprojx

@@ -330,9 +330,9 @@
             <v6Rtti>0</v6Rtti>
             <VariousControls>
               <MiscControls>--library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186</MiscControls>
-              <Define>SDK_DEBUGCONSOLE=0, CPU_LPC54608, CORE_M4, CPU_LPC54608J512ET180=1, RT_USING_ARM_LIBC</Define>
+              <Define>CPU_LPC54608, CORE_M4, SDK_DEBUGCONSOLE=0, __RTTHREAD__, CPU_LPC54608J512ET180=1, RT_USING_ARM_LIBC</Define>
               <Undefine />
-              <IncludePath>.;../../include;applications;.;drivers;SDK_2.2_LPCXpresso54608/sdmmc_2.1.2/inc;SDK_2.2_LPCXpresso54608/sdmmc_2.1.2/src;SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers;SDK_2.2_LPCXpresso54608/devices/LPC54608/utilities;SDK_2.2_LPCXpresso54608/CMSIS/Include;SDK_2.2_LPCXpresso54608/devices/LPC54608;../../libcpu/arm/common;../../libcpu/arm/cortex-m4;../../components/finsh;../../components/dfs/include;../../components/dfs/filesystems/elmfat;../../components/dfs/filesystems/devfs;../../components/net/lwip-2.0.2/src;../../components/net/lwip-2.0.2/src/include;../../components/net/lwip-2.0.2/src/include/ipv4;../../components/net/lwip-2.0.2/src/arch/include;../../components/net/lwip-2.0.2/src/include/netif;../../components/net/netdev/include;../../components/net/sal_socket/include;../../components/net/sal_socket/include/socket;../../components/net/sal_socket/impl;../../components/net/sal_socket/include/dfs_net;../../components/net/sal_socket/include/dfs_net/sys_select;../../components/net/sal_socket/include/socket/sys_socket;../../components/drivers/include;../../components/drivers/include;../../components/drivers/spi;../../components/drivers/include;../../components/drivers/include;../../components/drivers/include;../../components/drivers/include;../../components/drivers/include;../../components/drivers/include;../../components/cplusplus;../../components/libc/compilers/armlibc;../../components/libc/compilers/common;../../components/libc/pthreads;../../components/libc/time</IncludePath>
+              <IncludePath>applications;.;SDK_2.2_LPCXpresso54608\CMSIS\Include;SDK_2.2_LPCXpresso54608\devices\LPC54608;..\..\components\cplusplus;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\spi;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common;..\..\components\libc\pthreads;..\..\components\libc\time;SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers;SDK_2.2_LPCXpresso54608\devices\LPC54608\utilities;SDK_2.2_LPCXpresso54608\sdmmc_2.1.2\inc;SDK_2.2_LPCXpresso54608\sdmmc_2.1.2\src;..\..\components\net\lwip-2.0.2\src;..\..\components\net\lwip-2.0.2\src\include;..\..\components\net\lwip-2.0.2\src\include\ipv4;..\..\components\net\lwip-2.0.2\src\arch\include;..\..\components\net\lwip-2.0.2\src\include\netif;..\..\components\net\netdev\include;..\..\components\net\sal_socket\include;..\..\components\net\sal_socket\include\socket;..\..\components\net\sal_socket\impl;..\..\components\net\sal_socket\include\dfs_net;..\..\components\net\sal_socket\include\dfs_net\sys_select;..\..\components\net\sal_socket\include\socket\sys_socket</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -374,1410 +374,1411 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>clock.c</FileName>
+              <FileName>application.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/clock.c</FilePath>
+              <FilePath>applications\application.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>mnt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/components.c</FilePath>
+              <FilePath>applications\mnt.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>startup.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/device.c</FilePath>
+              <FilePath>applications\startup.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CMSIS</GroupName>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../../src/idle.c</FilePath>
+              <FileName>startup_LPC54608.s</FileName>
+              <FileType>2</FileType>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\arm\startup_LPC54608.s</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>system_LPC54608.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/ipc.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\system_LPC54608.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../../src/irq.c</FilePath>
+              <FileName>keil_lib_power.lib</FileName>
+              <FileType>4</FileType>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\arm\keil_lib_power.lib</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPlusPlus</GroupName>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../../src/kservice.c</FilePath>
+              <FileName>cxx_Mutex.cpp</FileName>
+              <FileType>8</FileType>
+              <FilePath>..\..\components\cplusplus\cxx_Mutex.cpp</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../../src/mem.c</FilePath>
+              <FileName>cxx_Semaphore.cpp</FileName>
+              <FileType>8</FileType>
+              <FilePath>..\..\components\cplusplus\cxx_Semaphore.cpp</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>memheap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../../src/memheap.c</FilePath>
+              <FileName>cxx_Thread.cpp</FileName>
+              <FileType>8</FileType>
+              <FilePath>..\..\components\cplusplus\cxx_Thread.cpp</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../../src/mempool.c</FilePath>
+              <FileName>cxx_crt.cpp</FileName>
+              <FileType>8</FileType>
+              <FilePath>..\..\components\cplusplus\cxx_crt.cpp</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
+              <FileName>crt_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/object.c</FilePath>
+              <FilePath>..\..\components\cplusplus\crt_init.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/scheduler.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/signal.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/thread.c</FilePath>
+              <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../src/timer.c</FilePath>
+              <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
+            </File>
+          </Files>
+          <Files>
+            <File>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
             </File>
           </Files>
         </Group>
         <Group>
-          <GroupName>Applications</GroupName>
+          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>application.c</FileName>
+              <FileName>i2c_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications/application.c</FilePath>
+              <FilePath>..\..\components\drivers\i2c\i2c_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mnt.c</FileName>
+              <FileName>i2c_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications/mnt.c</FilePath>
+              <FilePath>..\..\components\drivers\i2c\i2c_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>startup.c</FileName>
+              <FileName>i2c-bit-ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>applications/startup.c</FilePath>
+              <FilePath>..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>board.c</FileName>
+              <FileName>pin.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/board.c</FilePath>
+              <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>clock_config.c</FileName>
+              <FileName>mtd_nand.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/clock_config.c</FilePath>
+              <FilePath>..\..\components\drivers\mtd\mtd_nand.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drt_mpu.c</FileName>
+              <FileName>rtc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drt_mpu.c</FilePath>
+              <FilePath>..\..\components\drivers\rtc\rtc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_emac.c</FileName>
+              <FileName>block_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_emac.c</FilePath>
+              <FilePath>..\..\components\drivers\sdio\block_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_ft5406.c</FileName>
+              <FileName>mmcsd_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_ft5406.c</FilePath>
+              <FilePath>..\..\components\drivers\sdio\mmcsd_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_i2c.c</FileName>
+              <FileName>sd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_i2c.c</FilePath>
+              <FilePath>..\..\components\drivers\sdio\sd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_lcd.c</FileName>
+              <FileName>sdio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_lcd.c</FilePath>
+              <FilePath>..\..\components\drivers\sdio\sdio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_sd.c</FileName>
+              <FileName>mmc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_sd.c</FilePath>
+              <FilePath>..\..\components\drivers\sdio\mmc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_sdram.c</FileName>
+              <FileName>serial.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_sdram.c</FilePath>
+              <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_sram.c</FileName>
+              <FileName>spi_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_sram.c</FilePath>
+              <FilePath>..\..\components\drivers\spi\spi_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_uart.c</FileName>
+              <FileName>spi_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/drv_uart.c</FilePath>
+              <FilePath>..\..\components\drivers\spi\spi_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_phy.c</FileName>
+              <FileName>completion.c</FileName>
               <FileType>1</FileType>
-              <FilePath>drivers/fsl_phy.c</FilePath>
+              <FilePath>..\..\components\drivers\src\completion.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Libraries</GroupName>
           <Files>
             <File>
-              <FileName>fsl_sd.c</FileName>
+              <FileName>dataqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/sdmmc_2.1.2/src/fsl_sd.c</FilePath>
+              <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_sdmmc.c</FileName>
+              <FileName>pipe.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/sdmmc_2.1.2/src/fsl_sdmmc.c</FilePath>
+              <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_host.c</FileName>
+              <FileName>ringblk_buf.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/sdmmc_2.1.2/src/fsl_host.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_sd_event.c</FileName>
+              <FileName>ringbuffer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/sdmmc_2.1.2/src/fsl_sd_event.c</FilePath>
+              <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_adc.c</FileName>
+              <FileName>waitqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_adc.c</FilePath>
+              <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_clock.c</FileName>
+              <FileName>workqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_clock.c</FilePath>
+              <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
             </File>
           </Files>
+          <GroupOption>
+            <GroupArmAds>
+              <Cads>
+                <VariousControls>
+                  <MiscControls />
+                  <Define> </Define>
+                  <Undefine> </Undefine>
+                  <IncludePath> </IncludePath>
+                </VariousControls>
+              </Cads>
+            </GroupArmAds>
+          </GroupOption>
+        </Group>
+        <Group>
+          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>fsl_common.c</FileName>
+              <FileName>board.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_common.c</FilePath>
+              <FilePath>drivers\board.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_crc.c</FileName>
+              <FileName>clock_config.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_crc.c</FilePath>
+              <FilePath>drivers\clock_config.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_ctimer.c</FileName>
+              <FileName>drt_mpu.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_ctimer.c</FilePath>
+              <FilePath>drivers\drt_mpu.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_dma.c</FileName>
+              <FileName>drv_emac.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_dma.c</FilePath>
+              <FilePath>drivers\drv_emac.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_dmic.c</FileName>
+              <FileName>drv_ft5406.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_dmic.c</FilePath>
+              <FilePath>drivers\drv_ft5406.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_dmic_dma.c</FileName>
+              <FileName>drv_i2c.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_dmic_dma.c</FilePath>
+              <FilePath>drivers\drv_i2c.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_eeprom.c</FileName>
+              <FileName>drv_lcd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_eeprom.c</FilePath>
+              <FilePath>drivers\drv_lcd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_emc.c</FileName>
+              <FileName>drv_sd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_emc.c</FilePath>
+              <FilePath>drivers\drv_sd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_enet.c</FileName>
+              <FileName>drv_sdram.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_enet.c</FilePath>
+              <FilePath>drivers\drv_sdram.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_flashiap.c</FileName>
+              <FileName>drv_sram.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_flashiap.c</FilePath>
+              <FilePath>drivers\drv_sram.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_flexcomm.c</FileName>
+              <FileName>drv_uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_flexcomm.c</FilePath>
+              <FilePath>drivers\drv_uart.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_fmc.c</FileName>
+              <FileName>fsl_phy.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_fmc.c</FilePath>
+              <FilePath>drivers\fsl_phy.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>fsl_fmeas.c</FileName>
+              <FileName>dfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_fmeas.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_gint.c</FileName>
+              <FileName>dfs_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_gint.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_gpio.c</FileName>
+              <FileName>dfs_fs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_gpio.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2c.c</FileName>
+              <FileName>dfs_posix.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_i2c.c</FilePath>
+              <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2c_dma.c</FileName>
+              <FileName>poll.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_i2c_dma.c</FilePath>
+              <FilePath>..\..\components\dfs\src\poll.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2s.c</FileName>
+              <FileName>select.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_i2s.c</FilePath>
+              <FilePath>..\..\components\dfs\src\select.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_i2s_dma.c</FileName>
+              <FileName>devfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_i2s_dma.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_inputmux.c</FileName>
+              <FileName>dfs_elm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_inputmux.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_lcdc.c</FileName>
+              <FileName>ff.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_lcdc.c</FilePath>
+              <FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>fsl_mcan.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_mcan.c</FilePath>
+              <FilePath>..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_mrt.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_mrt.c</FilePath>
+              <FilePath>..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_pint.c</FileName>
+              <FileName>msh.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_pint.c</FilePath>
+              <FilePath>..\..\components\finsh\msh.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_power.c</FileName>
+              <FileName>msh_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_power.c</FilePath>
+              <FilePath>..\..\components\finsh\msh_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_reset.c</FileName>
+              <FileName>finsh_compiler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_reset.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_rit.c</FileName>
+              <FileName>finsh_error.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_rit.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_rtc.c</FileName>
+              <FileName>finsh_heap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_rtc.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_sctimer.c</FileName>
+              <FileName>finsh_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_sctimer.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_sdif.c</FileName>
+              <FileName>finsh_node.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_sdif.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_spi.c</FileName>
+              <FileName>finsh_ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_spi.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_spi_dma.c</FileName>
+              <FileName>finsh_parser.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_spi_dma.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_spifi.c</FileName>
+              <FileName>finsh_var.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_spifi.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_spifi_dma.c</FileName>
+              <FileName>finsh_vm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_spifi_dma.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_usart.c</FileName>
+              <FileName>finsh_token.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_usart.c</FilePath>
+              <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>fsl_usart_dma.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_usart_dma.c</FilePath>
+              <FilePath>..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_utick.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_utick.c</FilePath>
+              <FilePath>..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>fsl_wwdt.c</FileName>
+              <FileName>device.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/drivers/fsl_wwdt.c</FilePath>
+              <FilePath>..\..\src\device.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>CMSIS</GroupName>
           <Files>
             <File>
-              <FileName>startup_LPC54608.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/arm/startup_LPC54608.s</FilePath>
+              <FileName>idle.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>system_LPC54608.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/system_LPC54608.c</FilePath>
+              <FilePath>..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>keil_lib_power.lib</FileName>
-              <FileType>4</FileType>
-              <FilePath>SDK_2.2_LPCXpresso54608/devices/LPC54608/arm/keil_lib_power.lib</FilePath>
+              <FileName>irq.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\irq.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../libcpu/arm/common/backtrace.c</FilePath>
+              <FilePath>..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>mem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../libcpu/arm/common/div0.c</FilePath>
+              <FilePath>..\..\src\mem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>memheap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../libcpu/arm/common/showmem.c</FilePath>
+              <FilePath>..\..\src\memheap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../libcpu/arm/cortex-m4/cpuport.c</FilePath>
+              <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>../../libcpu/arm/cortex-m4/context_rvds.S</FilePath>
+              <FileName>object.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\src\object.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/shell.c</FilePath>
+              <FilePath>..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/cmd.c</FilePath>
+              <FilePath>..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/msh.c</FilePath>
+              <FilePath>..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh_file.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/msh_file.c</FilePath>
+              <FilePath>..\..\src\timer.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>libc</GroupName>
           <Files>
             <File>
-              <FileName>finsh_compiler.c</FileName>
+              <FileName>libc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_compiler.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\libc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_error.c</FileName>
+              <FileName>mem_std.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_error.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\mem_std.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_heap.c</FileName>
+              <FileName>stdio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_heap.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\stdio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_init.c</FileName>
+              <FileName>stubs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_init.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\armlibc\stubs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_node.c</FileName>
+              <FileName>time.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_node.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\common\time.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_ops.c</FileName>
+              <FileName>unistd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_ops.c</FilePath>
+              <FilePath>..\..\components\libc\compilers\common\unistd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_parser.c</FileName>
+              <FileName>mqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_parser.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\mqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_var.c</FileName>
+              <FileName>pthread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_var.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_vm.c</FileName>
+              <FileName>pthread_attr.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_vm.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread_attr.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_token.c</FileName>
+              <FileName>pthread_barrier.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/finsh/finsh_token.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread_barrier.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>dfs.c</FileName>
+              <FileName>pthread_cond.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/src/dfs.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread_cond.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_file.c</FileName>
+              <FileName>pthread_mutex.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/src/dfs_file.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread_mutex.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_fs.c</FileName>
+              <FileName>pthread_rwlock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/src/dfs_fs.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread_rwlock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_posix.c</FileName>
+              <FileName>pthread_spin.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/src/dfs_posix.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread_spin.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>poll.c</FileName>
+              <FileName>pthread_tls.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/src/poll.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\pthread_tls.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>select.c</FileName>
+              <FileName>sched.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/src/select.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\sched.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_elm.c</FileName>
+              <FileName>semaphore.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/filesystems/elmfat/dfs_elm.c</FilePath>
+              <FilePath>..\..\components\libc\pthreads\semaphore.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ff.c</FileName>
+              <FileName>clock_time.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/filesystems/elmfat/ff.c</FilePath>
+              <FilePath>..\..\components\libc\time\clock_time.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>devfs.c</FileName>
+              <FileName>posix_sleep.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/dfs/filesystems/devfs/devfs.c</FilePath>
+              <FilePath>..\..\components\libc\time\posix_sleep.c</FilePath>
             </File>
           </Files>
         </Group>
         <Group>
-          <GroupName>lwIP</GroupName>
+          <GroupName>Libraries</GroupName>
           <Files>
             <File>
-              <FileName>sys_arch.c</FileName>
+              <FileName>fsl_adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/arch/sys_arch.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_adc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>api_lib.c</FileName>
+              <FileName>fsl_clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/api_lib.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>api_msg.c</FileName>
+              <FileName>fsl_common.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/api_msg.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_common.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>err.c</FileName>
+              <FileName>fsl_crc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/err.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_crc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>netbuf.c</FileName>
+              <FileName>fsl_ctimer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/netbuf.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_ctimer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>netdb.c</FileName>
+              <FileName>fsl_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/netdb.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>netifapi.c</FileName>
+              <FileName>fsl_dmic.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/netifapi.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_dmic.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sockets.c</FileName>
+              <FileName>fsl_dmic_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/sockets.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_dmic_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>tcpip.c</FileName>
+              <FileName>fsl_eeprom.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/api/tcpip.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_eeprom.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>def.c</FileName>
+              <FileName>fsl_emc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/def.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_emc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dns.c</FileName>
+              <FileName>fsl_enet.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/dns.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_enet.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>inet_chksum.c</FileName>
+              <FileName>fsl_flashiap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/inet_chksum.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_flashiap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>init.c</FileName>
+              <FileName>fsl_flexcomm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/init.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_flexcomm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ip.c</FileName>
+              <FileName>fsl_fmc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ip.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_fmc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>memp.c</FileName>
+              <FileName>fsl_fmeas.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/memp.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_fmeas.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>netif.c</FileName>
+              <FileName>fsl_gint.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/netif.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_gint.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pbuf.c</FileName>
+              <FileName>fsl_gpio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/pbuf.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_gpio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>raw.c</FileName>
+              <FileName>fsl_i2c.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/raw.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_i2c.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>stats.c</FileName>
+              <FileName>fsl_i2c_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/stats.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_i2c_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sys.c</FileName>
+              <FileName>fsl_i2s.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/sys.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_i2s.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>tcp.c</FileName>
+              <FileName>fsl_i2s_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/tcp.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_i2s_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>tcp_in.c</FileName>
+              <FileName>fsl_inputmux.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/tcp_in.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_inputmux.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>tcp_out.c</FileName>
+              <FileName>fsl_lcdc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/tcp_out.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_lcdc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timeouts.c</FileName>
+              <FileName>fsl_mcan.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/timeouts.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_mcan.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>udp.c</FileName>
+              <FileName>fsl_mrt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/udp.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_mrt.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ethernet.c</FileName>
+              <FileName>fsl_pint.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/netif/ethernet.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_pint.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ethernetif.c</FileName>
+              <FileName>fsl_power.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/netif/ethernetif.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_power.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>lowpan6.c</FileName>
+              <FileName>fsl_reset.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/netif/lowpan6.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_reset.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>autoip.c</FileName>
+              <FileName>fsl_rit.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/autoip.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_rit.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dhcp.c</FileName>
+              <FileName>fsl_rtc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/dhcp.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_rtc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>etharp.c</FileName>
+              <FileName>fsl_sctimer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/etharp.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_sctimer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>icmp.c</FileName>
+              <FileName>fsl_sdif.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/icmp.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_sdif.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>igmp.c</FileName>
+              <FileName>fsl_spi.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/igmp.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_spi.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ip4.c</FileName>
+              <FileName>fsl_spi_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/ip4.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_spi_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ip4_addr.c</FileName>
+              <FileName>fsl_spifi.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/ip4_addr.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_spifi.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ip4_frag.c</FileName>
+              <FileName>fsl_spifi_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/core/ipv4/ip4_frag.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_spifi_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ping.c</FileName>
+              <FileName>fsl_usart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/lwip-2.0.2/src/apps/ping/ping.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_usart.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>netdev</GroupName>
           <Files>
             <File>
-              <FileName>netdev.c</FileName>
+              <FileName>fsl_usart_dma.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/netdev/src/netdev.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_usart_dma.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>netdev_ipaddr.c</FileName>
+              <FileName>fsl_utick.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/netdev/src/netdev_ipaddr.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_utick.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>SAL</GroupName>
           <Files>
             <File>
-              <FileName>sal_socket.c</FileName>
+              <FileName>fsl_wwdt.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/sal_socket/src/sal_socket.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\devices\LPC54608\drivers\fsl_wwdt.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>net_netdb.c</FileName>
+              <FileName>fsl_sd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/sal_socket/socket/net_netdb.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\sdmmc_2.1.2\src\fsl_sd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>af_inet_lwip.c</FileName>
+              <FileName>fsl_sdmmc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/sal_socket/impl/af_inet_lwip.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\sdmmc_2.1.2\src\fsl_sdmmc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>net_sockets.c</FileName>
+              <FileName>fsl_host.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/sal_socket/socket/net_sockets.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\sdmmc_2.1.2\src\fsl_host.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_net.c</FileName>
+              <FileName>fsl_sd_event.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/net/sal_socket/dfs_net/dfs_net.c</FilePath>
+              <FilePath>SDK_2.2_LPCXpresso54608\sdmmc_2.1.2\src\fsl_sd_event.c</FilePath>
             </File>
           </Files>
         </Group>
         <Group>
-          <GroupName>DeviceDrivers</GroupName>
+          <GroupName>lwIP</GroupName>
           <Files>
             <File>
-              <FileName>block_dev.c</FileName>
+              <FileName>sys_arch.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/sdio/block_dev.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\arch\sys_arch.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mmcsd_core.c</FileName>
+              <FileName>api_lib.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/sdio/mmcsd_core.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\api_lib.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sd.c</FileName>
+              <FileName>api_msg.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/sdio/sd.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\api_msg.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sdio.c</FileName>
+              <FileName>err.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/sdio/sdio.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\err.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mmc.c</FileName>
+              <FileName>netbuf.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/sdio/mmc.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\netbuf.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>rtc.c</FileName>
+              <FileName>netdb.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/rtc/rtc.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\netdb.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_core.c</FileName>
+              <FileName>netifapi.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/spi/spi_core.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\netifapi.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_dev.c</FileName>
+              <FileName>sockets.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/spi/spi_dev.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\sockets.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>i2c_core.c</FileName>
+              <FileName>tcpip.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/i2c/i2c_core.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\api\tcpip.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>i2c_dev.c</FileName>
+              <FileName>def.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/i2c/i2c_dev.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\def.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>i2c-bit-ops.c</FileName>
+              <FileName>dns.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/i2c/i2c-bit-ops.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\dns.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>serial.c</FileName>
+              <FileName>inet_chksum.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/serial/serial.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\inet_chksum.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>completion.c</FileName>
+              <FileName>init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/src/completion.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dataqueue.c</FileName>
+              <FileName>ip.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/src/dataqueue.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ip.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pipe.c</FileName>
+              <FileName>memp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/src/pipe.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\memp.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringblk_buf.c</FileName>
+              <FileName>netif.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/src/ringblk_buf.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\netif.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringbuffer.c</FileName>
+              <FileName>pbuf.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/src/ringbuffer.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\pbuf.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>waitqueue.c</FileName>
+              <FileName>raw.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/src/waitqueue.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\raw.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>workqueue.c</FileName>
+              <FileName>stats.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/src/workqueue.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\stats.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mtd_nand.c</FileName>
+              <FileName>sys.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/mtd/mtd_nand.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\sys.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pin.c</FileName>
+              <FileName>tcp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/drivers/misc/pin.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\tcp.c</FilePath>
             </File>
           </Files>
-          <GroupOption>
-            <GroupArmAds>
-              <Cads>
-                <VariousControls>
-                  <MiscControls />
-                  <Define> </Define>
-                  <Undefine> </Undefine>
-                  <IncludePath> </IncludePath>
-                </VariousControls>
-              </Cads>
-            </GroupArmAds>
-          </GroupOption>
-        </Group>
-        <Group>
-          <GroupName>CPlusPlus</GroupName>
           <Files>
             <File>
-              <FileName>cxx_Mutex.cpp</FileName>
-              <FileType>8</FileType>
-              <FilePath>../../components/cplusplus/cxx_Mutex.cpp</FilePath>
+              <FileName>tcp_in.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\tcp_in.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cxx_Semaphore.cpp</FileName>
-              <FileType>8</FileType>
-              <FilePath>../../components/cplusplus/cxx_Semaphore.cpp</FilePath>
+              <FileName>tcp_out.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\tcp_out.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cxx_Thread.cpp</FileName>
-              <FileType>8</FileType>
-              <FilePath>../../components/cplusplus/cxx_Thread.cpp</FilePath>
+              <FileName>timeouts.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\timeouts.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cxx_crt.cpp</FileName>
-              <FileType>8</FileType>
-              <FilePath>../../components/cplusplus/cxx_crt.cpp</FilePath>
+              <FileName>udp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\udp.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>crt_init.c</FileName>
+              <FileName>ethernet.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/cplusplus/crt_init.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\netif\ethernet.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>libc</GroupName>
           <Files>
             <File>
-              <FileName>libc.c</FileName>
+              <FileName>ethernetif.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/compilers/armlibc/libc.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\netif\ethernetif.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem_std.c</FileName>
+              <FileName>lowpan6.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/compilers/armlibc/mem_std.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\netif\lowpan6.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>stdio.c</FileName>
+              <FileName>autoip.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/compilers/armlibc/stdio.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\autoip.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>stubs.c</FileName>
+              <FileName>dhcp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/compilers/armlibc/stubs.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\dhcp.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>time.c</FileName>
+              <FileName>etharp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/compilers/common/time.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\etharp.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>pthreads</GroupName>
           <Files>
             <File>
-              <FileName>mqueue.c</FileName>
+              <FileName>icmp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/mqueue.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\icmp.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pthread.c</FileName>
+              <FileName>igmp.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\igmp.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pthread_attr.c</FileName>
+              <FileName>ip4.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread_attr.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\ip4.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pthread_barrier.c</FileName>
+              <FileName>ip4_addr.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread_barrier.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\ip4_addr.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pthread_cond.c</FileName>
+              <FileName>ip4_frag.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread_cond.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\core\ipv4\ip4_frag.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pthread_mutex.c</FileName>
+              <FileName>ping.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread_mutex.c</FilePath>
+              <FilePath>..\..\components\net\lwip-2.0.2\src\apps\ping\ping.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>SAL</GroupName>
           <Files>
             <File>
-              <FileName>pthread_rwlock.c</FileName>
+              <FileName>netdev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread_rwlock.c</FilePath>
+              <FilePath>..\..\components\net\netdev\src\netdev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pthread_spin.c</FileName>
+              <FileName>netdev_ipaddr.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread_spin.c</FilePath>
+              <FilePath>..\..\components\net\netdev\src\netdev_ipaddr.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pthread_tls.c</FileName>
+              <FileName>sal_socket.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/pthread_tls.c</FilePath>
+              <FilePath>..\..\components\net\sal_socket\src\sal_socket.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sched.c</FileName>
+              <FileName>net_netdb.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/sched.c</FilePath>
+              <FilePath>..\..\components\net\sal_socket\socket\net_netdb.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>semaphore.c</FileName>
+              <FileName>af_inet_lwip.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/pthreads/semaphore.c</FilePath>
+              <FilePath>..\..\components\net\sal_socket\impl\af_inet_lwip.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>clock_time.c</FileName>
+              <FileName>net_sockets.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/time/clock_time.c</FilePath>
+              <FilePath>..\..\components\net\sal_socket\socket\net_sockets.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>posix_sleep.c</FileName>
+              <FileName>dfs_net.c</FileName>
               <FileType>1</FileType>
-              <FilePath>../../components/libc/time/posix_sleep.c</FilePath>
+              <FilePath>..\..\components\net\sal_socket\dfs_net\dfs_net.c</FilePath>
             </File>
           </Files>
         </Group>

+ 0 - 1632
bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvoptx

@@ -196,1636 +196,4 @@
     </TargetOption>
   </Target>
 
-  <Group>
-    <GroupName>Kernel</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>1</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\clock.c</PathWithFileName>
-      <FilenameWithoutPath>clock.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>2</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\components.c</PathWithFileName>
-      <FilenameWithoutPath>components.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>3</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\device.c</PathWithFileName>
-      <FilenameWithoutPath>device.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>4</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\idle.c</PathWithFileName>
-      <FilenameWithoutPath>idle.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>5</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\ipc.c</PathWithFileName>
-      <FilenameWithoutPath>ipc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>6</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\irq.c</PathWithFileName>
-      <FilenameWithoutPath>irq.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>7</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\kservice.c</PathWithFileName>
-      <FilenameWithoutPath>kservice.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>8</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\mem.c</PathWithFileName>
-      <FilenameWithoutPath>mem.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>9</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\mempool.c</PathWithFileName>
-      <FilenameWithoutPath>mempool.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>10</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\object.c</PathWithFileName>
-      <FilenameWithoutPath>object.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>11</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\scheduler.c</PathWithFileName>
-      <FilenameWithoutPath>scheduler.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>12</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\signal.c</PathWithFileName>
-      <FilenameWithoutPath>signal.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>13</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\thread.c</PathWithFileName>
-      <FilenameWithoutPath>thread.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>1</GroupNumber>
-      <FileNumber>14</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\src\timer.c</PathWithFileName>
-      <FilenameWithoutPath>timer.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>Applications</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>2</GroupNumber>
-      <FileNumber>15</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>applications\main.c</PathWithFileName>
-      <FilenameWithoutPath>main.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>Drivers</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>16</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>board\board.c</PathWithFileName>
-      <FilenameWithoutPath>board.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>17</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>board\MCUX_Config\board\clock_config.c</PathWithFileName>
-      <FilenameWithoutPath>clock_config.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>18</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>board\MCUX_Config\board\pin_mux.c</PathWithFileName>
-      <FilenameWithoutPath>pin_mux.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>19</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_pin.c</PathWithFileName>
-      <FilenameWithoutPath>drv_pin.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>20</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_led.c</PathWithFileName>
-      <FilenameWithoutPath>drv_led.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>21</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_key.c</PathWithFileName>
-      <FilenameWithoutPath>drv_key.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>22</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_uart.c</PathWithFileName>
-      <FilenameWithoutPath>drv_uart.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>23</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_rtc.c</PathWithFileName>
-      <FilenameWithoutPath>drv_rtc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>24</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_spi.c</PathWithFileName>
-      <FilenameWithoutPath>drv_spi.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>25</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_sd.c</PathWithFileName>
-      <FilenameWithoutPath>drv_sd.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>26</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_i2c.c</PathWithFileName>
-      <FilenameWithoutPath>drv_i2c.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>27</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_mma8562.c</PathWithFileName>
-      <FilenameWithoutPath>drv_mma8562.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>28</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_adc.c</PathWithFileName>
-      <FilenameWithoutPath>drv_adc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>29</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_hwtimer.c</PathWithFileName>
-      <FilenameWithoutPath>drv_hwtimer.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>3</GroupNumber>
-      <FileNumber>30</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\drivers\drv_pwm.c</PathWithFileName>
-      <FilenameWithoutPath>drv_pwm.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>cpu</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>4</GroupNumber>
-      <FileNumber>31</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\libcpu\arm\common\backtrace.c</PathWithFileName>
-      <FilenameWithoutPath>backtrace.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>4</GroupNumber>
-      <FileNumber>32</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\libcpu\arm\common\div0.c</PathWithFileName>
-      <FilenameWithoutPath>div0.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>4</GroupNumber>
-      <FileNumber>33</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\libcpu\arm\common\showmem.c</PathWithFileName>
-      <FilenameWithoutPath>showmem.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>4</GroupNumber>
-      <FileNumber>34</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\libcpu\arm\cortex-m4\cpuport.c</PathWithFileName>
-      <FilenameWithoutPath>cpuport.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>4</GroupNumber>
-      <FileNumber>35</FileNumber>
-      <FileType>2</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\libcpu\arm\cortex-m4\context_rvds.S</PathWithFileName>
-      <FilenameWithoutPath>context_rvds.S</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>Filesystem</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>36</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\dfs\src\dfs.c</PathWithFileName>
-      <FilenameWithoutPath>dfs.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>37</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\dfs\src\dfs_file.c</PathWithFileName>
-      <FilenameWithoutPath>dfs_file.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>38</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\dfs\src\dfs_fs.c</PathWithFileName>
-      <FilenameWithoutPath>dfs_fs.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>39</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\dfs\src\dfs_posix.c</PathWithFileName>
-      <FilenameWithoutPath>dfs_posix.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>40</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\dfs\src\poll.c</PathWithFileName>
-      <FilenameWithoutPath>poll.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>41</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\dfs\src\select.c</PathWithFileName>
-      <FilenameWithoutPath>select.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>42</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\dfs\filesystems\devfs\devfs.c</PathWithFileName>
-      <FilenameWithoutPath>devfs.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>DeviceDrivers</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>43</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\hwtimer\hwtimer.c</PathWithFileName>
-      <FilenameWithoutPath>hwtimer.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>44</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\i2c\i2c_core.c</PathWithFileName>
-      <FilenameWithoutPath>i2c_core.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>45</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\i2c\i2c_dev.c</PathWithFileName>
-      <FilenameWithoutPath>i2c_dev.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>46</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\i2c\i2c-bit-ops.c</PathWithFileName>
-      <FilenameWithoutPath>i2c-bit-ops.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>47</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\misc\pin.c</PathWithFileName>
-      <FilenameWithoutPath>pin.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>48</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\misc\adc.c</PathWithFileName>
-      <FilenameWithoutPath>adc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>49</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\misc\rt_drv_pwm.c</PathWithFileName>
-      <FilenameWithoutPath>rt_drv_pwm.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>50</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\rtc\rtc.c</PathWithFileName>
-      <FilenameWithoutPath>rtc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>51</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\sdio\block_dev.c</PathWithFileName>
-      <FilenameWithoutPath>block_dev.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>52</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\sdio\mmcsd_core.c</PathWithFileName>
-      <FilenameWithoutPath>mmcsd_core.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>53</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\sdio\sd.c</PathWithFileName>
-      <FilenameWithoutPath>sd.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>54</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\sdio\sdio.c</PathWithFileName>
-      <FilenameWithoutPath>sdio.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>55</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\sdio\mmc.c</PathWithFileName>
-      <FilenameWithoutPath>mmc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>56</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\serial\serial.c</PathWithFileName>
-      <FilenameWithoutPath>serial.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>57</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\spi\spi_core.c</PathWithFileName>
-      <FilenameWithoutPath>spi_core.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>58</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\spi\spi_dev.c</PathWithFileName>
-      <FilenameWithoutPath>spi_dev.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>59</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\src\completion.c</PathWithFileName>
-      <FilenameWithoutPath>completion.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>60</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\src\dataqueue.c</PathWithFileName>
-      <FilenameWithoutPath>dataqueue.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>61</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\src\pipe.c</PathWithFileName>
-      <FilenameWithoutPath>pipe.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>62</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\src\ringblk_buf.c</PathWithFileName>
-      <FilenameWithoutPath>ringblk_buf.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>63</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\src\ringbuffer.c</PathWithFileName>
-      <FilenameWithoutPath>ringbuffer.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>64</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\src\waitqueue.c</PathWithFileName>
-      <FilenameWithoutPath>waitqueue.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>6</GroupNumber>
-      <FileNumber>65</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\drivers\src\workqueue.c</PathWithFileName>
-      <FilenameWithoutPath>workqueue.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>finsh</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>66</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\shell.c</PathWithFileName>
-      <FilenameWithoutPath>shell.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>67</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\cmd.c</PathWithFileName>
-      <FilenameWithoutPath>cmd.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>68</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\msh.c</PathWithFileName>
-      <FilenameWithoutPath>msh.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>69</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\msh_file.c</PathWithFileName>
-      <FilenameWithoutPath>msh_file.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>70</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_compiler.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_compiler.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>71</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_error.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_error.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>72</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_heap.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_heap.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>73</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_init.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_init.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>74</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_node.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_node.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>75</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_ops.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_ops.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>76</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_parser.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_parser.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>77</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_var.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_var.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>78</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_vm.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_vm.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>7</GroupNumber>
-      <FileNumber>79</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\finsh\finsh_token.c</PathWithFileName>
-      <FilenameWithoutPath>finsh_token.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>libc</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>8</GroupNumber>
-      <FileNumber>80</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\libc\compilers\armlibc\libc.c</PathWithFileName>
-      <FilenameWithoutPath>libc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>8</GroupNumber>
-      <FileNumber>81</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\libc\compilers\armlibc\mem_std.c</PathWithFileName>
-      <FilenameWithoutPath>mem_std.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>8</GroupNumber>
-      <FileNumber>82</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\libc\compilers\armlibc\stdio.c</PathWithFileName>
-      <FilenameWithoutPath>stdio.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>8</GroupNumber>
-      <FileNumber>83</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\libc\compilers\armlibc\stubs.c</PathWithFileName>
-      <FilenameWithoutPath>stubs.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>8</GroupNumber>
-      <FileNumber>84</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\components\libc\compilers\common\time.c</PathWithFileName>
-      <FilenameWithoutPath>time.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
-  <Group>
-    <GroupName>Libraries</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>0</RteFlg>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>85</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\system_LPC55S69_cm33_core0.c</PathWithFileName>
-      <FilenameWithoutPath>system_LPC55S69_cm33_core0.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>86</FileNumber>
-      <FileType>2</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\arm\startup_LPC55S69_cm33_core0.s</PathWithFileName>
-      <FilenameWithoutPath>startup_LPC55S69_cm33_core0.s</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>87</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_anactrl.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_anactrl.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>88</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_casper.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_casper.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>89</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_clock.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_clock.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>90</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_cmp.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_cmp.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>91</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_common.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_common.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>92</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_crc.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_crc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>93</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_ctimer.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_ctimer.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>94</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_flexcomm.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_flexcomm.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>95</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_dma.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_dma.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>96</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_gint.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_gint.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>97</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_gpio.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_gpio.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>98</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_hashcrypt.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_hashcrypt.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>99</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_i2c.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_i2c.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>100</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_i2c_dma.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_i2c_dma.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>101</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_i2s.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_i2s.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>102</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_i2s_dma.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_i2s_dma.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>103</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_iap.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_iap.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>104</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_inputmux.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_inputmux.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>105</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_lpadc.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_lpadc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>106</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_mrt.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_mrt.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>107</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_ostimer.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_ostimer.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>108</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_pint.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_pint.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>109</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_plu.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_plu.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>110</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_power.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_power.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>111</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_powerquad_basic.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_powerquad_basic.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>112</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_prince.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_prince.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>113</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_puf.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_puf.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>114</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_reset.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_reset.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>115</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_rng.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_rng.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>116</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_rtc.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_rtc.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>117</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_sctimer.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_sctimer.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>118</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_sdif.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_sdif.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>119</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_spi.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_spi.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>120</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_spi_dma.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_spi_dma.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>121</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_sysctl.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_sysctl.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>122</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_usart.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_usart.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>123</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_usart_dma.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_usart_dma.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>124</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_utick.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_utick.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>125</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\drivers\fsl_wwdt.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_wwdt.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>126</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\middleware\sdmmc\src\fsl_sd.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_sd.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>127</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\middleware\sdmmc\src\fsl_sdmmc_common.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_sdmmc_common.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>128</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\middleware\sdmmc\port\sdif\rt_thread\fsl_sdmmc_event.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_sdmmc_event.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>129</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\middleware\sdmmc\port\sdif\rt_thread\fsl_sdmmc_host.c</PathWithFileName>
-      <FilenameWithoutPath>fsl_sdmmc_host.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-    <File>
-      <GroupNumber>9</GroupNumber>
-      <FileNumber>130</FileNumber>
-      <FileType>4</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\Libraries\LPC55S6X\LPC55S6X\arm\keil_lib_power_cm33_core0.lib</PathWithFileName>
-      <FilenameWithoutPath>arm_keil_lib_power_cm33_core0.lib</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
-  </Group>
-
 </ProjectOpt>

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 385 - 294
bsp/lpc55sxx/lpc55s69_nxp_evk/project.uvprojx


+ 197 - 214
bsp/lpc55sxx/lpc55s69_nxp_evk_ns/project.uvprojx

@@ -334,9 +334,9 @@
             <v6Rtti>0</v6Rtti>
             <VariousControls>
               <MiscControls>--target=arm-arm-none-eabi</MiscControls>
-              <Define>RT_USING_TFM, CPU_LPC55S69JBD100_cm33_core0, RT_USING_ARM_LIBC</Define>
+              <Define>CPU_LPC55S69JBD100_cm33_core0, RT_USING_ARM_LIBC, __RTTHREAD__</Define>
               <Undefine />
-              <IncludePath>.;..\..\..\include;..\lpc55s69_nxp_evk\applications;..\lpc55s69_nxp_evk\board;..\lpc55s69_nxp_evk\board\MCUX_Config\board;..\Libraries\drivers;..\Libraries\drivers\config;packages\trusted-firmware-m-nxp-lpc55-v1.0-beta\interface\include;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\Libraries\LPC55S6X\CMSIS\Include;..\Libraries\LPC55S6X\components\codec;..\Libraries\LPC55S6X\LPC55S6X;..\Libraries\LPC55S6X\LPC55S6X\drivers;..\Libraries\LPC55S6X\middleware\sdmmc\inc;..\Libraries\LPC55S6X\middleware\sdmmc\port</IncludePath>
+              <IncludePath>..\lpc55s69_nxp_evk\applications;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\lpc55s69_nxp_evk\board;..\lpc55s69_nxp_evk\board\MCUX_Config\board;..\Libraries\drivers;..\Libraries\drivers\config;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\finsh;.;..\..\..\include;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\Libraries\LPC55S6X\CMSIS\Include;..\Libraries\LPC55S6X\components\codec;..\Libraries\LPC55S6X\LPC55S6X;..\Libraries\LPC55S6X\LPC55S6X\drivers;..\Libraries\LPC55S6X\middleware\sdmmc\inc;..\Libraries\LPC55S6X\middleware\sdmmc\port</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -378,619 +378,595 @@
       </TargetOption>
       <Groups>
         <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
+          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>components.c</FileName>
+              <FileName>main.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\components.c</FilePath>
+              <FilePath>..\lpc55s69_nxp_evk\applications\main.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>device.c</FileName>
+              <FileName>tfm_ps.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\device.c</FilePath>
+              <FilePath>..\lpc55s69_nxp_evk\applications\tfm_ps.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>CPU</GroupName>
           <Files>
             <File>
-              <FileName>idle.c</FileName>
+              <FileName>backtrace.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\idle.c</FilePath>
+              <FilePath>..\..\..\libcpu\arm\common\backtrace.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ipc.c</FileName>
+              <FileName>div0.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\ipc.c</FilePath>
+              <FilePath>..\..\..\libcpu\arm\common\div0.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>irq.c</FileName>
+              <FileName>showmem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\irq.c</FilePath>
+              <FilePath>..\..\..\libcpu\arm\common\showmem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>kservice.c</FileName>
+              <FileName>cpuport.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\kservice.c</FilePath>
+              <FilePath>..\..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\mem.c</FilePath>
+              <FileName>context_rvds.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>..\..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>mempool.c</FileName>
+              <FileName>hwtimer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\mempool.c</FilePath>
+              <FilePath>..\..\..\components\drivers\hwtimer\hwtimer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>object.c</FileName>
+              <FileName>i2c_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\object.c</FilePath>
+              <FilePath>..\..\..\components\drivers\i2c\i2c_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>scheduler.c</FileName>
+              <FileName>i2c_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\scheduler.c</FilePath>
+              <FilePath>..\..\..\components\drivers\i2c\i2c_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>signal.c</FileName>
+              <FileName>i2c-bit-ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\signal.c</FilePath>
+              <FilePath>..\..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>thread.c</FileName>
+              <FileName>pin.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\thread.c</FilePath>
+              <FilePath>..\..\..\components\drivers\misc\pin.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>timer.c</FileName>
+              <FileName>adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\src\timer.c</FilePath>
+              <FilePath>..\..\..\components\drivers\misc\adc.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Applications</GroupName>
           <Files>
             <File>
-              <FileName>main.c</FileName>
+              <FileName>rt_drv_pwm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\lpc55s69_nxp_evk\applications\main.c</FilePath>
+              <FilePath>..\..\..\components\drivers\misc\rt_drv_pwm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>tfm_ps.c</FileName>
+              <FileName>rtc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\lpc55s69_nxp_evk\applications\tfm_ps.c</FilePath>
+              <FilePath>..\..\..\components\drivers\rtc\rtc.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>board.c</FileName>
+              <FileName>block_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\lpc55s69_nxp_evk\board\board.c</FilePath>
+              <FilePath>..\..\..\components\drivers\sdio\block_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>clock_config.c</FileName>
+              <FileName>mmcsd_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\lpc55s69_nxp_evk\board\MCUX_Config\board\clock_config.c</FilePath>
+              <FilePath>..\..\..\components\drivers\sdio\mmcsd_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pin_mux.c</FileName>
+              <FileName>sd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\lpc55s69_nxp_evk\board\MCUX_Config\board\pin_mux.c</FilePath>
+              <FilePath>..\..\..\components\drivers\sdio\sd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_pin.c</FileName>
+              <FileName>sdio.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_pin.c</FilePath>
+              <FilePath>..\..\..\components\drivers\sdio\sdio.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_led.c</FileName>
+              <FileName>mmc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_led.c</FilePath>
+              <FilePath>..\..\..\components\drivers\sdio\mmc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_key.c</FileName>
+              <FileName>serial.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_key.c</FilePath>
+              <FilePath>..\..\..\components\drivers\serial\serial.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_uart.c</FileName>
+              <FileName>spi_core.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_uart.c</FilePath>
+              <FilePath>..\..\..\components\drivers\spi\spi_core.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_rtc.c</FileName>
+              <FileName>spi_dev.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_rtc.c</FilePath>
+              <FilePath>..\..\..\components\drivers\spi\spi_dev.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_spi.c</FileName>
+              <FileName>completion.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_spi.c</FilePath>
+              <FilePath>..\..\..\components\drivers\src\completion.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_sd.c</FileName>
+              <FileName>dataqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_sd.c</FilePath>
+              <FilePath>..\..\..\components\drivers\src\dataqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_i2c.c</FileName>
+              <FileName>pipe.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_i2c.c</FilePath>
+              <FilePath>..\..\..\components\drivers\src\pipe.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_mma8562.c</FileName>
+              <FileName>ringblk_buf.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_mma8562.c</FilePath>
+              <FilePath>..\..\..\components\drivers\src\ringblk_buf.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_adc.c</FileName>
+              <FileName>ringbuffer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_adc.c</FilePath>
+              <FilePath>..\..\..\components\drivers\src\ringbuffer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_hwtimer.c</FileName>
+              <FileName>waitqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_hwtimer.c</FilePath>
+              <FilePath>..\..\..\components\drivers\src\waitqueue.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>drv_pwm.c</FileName>
+              <FileName>workqueue.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\Libraries\drivers\drv_pwm.c</FilePath>
+              <FilePath>..\..\..\components\drivers\src\workqueue.c</FilePath>
             </File>
           </Files>
+          <GroupOption>
+            <GroupArmAds>
+              <Cads>
+                <VariousControls>
+                  <MiscControls />
+                  <Define> </Define>
+                  <Undefine> </Undefine>
+                  <IncludePath> </IncludePath>
+                </VariousControls>
+              </Cads>
+            </GroupArmAds>
+          </GroupOption>
         </Group>
         <Group>
-          <GroupName>TFM</GroupName>
+          <GroupName>Drivers</GroupName>
           <Files>
             <File>
-              <FileName>tfm_sst_api.c</FileName>
+              <FileName>board.c</FileName>
               <FileType>1</FileType>
-              <FilePath>packages\trusted-firmware-m-nxp-lpc55-v1.0-beta\interface\src\tfm_sst_api.c</FilePath>
+              <FilePath>..\lpc55s69_nxp_evk\board\board.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>tfm_ns_lock_rt-thread.c</FileName>
+              <FileName>clock_config.c</FileName>
               <FileType>1</FileType>
-              <FilePath>packages\trusted-firmware-m-nxp-lpc55-v1.0-beta\interface\src\tfm_ns_lock_rt-thread.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>veneers_s_veneers.o</FileName>
-              <FileType>3</FileType>
-              <FilePath>packages\trusted-firmware-m-nxp-lpc55-v1.0-beta\cmake_build\install\export\tfm\veneers\s_veneers.o</FilePath>
+              <FilePath>..\lpc55s69_nxp_evk\board\MCUX_Config\board\clock_config.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>cpu</GroupName>
           <Files>
             <File>
-              <FileName>backtrace.c</FileName>
+              <FileName>pin_mux.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\backtrace.c</FilePath>
+              <FilePath>..\lpc55s69_nxp_evk\board\MCUX_Config\board\pin_mux.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>div0.c</FileName>
+              <FileName>drv_pin.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\div0.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_pin.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>showmem.c</FileName>
+              <FileName>drv_led.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\showmem.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_led.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cpuport.c</FileName>
+              <FileName>drv_key.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
+              <FilePath>..\Libraries\drivers\drv_key.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>dfs.c</FileName>
+              <FileName>drv_uart.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_uart.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_file.c</FileName>
+              <FileName>drv_rtc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_file.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_rtc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_fs.c</FileName>
+              <FileName>drv_spi.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_fs.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_spi.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dfs_posix.c</FileName>
+              <FileName>drv_sd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_posix.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_sd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>poll.c</FileName>
+              <FileName>drv_i2c.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\poll.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_i2c.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>select.c</FileName>
+              <FileName>drv_mma8562.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\select.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_mma8562.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>devfs.c</FileName>
+              <FileName>drv_adc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_adc.c</FilePath>
             </File>
           </Files>
-        </Group>
-        <Group>
-          <GroupName>DeviceDrivers</GroupName>
           <Files>
             <File>
-              <FileName>hwtimer.c</FileName>
+              <FileName>drv_hwtimer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwtimer\hwtimer.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_hwtimer.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>i2c_core.c</FileName>
+              <FileName>drv_pwm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c_core.c</FilePath>
+              <FilePath>..\Libraries\drivers\drv_pwm.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>Filesystem</GroupName>
           <Files>
             <File>
-              <FileName>i2c_dev.c</FileName>
+              <FileName>dfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c_dev.c</FilePath>
+              <FilePath>..\..\..\components\dfs\src\dfs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>i2c-bit-ops.c</FileName>
+              <FileName>dfs_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
+              <FilePath>..\..\..\components\dfs\src\dfs_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pin.c</FileName>
+              <FileName>dfs_fs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\pin.c</FilePath>
+              <FilePath>..\..\..\components\dfs\src\dfs_fs.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>adc.c</FileName>
+              <FileName>dfs_posix.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\adc.c</FilePath>
+              <FilePath>..\..\..\components\dfs\src\dfs_posix.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>rt_drv_pwm.c</FileName>
+              <FileName>poll.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\rt_drv_pwm.c</FilePath>
+              <FilePath>..\..\..\components\dfs\src\poll.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>rtc.c</FileName>
+              <FileName>select.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\rtc\rtc.c</FilePath>
+              <FilePath>..\..\..\components\dfs\src\select.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>block_dev.c</FileName>
+              <FileName>devfs.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\sdio\block_dev.c</FilePath>
+              <FilePath>..\..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
             </File>
           </Files>
+        </Group>
+        <Group>
+          <GroupName>finsh</GroupName>
           <Files>
             <File>
-              <FileName>mmcsd_core.c</FileName>
+              <FileName>shell.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\sdio\mmcsd_core.c</FilePath>
+              <FilePath>..\..\..\components\finsh\shell.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sd.c</FileName>
+              <FileName>cmd.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\sdio\sd.c</FilePath>
+              <FilePath>..\..\..\components\finsh\cmd.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>sdio.c</FileName>
+              <FileName>msh.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\sdio\sdio.c</FilePath>
+              <FilePath>..\..\..\components\finsh\msh.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>mmc.c</FileName>
+              <FileName>msh_file.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\sdio\mmc.c</FilePath>
+              <FilePath>..\..\..\components\finsh\msh_file.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>serial.c</FileName>
+              <FileName>finsh_compiler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\serial\serial.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_compiler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_core.c</FileName>
+              <FileName>finsh_error.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_core.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_error.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>spi_dev.c</FileName>
+              <FileName>finsh_heap.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_dev.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_heap.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>completion.c</FileName>
+              <FileName>finsh_init.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\completion.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_init.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>dataqueue.c</FileName>
+              <FileName>finsh_node.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\dataqueue.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_node.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>pipe.c</FileName>
+              <FileName>finsh_ops.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\pipe.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_ops.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringblk_buf.c</FileName>
+              <FileName>finsh_parser.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringblk_buf.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_parser.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>ringbuffer.c</FileName>
+              <FileName>finsh_var.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringbuffer.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_var.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>waitqueue.c</FileName>
+              <FileName>finsh_vm.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\waitqueue.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_vm.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>workqueue.c</FileName>
+              <FileName>finsh_token.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\workqueue.c</FilePath>
+              <FilePath>..\..\..\components\finsh\finsh_token.c</FilePath>
             </File>
           </Files>
-          <GroupOption>
-            <GroupArmAds>
-              <Cads>
-                <VariousControls>
-                  <MiscControls />
-                  <Define> </Define>
-                  <Undefine> </Undefine>
-                  <IncludePath> </IncludePath>
-                </VariousControls>
-              </Cads>
-            </GroupArmAds>
-          </GroupOption>
         </Group>
         <Group>
-          <GroupName>finsh</GroupName>
+          <GroupName>Kernel</GroupName>
           <Files>
             <File>
-              <FileName>shell.c</FileName>
+              <FileName>clock.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\shell.c</FilePath>
+              <FilePath>..\..\..\src\clock.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>cmd.c</FileName>
+              <FileName>components.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\cmd.c</FilePath>
+              <FilePath>..\..\..\src\components.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh.c</FileName>
+              <FileName>device.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh.c</FilePath>
+              <FilePath>..\..\..\src\device.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>msh_file.c</FileName>
+              <FileName>idle.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh_file.c</FilePath>
+              <FilePath>..\..\..\src\idle.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_compiler.c</FileName>
+              <FileName>ipc.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_compiler.c</FilePath>
+              <FilePath>..\..\..\src\ipc.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_error.c</FileName>
+              <FileName>irq.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_error.c</FilePath>
+              <FilePath>..\..\..\src\irq.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_heap.c</FileName>
+              <FileName>kservice.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_heap.c</FilePath>
+              <FilePath>..\..\..\src\kservice.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_init.c</FileName>
+              <FileName>mem.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_init.c</FilePath>
+              <FilePath>..\..\..\src\mem.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_node.c</FileName>
+              <FileName>mempool.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_node.c</FilePath>
+              <FilePath>..\..\..\src\mempool.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_ops.c</FileName>
+              <FileName>object.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_ops.c</FilePath>
+              <FilePath>..\..\..\src\object.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_parser.c</FileName>
+              <FileName>scheduler.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_parser.c</FilePath>
+              <FilePath>..\..\..\src\scheduler.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_var.c</FileName>
+              <FileName>signal.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_var.c</FilePath>
+              <FilePath>..\..\..\src\signal.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_vm.c</FileName>
+              <FileName>thread.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_vm.c</FilePath>
+              <FilePath>..\..\..\src\thread.c</FilePath>
             </File>
           </Files>
           <Files>
             <File>
-              <FileName>finsh_token.c</FileName>
+              <FileName>timer.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\finsh_token.c</FilePath>
+              <FilePath>..\..\..\src\timer.c</FilePath>
             </File>
           </Files>
         </Group>
@@ -1031,6 +1007,13 @@
               <FilePath>..\..\..\components\libc\compilers\common\time.c</FilePath>
             </File>
           </Files>
+          <Files>
+            <File>
+              <FileName>unistd.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\components\libc\compilers\common\unistd.c</FilePath>
+            </File>
+          </Files>
         </Group>
         <Group>
           <GroupName>Libraries</GroupName>

+ 37 - 5
bsp/ls2kdev/.config

@@ -385,6 +385,8 @@ CONFIG_RT_LWIP_USING_PING=y
 # CONFIG_PKG_USING_AGILE_JSMN 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
 
 #
 # security packages
@@ -410,6 +412,9 @@ CONFIG_RT_LWIP_USING_PING=y
 # CONFIG_PKG_USING_STEMWIN is not set
 # CONFIG_PKG_USING_WAVPLAYER is not set
 # CONFIG_PKG_USING_TJPGD is not set
+# CONFIG_PKG_USING_HELIX is not set
+# CONFIG_PKG_USING_AZUREGUIX is not set
+# CONFIG_PKG_USING_TOUCHGFX2RTT is not set
 
 #
 # tools packages
@@ -424,6 +429,7 @@ CONFIG_RT_LWIP_USING_PING=y
 # 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
@@ -431,6 +437,10 @@ CONFIG_RT_LWIP_USING_PING=y
 # 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
 
 #
 # system packages
@@ -438,12 +448,9 @@ CONFIG_RT_LWIP_USING_PING=y
 # CONFIG_PKG_USING_GUIENGINE is not set
 # CONFIG_PKG_USING_CAIRO is not set
 # CONFIG_PKG_USING_PIXMAN is not set
-CONFIG_PKG_USING_LWEXT4=y
-CONFIG_PKG_LWEXT4_PATH="/packages/system/lwext4"
-CONFIG_RT_USING_DFS_LWEXT4=y
-CONFIG_PKG_USING_LWEXT4_LATEST_VERSION=y
+# CONFIG_PKG_USING_LWEXT4 is not set
+# CONFIG_PKG_USING_LWEXT4_LATEST_VERSION is not set
 # CONFIG_PKG_USING_LWEXT4_V100 is not set
-CONFIG_PKG_LWEXT4_VER="latest"
 # CONFIG_PKG_USING_PARTITION is not set
 # CONFIG_PKG_USING_FAL is not set
 # CONFIG_PKG_USING_FLASHDB is not set
@@ -462,8 +469,18 @@ CONFIG_PKG_LWEXT4_VER="latest"
 # CONFIG_PKG_USING_RAMDISK is not set
 # CONFIG_PKG_USING_MININI is not set
 # CONFIG_PKG_USING_QBOOT 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_PPOOL is not set
+# CONFIG_PKG_USING_OPENAMP is not set
 
 #
 # peripheral libraries and drivers
@@ -517,6 +534,13 @@ CONFIG_PKG_LWEXT4_VER="latest"
 # 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_NES is not set
+# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
+# CONFIG_PKG_USING_VDEVICE is not set
 
 #
 # miscellaneous packages
@@ -526,6 +550,7 @@ CONFIG_PKG_LWEXT4_VER="latest"
 # 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
@@ -546,6 +571,7 @@ CONFIG_PKG_LWEXT4_VER="latest"
 # CONFIG_PKG_USING_PERIPHERAL_SAMPLES 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_NNOM is not set
 # CONFIG_PKG_USING_LIBANN is not set
 # CONFIG_PKG_USING_ELAPACK is not set
@@ -554,8 +580,14 @@ CONFIG_PKG_LWEXT4_VER="latest"
 # CONFIG_PKG_USING_ULAPACK is not set
 # CONFIG_PKG_USING_UKAL is not set
 # CONFIG_PKG_USING_CRCLIB is not set
+
+#
+# games: games run on RT-Thread console
+#
 # 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_LWGPS is not set
 # CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
 CONFIG_SOC_LS2K1000=y

+ 22 - 3
bsp/ls2kdev/README.md

@@ -102,7 +102,7 @@ title   TFTPBOOT
  initrd (wd0,0)/initrd.img
 ```
 
-其中`tftfp://10.1.1.118/rtthread.elf`中的`10.1.1.118`为tftp服务器的ip地址。
+其中`tftp://10.1.1.118/rtthread.elf`中的`10.1.1.118`为tftp服务器的ip地址。
 
 **第三步:**
 
@@ -110,7 +110,25 @@ title   TFTPBOOT
 
 以上三步完成之后,重启系统,就可以省略每次都需要进入pmon的输入命令的麻烦,板子上电后,可以自动从系统TFTP服务器中获取固件,然后启动,大大提高调试代码效率。
 
-## 5. 支持情况
+## 5.SATA接口的SSD文件系统支持
+
+当前已经支持SATA接口的SSD文件系统驱动,需要通过menuconfig
+
+```
+RT-Thread online packages  --->
+	 			system packages  --->
+	 				lwext4: an excellent choice of ext2/3/4 filesystem for microcontrollers
+```
+
+然后输入下面的命令更新软件包
+
+```
+pkgs --update
+```
+
+输入`scons`编译代码即可使用SATA接口的SSD文件系统。
+
+## 6. 支持情况
 
 | 驱动 | 支持情况  |  备注  |
 | ------ | ----  | :------:  |
@@ -120,8 +138,9 @@ title   TFTPBOOT
 | GMAC | 支持 | 网卡驱动 |
 | RTC  | 支持 | - |
 | SPI | 支持 | - |
+| SATA SSD | 支持 | 需要打开lwext4软件包 |
 
-## 6. 联系人信息
+## 7. 联系人信息
 
 维护人:[bernard][4]
 

+ 47 - 0
bsp/ls2kdev/applications/mnt.c

@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-12-29     bigmagic    first version
+ */
+#include <rthw.h>
+#include <rtthread.h>
+
+#ifdef PKG_USING_LWEXT4
+
+#include <dfs.h>
+#include <dfs_fs.h>
+#include <dfs_file.h>
+#include <ext4.h>
+#include <ext4_debug.h>
+#include <blk_device.h>
+#include <stdint.h>
+#include <pci.h>
+
+#define EXT4_DEBUG_ALL  (0xFFFFFFFF)
+#define EXT4_DEBUG_NO   (0)
+
+int mount_ssd(void)
+{
+    struct blk_device *blkdev = (struct blk_device *)rt_device_find("dwc_ahsata_blk");
+
+    if(blkdev == RT_NULL)
+    {
+        rt_kprintf("dwc_ahsata_blk not found!\n");
+        return;
+    }
+    
+    ext4_dmask_set(EXT4_DEBUG_NO);
+    blk_device_init(blkdev);
+    dfs_mount("dwc_ahsata_blk","/","ext",0,(void *)1);
+    dfs_mount("dwc_ahsata_blk","/boot","ext",0,(void *)0);
+
+    return 0;
+}
+
+INIT_ENV_EXPORT(mount_ssd);
+
+#endif

+ 14 - 0
bsp/ls2kdev/drivers/ata/SConscript

@@ -0,0 +1,14 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+
+CPPPATH = [cwd]
+
+if GetDepend('RT_USING_DFS_ELMFAT') == False:
+    SrcRemove(src, 'dwc_ahsata.c')
+    SrcRemove(src, 'libata.c')
+
+group = DefineGroup('Drivers', src, depend = ['PKG_USING_LWEXT4'], CPPPATH = CPPPATH)
+
+Return('group')

+ 281 - 0
bsp/ls2kdev/drivers/ata/ahci.h

@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     porting to ls2k
+ */
+
+#ifndef _AHCI_H_
+#define _AHCI_H_
+
+#define AHCI_PCI_BAR 0x24
+#define AHCI_MAX_SG 56 /* hardware max is 64K */
+#define AHCI_CMD_SLOT_SZ 32
+#define AHCI_MAX_CMD_SLOT 32
+#define AHCI_RX_FIS_SZ 256
+#define AHCI_CMD_TBL_HDR 0x80
+#define AHCI_CMD_TBL_CDB 0x40
+#define AHCI_CMD_TBL_SZ AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16)
+#define AHCI_PORT_PRIV_DMA_SZ (AHCI_CMD_SLOT_SZ * AHCI_MAX_CMD_SLOT + \
+                               AHCI_CMD_TBL_SZ + AHCI_RX_FIS_SZ)
+#define AHCI_CMD_ATAPI (1 << 5)
+#define AHCI_CMD_WRITE (1 << 6)
+#define AHCI_CMD_PREFETCH (1 << 7)
+#define AHCI_CMD_RESET (1 << 8)
+#define AHCI_CMD_CLR_BUSY (1 << 10)
+
+#define RX_FIS_D2H_REG 0x40 /* offset of D2H Register FIS data */
+
+/* Global controller registers */
+#define HOST_CAP 0x00        /* host capabilities */
+#define HOST_CTL 0x04        /* global host control */
+#define HOST_IRQ_STAT 0x08   /* interrupt status */
+#define HOST_PORTS_IMPL 0x0c /* bitmap of implemented ports */
+#define HOST_VERSION 0x10    /* AHCI spec. version compliancy */
+#define HOST_CAP2 0x24       /* host capabilities, extended */
+
+/* HOST_CTL bits */
+#define HOST_RESET (1 << 0)    /* reset controller; self-clear */
+#define HOST_IRQ_EN (1 << 1)   /* global IRQ enable */
+#define HOST_AHCI_EN (1 << 31) /* AHCI enabled */
+
+/* Registers for each SATA port */
+#define PORT_LST_ADDR 0x00    /* command list DMA addr */
+#define PORT_LST_ADDR_HI 0x04 /* command list DMA addr hi */
+#define PORT_FIS_ADDR 0x08    /* FIS rx buf addr */
+#define PORT_FIS_ADDR_HI 0x0c /* FIS rx buf addr hi */
+#define PORT_IRQ_STAT 0x10    /* interrupt status */
+#define PORT_IRQ_MASK 0x14    /* interrupt enable/disable mask */
+#define PORT_CMD 0x18         /* port command */
+#define PORT_TFDATA 0x20      /* taskfile data */
+#define PORT_SIG 0x24         /* device TF signature */
+#define PORT_CMD_ISSUE 0x38   /* command issue */
+#define PORT_SCR 0x28         /* SATA phy register block */
+#define PORT_SCR_STAT 0x28    /* SATA phy register: SStatus */
+#define PORT_SCR_CTL 0x2c     /* SATA phy register: SControl */
+#define PORT_SCR_ERR 0x30     /* SATA phy register: SError */
+#define PORT_SCR_ACT 0x34     /* SATA phy register: SActive */
+
+#ifdef CONFIG_SUNXI_AHCI
+#define PORT_P0DMACR 0x70 /* SUNXI specific "DMA register" */
+#endif
+
+/* PORT_IRQ_{STAT,MASK} bits */
+#define PORT_IRQ_COLD_PRES (1 << 31)     /* cold presence detect */
+#define PORT_IRQ_TF_ERR (1 << 30)        /* task file error */
+#define PORT_IRQ_HBUS_ERR (1 << 29)      /* host bus fatal error */
+#define PORT_IRQ_HBUS_DATA_ERR (1 << 28) /* host bus data error */
+#define PORT_IRQ_IF_ERR (1 << 27)        /* interface fatal error */
+#define PORT_IRQ_IF_NONFATAL (1 << 26)   /* interface non-fatal error */
+#define PORT_IRQ_OVERFLOW (1 << 24)      /* xfer exhausted available S/G */
+#define PORT_IRQ_BAD_PMP (1 << 23)       /* incorrect port multiplier */
+
+#define PORT_IRQ_PHYRDY (1 << 22)     /* PhyRdy changed */
+#define PORT_IRQ_DEV_ILCK (1 << 7)    /* device interlock */
+#define PORT_IRQ_CONNECT (1 << 6)     /* port connect change status */
+#define PORT_IRQ_SG_DONE (1 << 5)     /* descriptor processed */
+#define PORT_IRQ_UNK_FIS (1 << 4)     /* unknown FIS rx'd */
+#define PORT_IRQ_SDB_FIS (1 << 3)     /* Set Device Bits FIS rx'd */
+#define PORT_IRQ_DMAS_FIS (1 << 2)    /* DMA Setup FIS rx'd */
+#define PORT_IRQ_PIOS_FIS (1 << 1)    /* PIO Setup FIS rx'd */
+#define PORT_IRQ_D2H_REG_FIS (1 << 0) /* D2H Register FIS rx'd */
+
+#define PORT_IRQ_FATAL PORT_IRQ_TF_ERR | PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR | PORT_IRQ_IF_ERR
+
+#define DEF_PORT_IRQ PORT_IRQ_FATAL | PORT_IRQ_PHYRDY | PORT_IRQ_CONNECT | PORT_IRQ_SG_DONE | PORT_IRQ_UNK_FIS | PORT_IRQ_SDB_FIS | PORT_IRQ_DMAS_FIS | PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS
+
+/* PORT_SCR_STAT bits */
+#define PORT_SCR_STAT_DET_MASK 0x3
+#define PORT_SCR_STAT_DET_COMINIT 0x1
+#define PORT_SCR_STAT_DET_PHYRDY 0x3
+
+/* PORT_CMD bits */
+#define PORT_CMD_ATAPI (1 << 24)   /* Device is ATAPI */
+#define PORT_CMD_LIST_ON (1 << 15) /* cmd list DMA engine running */
+#define PORT_CMD_FIS_ON (1 << 14)  /* FIS DMA engine running */
+#define PORT_CMD_FIS_RX (1 << 4)   /* Enable FIS receive DMA engine */
+#define PORT_CMD_CLO (1 << 3)      /* Command list override */
+#define PORT_CMD_POWER_ON (1 << 2) /* Power up device */
+#define PORT_CMD_SPIN_UP (1 << 1)  /* Spin up device */
+#define PORT_CMD_START (1 << 0)    /* Enable port DMA engine */
+
+#define PORT_CMD_ICC_ACTIVE (0x1 << 28)  /* Put i/f in active state */
+#define PORT_CMD_ICC_PARTIAL (0x2 << 28) /* Put i/f in partial state */
+#define PORT_CMD_ICC_SLUMBER (0x6 << 28) /* Put i/f in slumber state */
+
+#define AHCI_MAX_PORTS 32
+
+#define ATA_FLAG_SATA (1 << 3)
+#define ATA_FLAG_NO_LEGACY (1 << 4)  /* no legacy mode check */
+#define ATA_FLAG_MMIO (1 << 6)       /* use MMIO, not PIO */
+#define ATA_FLAG_SATA_RESET (1 << 7) /* (obsolete) use COMRESET */
+#define ATA_FLAG_PIO_DMA (1 << 8)    /* PIO cmds via DMA */
+#define ATA_FLAG_NO_ATAPI (1 << 11)  /* No ATAPI support */
+
+struct ahci_cmd_hdr
+{
+    u32 opts;
+    u32 status;
+    u64 tbl_addr;
+    //u32 tbl_addr_hi;
+    u32 reserved[4];
+};
+
+struct ahci_sg
+{
+    u64 addr;
+    //u32 addr_hi;
+    u32 reserved;
+    u32 flags_size;
+};
+
+struct ahci_ioports
+{
+    void __iomem *port_mmio;
+    struct ahci_cmd_hdr *cmd_slot;
+    struct ahci_sg *cmd_tbl_sg;
+    ulong cmd_tbl;
+    u32 rx_fis;
+};
+
+/**
+ * struct ahci_uc_priv - information about an AHCI controller
+ *
+ * When driver model is used, this is accessible using dev_get_uclass_priv(dev)
+ * where dev is the controller (although at present it sometimes stands alone).
+ */
+struct ahci_uc_priv
+{
+    struct rt_device parent;
+    struct ahci_ioports port[AHCI_MAX_PORTS];
+    u16 *ataid[AHCI_MAX_PORTS];
+    u32 n_ports;
+    u32 hard_port_no;
+    u32 host_flags;
+    u32 host_set_flags;
+    void *mmio_base;
+    u32 pio_mask;
+    u32 udma_mask;
+    u32 flags;
+    u32 cap;           /* cache of HOST_CAP register */
+    u32 port_map;      /* cache of HOST_PORTS_IMPL reg */
+    u32 link_port_map; /*linkup port map*/
+};
+
+struct ahci_ops
+{
+    /**
+     * reset() - reset the controller
+     *
+     * @dev:    Controller to reset
+     * @return 0 if OK, -ve on error
+     */
+    int (*reset)(struct rt_device *dev);
+
+    /**
+     * port_status() - get the status of a SATA port
+     *
+     * @dev:    Controller to reset
+     * @port:    Port number to check (0 for first)
+     * @return 0 if detected, -ENXIO if nothing on port, other -ve on error
+     */
+    int (*port_status)(struct rt_device *dev, int port);
+
+    /**
+     * scan() - scan SATA ports
+     *
+     * @dev:    Controller to scan
+     * @return 0 if OK, -ve on error
+     */
+    int (*scan)(struct rt_device *dev);
+};
+
+#define ahci_get_ops(dev) ((struct ahci_ops *)(dev)->driver->ops)
+
+/**
+ * sata_reset() - reset the controller
+ *
+ * @dev:    Controller to reset
+ * @return 0 if OK, -ve on error
+ */
+int sata_reset(struct rt_device *dev);
+
+/**
+ * sata_port_status() - get the status of a SATA port
+ *
+ * @dev:    Controller to reset
+ * @port:    Port number to check (0 for first)
+ * @return 0 if detected, -ENXIO if nothin on port, other -ve on error
+ */
+int sata_dm_port_status(struct rt_device *dev, int port);
+
+/**
+ * sata_scan() - scan SATA ports
+ *
+ * @dev:    Controller to scan
+ * @return 0 if OK, -ve on error
+ */
+int sata_scan(struct rt_device *dev);
+
+int ahci_init(void __iomem *base);
+int ahci_reset(void __iomem *base);
+
+/**
+ * ahci_init_one_dm() - set up a single AHCI port
+ *
+ * @dev: Controller to init
+ */
+int ahci_init_one_dm(struct rt_device *dev);
+
+/**
+ * ahci_start_ports_dm() - start all AHCI ports for a controller
+ *
+ * @dev: Controller containing ports to start
+ */
+int ahci_start_ports_dm(struct rt_device *dev);
+
+/**
+ * ahci_init_dm() - init AHCI for a controller, finding all ports
+ *
+ * @dev: Device to init
+ */
+int ahci_init_dm(struct rt_device *dev, void __iomem *base);
+
+/**
+ * ahci_bind_scsi() - bind a new SCSI bus as a child
+ *
+ * Note that the SCSI bus device will itself bind block devices
+ *
+ * @ahci_dev: AHCI parent device
+ * @devp: Returns new SCSI bus device
+ * @return 0 if OK, -ve on error
+ */
+int ahci_bind_scsi(struct rt_device *ahci_dev, struct rt_device **devp);
+
+/**
+ * ahci_probe_scsi() - probe and scan the attached SCSI bus
+ *
+ * Note that the SCSI device will itself bind block devices for any storage
+ * devices it finds.
+ *
+ * @ahci_dev: AHCI parent device
+ * @base: Base address of AHCI port
+ * @return 0 if OK, -ve on error
+ */
+int ahci_probe_scsi(struct rt_device *ahci_dev, ulong base);
+
+/**
+ * ahci_probe_scsi_pci() - probe and scan the attached SCSI bus on PCI
+ *
+ * Note that the SCSI device will itself bind block devices for any storage
+ * devices it finds.
+ *
+ * @ahci_dev: AHCI parent device
+ * @return 0 if OK, -ve on error
+ */
+int ahci_probe_scsi_pci(struct rt_device *ahci_dev);
+
+#endif

+ 20 - 0
bsp/ls2kdev/drivers/ata/ata_debug.h

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     first version
+ */
+
+#ifndef __ATA_DEBUG_H__
+#define __ATA_DEBUG_H__
+//#define ATA_DEBUG
+#include <rtthread.h>
+#ifdef ATA_DEBUG
+#define debug rt_kprintf
+#else
+#define debug(...)
+#endif
+#endif

+ 101 - 0
bsp/ls2kdev/drivers/ata/ata_interface.h

@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     first version
+ */
+
+#ifndef __ATA_INTERFACE_H__
+#define __ATA_INTERFACE_H__
+
+typedef rt_uint8_t u8;
+typedef rt_uint16_t u16;
+typedef rt_uint32_t u32;
+typedef rt_uint64_t u64;
+typedef rt_uint64_t ulong;
+
+typedef rt_int8_t s8;
+typedef rt_int16_t s16;
+typedef rt_int32_t s32;
+typedef rt_int64_t s64;
+
+typedef rt_size_t lbaint_t;
+
+#define __iomem
+#define mdelay rt_thread_mdelay
+#define udelay(...) rt_thread_mdelay(1)
+
+#define cpu_to_le32
+#define cpu_to_le16
+#define le32_to_cpu
+#define le16_to_cpu
+
+#define flush_cache(...)
+#define invalidate_dcache_range(...)
+
+#define ARCH_DMA_MINALIGN 1024
+
+#define CONFIG_IS_ENABLED
+#define AHCI 1
+
+#define VADDR_TO_PHY(vaddr) (((u64)vaddr) - KSEG0BASE)
+#define LOW_PHY(vaddr) ((u32)VADDR_TO_PHY(vaddr))
+#define HIGH_PHY(vaddr) ((u32)((VADDR_TO_PHY(vaddr)) >> 32))
+
+#define ALIGN_1(x, a) __ALIGN_MASK((x), (typeof(x))(a)-1)
+#define ALIGN_DOWN(x, a) ALIGN_1((x) - ((a)-1), (a))
+#define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
+#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a)-1)) == 0)
+
+#define ROUND(a, b) (((a) + (b)-1) & ~((b)-1))
+
+#define PAD_COUNT(s, pad) (((s)-1) / (pad) + 1)
+#define PAD_SIZE(s, pad) (PAD_COUNT(s, pad) * pad)
+#define ALLOC_ALIGN_BUFFER_PAD(type, name, size, align, pad)                         \
+    char __##name[ROUND(PAD_SIZE((size) * sizeof(type), pad), align) + (align - 1)]; \
+                                                                                     \
+    type *name = (type *)ALIGN_1((rt_ubase_t)__##name, align)
+#define ALLOC_ALIGN_BUFFER(type, name, size, align) \
+    ALLOC_ALIGN_BUFFER_PAD(type, name, size, align, 1)
+#define ALLOC_CACHE_ALIGN_BUFFER_PAD(type, name, size, pad) \
+    ALLOC_ALIGN_BUFFER_PAD(type, name, size, ARCH_DMA_MINALIGN, pad)
+#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \
+    ALLOC_ALIGN_BUFFER(type, name, size, ARCH_DMA_MINALIGN)
+
+static inline u32 readl(void *addr)
+{
+    return *((u32 *)addr);
+}
+
+static inline void writel(u32 data, void *addr)
+{
+    *((u32 *)addr) = data;
+}
+
+static inline int ffs(int word)
+{
+    int r;
+
+    if (word == 0)
+    {
+        return 0;
+    }
+
+    word &= (-word);
+
+    __asm__("clz %0, %1"
+            : "=r"(r)
+            : "r"(word));
+    return 32 - r;
+}
+
+static inline void setbits_le32(u32 *addr, u32 value)
+{
+    *addr = value;
+}
+
+#endif

+ 127 - 0
bsp/ls2kdev/drivers/ata/blk_device.c

@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     first version
+ */
+
+#include <rtthread.h>
+#include <rtdef.h>
+#include <dfs.h>
+#include <dfs_fs.h>
+#include <dfs_file.h>
+#include <ext4.h>
+#include <ext4_debug.h>
+#include <blk_device.h>
+#include <stdint.h>
+
+static struct blk_device *blkdev;
+static rt_uint32_t disk_sector_size;
+
+static int blockdev_open(struct ext4_blockdev *bdev)
+{
+    int r;
+    uint32_t size;
+    rt_device_t device = (rt_device_t)blkdev;
+    struct rt_device_blk_geometry geometry;
+
+    RT_ASSERT(device);
+
+    r = rt_device_open((rt_device_t)blkdev, RT_DEVICE_OFLAG_RDWR);
+
+    if (r != RT_EOK)
+    {
+        return r;
+    }
+
+    r = rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);
+
+    if (RT_EOK == r)
+    {
+        bdev->part_offset = 0;
+        bdev->part_size = geometry.sector_count * geometry.bytes_per_sector;
+        disk_sector_size = geometry.bytes_per_sector;
+        bdev->bdif->ph_bcnt = bdev->part_size / bdev->bdif->ph_bsize;
+    }
+
+    return r;
+}
+
+static int blockdev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
+                          uint32_t blk_cnt)
+{
+    int result;
+    rt_device_t device = (rt_device_t)blkdev;
+    struct blk_device *blk = (struct blk_device *)device;
+    RT_ASSERT(device);
+
+    result = rt_device_read(device, blk_id * (bdev->bdif->ph_bsize / disk_sector_size),
+                            buf, blk_cnt * (bdev->bdif->ph_bsize / disk_sector_size));
+
+    if ((blk_cnt * (bdev->bdif->ph_bsize / disk_sector_size)) == result)
+    {
+        result = 0;
+    }
+    else
+    {
+        result = -EIO;
+    }
+
+    return result;
+}
+
+static int blockdev_bwrite(struct ext4_blockdev *bdev, const void *buf,
+                           uint64_t blk_id, uint32_t blk_cnt)
+{
+    int result;
+    rt_device_t device = (rt_device_t)blkdev;
+
+    RT_ASSERT(device);
+
+    result = rt_device_write(device, blk_id * (bdev->bdif->ph_bsize / disk_sector_size),
+                             buf, blk_cnt * (bdev->bdif->ph_bsize / disk_sector_size));
+
+    if ((blk_cnt * (bdev->bdif->ph_bsize / disk_sector_size)) == result)
+    {
+        result = 0;
+    }
+    else
+    {
+        result = -EIO;
+    }
+
+    return result;
+}
+
+static int blockdev_close(struct ext4_blockdev *bdev)
+{
+    return rt_device_close((rt_device_t)blkdev);
+}
+
+static int blockdev_lock(struct ext4_blockdev *bdev)
+{
+    return 0;
+}
+
+static int blockdev_unlock(struct ext4_blockdev *bdev)
+{
+    return 0;
+}
+
+EXT4_BLOCKDEV_STATIC_INSTANCE(bdev, 4096, 0, blockdev_open,
+                              blockdev_bread, blockdev_bwrite, blockdev_close,
+                              blockdev_lock, blockdev_unlock);
+
+void blk_device_init(struct blk_device *blk_devices)
+{
+    blkdev = blk_devices;
+
+    if (ext4_mbr_scan(&bdev, &(blkdev->ext4_partition)) != EOK)
+    {
+        rt_kprintf("MBR scan failed!\n");
+        return;
+    }
+}

+ 48 - 0
bsp/ls2kdev/drivers/ata/blk_device.h

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     first version
+ */
+
+#ifndef __BLK_DEVICE_H__
+#define __BLK_DEVICE_H__
+
+#include <rtconfig.h>
+#include <ext4_mbr.h>
+
+#define DEV_TYPE_UNKNOWN 0xff  /* not connected */
+#define DEV_TYPE_HARDDISK 0x00 /* harddisk */
+#define DEV_TYPE_TAPE 0x01     /* Tape */
+#define DEV_TYPE_CDROM 0x05    /* CD-ROM */
+#define DEV_TYPE_OPDISK 0x07   /* optical disk */
+
+struct blk_device
+{
+    struct rt_device parent;
+    struct ahci_uc_priv *ahci_device;
+
+    rt_uint8_t target;
+    rt_uint8_t lun;
+    rt_uint8_t type;
+
+#ifdef RT_USING_DFS_LWEXT4
+    struct ext4_mbr_bdevs ext4_partition;
+#endif
+
+    rt_bool_t lba48;
+    rt_uint64_t lba;
+    rt_uint64_t blksz;
+    rt_int32_t log2blksz;
+
+    char product[21];
+    char revision[9];
+    char vendor[41];
+};
+
+void blk_device_init(struct blk_device *blk_devices);
+
+#endif

+ 1234 - 0
bsp/ls2kdev/drivers/ata/dwc_ahsata.c

@@ -0,0 +1,1234 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     porting to ls2k
+ */
+
+#include <rtthread.h>
+#include <rtdef.h>
+#include <mips_addrspace.h>
+#include <ata_interface.h>
+#include <ahci.h>
+#include <dwc_ahsata.h>
+#include <fis.h>
+#include <libata.h>
+#include <ata_debug.h>
+#include <blk_device.h>
+#include "dwc_ahsata_priv.h"
+
+struct sata_port_regs
+{
+    u32 clb;
+    u32 clbu;
+    u32 fb;
+    u32 fbu;
+    u32 is;
+    u32 ie;
+    u32 cmd;
+    u32 res1[1];
+    u32 tfd;
+    u32 sig;
+    u32 ssts;
+    u32 sctl;
+    u32 serr;
+    u32 sact;
+    u32 ci;
+    u32 sntf;
+    u32 res2[1];
+    u32 dmacr;
+    u32 res3[1];
+    u32 phycr;
+    u32 physr;
+};
+
+struct sata_host_regs
+{
+    u32 cap;
+    u32 ghc;
+    u32 is;
+    u32 pi;
+    u32 vs;
+    u32 ccc_ctl;
+    u32 ccc_ports;
+    u32 res1[2];
+    u32 cap2;
+    u32 res2[30];
+    u32 bistafr;
+    u32 bistcr;
+    u32 bistfctr;
+    u32 bistsr;
+    u32 bistdecr;
+    u32 res3[2];
+    u32 oobr;
+    u32 res4[8];
+    u32 timer1ms;
+    u32 res5[1];
+    u32 gparam1r;
+    u32 gparam2r;
+    u32 pparamr;
+    u32 testr;
+    u32 versionr;
+    u32 idr;
+};
+
+#define MAX_DATA_BYTES_PER_SG (4 * 1024 * 1024)
+#define MAX_BYTES_PER_TRANS (AHCI_MAX_SG * MAX_DATA_BYTES_PER_SG)
+
+#define writel_with_flush(a, b) \
+    do                          \
+    {                           \
+        writel(a, b);           \
+        readl(b);               \
+    } while (0)
+
+static inline void __iomem *ahci_port_base(void __iomem *base, u32 port)
+{
+    return base + 0x100 + (port * 0x80);
+}
+
+static int waiting_for_cmd_completed(u8 *offset, int timeout_msec, u32 sign)
+{
+    int i;
+    u32 status;
+
+    for (i = 0; ((status = readl(offset)) & sign) && i < timeout_msec; i++)
+    {
+        mdelay(1);
+    }
+
+    return (i < timeout_msec) ? 0 : -1;
+}
+
+static int ahci_setup_oobr(struct ahci_uc_priv *uc_priv, int clk)
+{
+    struct sata_host_regs *host_mmio = uc_priv->mmio_base;
+
+    writel(SATA_HOST_OOBR_WE, &host_mmio->oobr);
+    writel(0x02060b14, &host_mmio->oobr);
+
+    return 0;
+}
+
+int ahci_host_init(struct ahci_uc_priv *uc_priv)
+{
+    u32 tmp, cap_save, num_ports;
+    int i, j, timeout = 1000;
+    struct sata_port_regs *port_mmio = NULL;
+    struct sata_host_regs *host_mmio = uc_priv->mmio_base;
+
+    //prepare to enable staggered spin-up
+    cap_save = readl(&host_mmio->cap);
+    cap_save |= SATA_HOST_CAP_SSS;
+
+    /* global controller reset */
+    tmp = readl(&host_mmio->ghc);
+
+    //ahsata controller reset
+    if ((tmp & SATA_HOST_GHC_HR) == 0)
+    {
+        writel_with_flush(tmp | SATA_HOST_GHC_HR, &host_mmio->ghc);
+    }
+
+    //wait for reset finishing
+    while ((readl(&host_mmio->ghc) & SATA_HOST_GHC_HR) && --timeout)
+        ;
+
+    //reset timeout
+    if (timeout <= 0)
+    {
+        debug("controller reset failed (0x%x)\n", tmp);
+        return -1;
+    }
+
+    /* Set timer 1ms @ 100MHz*/
+    writel(100000000 / 1000, &host_mmio->timer1ms);
+
+    ahci_setup_oobr(uc_priv, 0);
+
+    //enable ahci
+    writel_with_flush(SATA_HOST_GHC_AE, &host_mmio->ghc);
+
+    //enable staggered spin-up
+    writel(cap_save, &host_mmio->cap);
+
+    //get sata port number
+    num_ports = (cap_save & SATA_HOST_CAP_NP_MASK) + 1;
+
+    //initialize pi register to set correct port number
+    writel_with_flush((1 << num_ports) - 1, &host_mmio->pi);
+
+    /*
+     * Determine which Ports are implemented by the DWC_ahsata,
+     * by reading the PI register. This bit map value aids the
+     * software to determine how many Ports are available and
+     * which Port registers need to be initialized.
+     */
+    uc_priv->cap = readl(&host_mmio->cap);
+    uc_priv->port_map = readl(&host_mmio->pi);
+
+    /* Determine how many command slots the HBA supports */
+    uc_priv->n_ports = (uc_priv->cap & SATA_HOST_CAP_NP_MASK) + 1;
+
+    debug("cap 0x%x  port_map 0x%x  n_ports %d\n",
+          uc_priv->cap, uc_priv->port_map, uc_priv->n_ports);
+
+    for (i = 0; i < uc_priv->n_ports; i++)
+    {
+        uc_priv->port[i].port_mmio = ahci_port_base(host_mmio, i);
+        port_mmio = uc_priv->port[i].port_mmio;
+
+        /* Ensure that the DWC_ahsata is in idle state */
+        tmp = readl(&port_mmio->cmd);
+
+        /*
+         * When P#CMD.ST, P#CMD.CR, P#CMD.FRE and P#CMD.FR
+         * are all cleared, the Port is in an idle state.
+         */
+        if (tmp & (SATA_PORT_CMD_CR | SATA_PORT_CMD_FR |
+                   SATA_PORT_CMD_FRE | SATA_PORT_CMD_ST))
+        {
+
+            /*
+             * System software places a Port into the idle state by
+             * clearing P#CMD.ST and waiting for P#CMD.CR to return
+             * 0 when read.
+             */
+            tmp &= ~SATA_PORT_CMD_ST;
+            writel_with_flush(tmp, &port_mmio->cmd);
+
+            /*
+             * spec says 500 msecs for each bit, so
+             * this is slightly incorrect.
+             */
+            mdelay(500);
+
+            timeout = 1000;
+            while ((readl(&port_mmio->cmd) & SATA_PORT_CMD_CR) && --timeout)
+                ;
+
+            if (timeout <= 0)
+            {
+                debug("port reset failed (0x%x)\n", tmp);
+                return -1;
+            }
+        }
+
+        /* Spin-up device */
+        tmp = readl(&port_mmio->cmd);
+        writel((tmp | SATA_PORT_CMD_SUD), &port_mmio->cmd);
+
+        /* Wait for spin-up to finish */
+        timeout = 1000;
+        while (!(readl(&port_mmio->cmd) | SATA_PORT_CMD_SUD) && --timeout)
+            ;
+
+        if (timeout <= 0)
+        {
+            debug("Spin-Up can't finish!\n");
+            return -1;
+        }
+
+        for (j = 0; j < 100; ++j)
+        {
+            mdelay(10);
+            tmp = readl(&port_mmio->ssts);
+            if (((tmp & SATA_PORT_SSTS_DET_MASK) == 0x3) ||
+                ((tmp & SATA_PORT_SSTS_DET_MASK) == 0x1))
+            {
+                break;
+            }
+        }
+
+        /* Wait for COMINIT bit 26 (DIAG_X) in SERR */
+        timeout = 1000;
+        while (!(readl(&port_mmio->serr) & SATA_PORT_SERR_DIAG_X) && --timeout)
+            ;
+
+        if (timeout <= 0)
+        {
+            debug("Can't find DIAG_X set!\n");
+            return -1;
+        }
+
+        /*
+         * For each implemented Port, clear the P#SERR
+         * register, by writing ones to each implemented\
+         * bit location.
+         */
+        tmp = readl(&port_mmio->serr);
+        debug("P#SERR 0x%x\n",
+              tmp);
+        writel(tmp, &port_mmio->serr);
+
+        /* Ack any pending irq events for this port */
+        tmp = readl(&host_mmio->is);
+        debug("IS 0x%x\n", tmp);
+        if (tmp)
+        {
+            writel(tmp, &host_mmio->is);
+        }
+
+        writel(1 << i, &host_mmio->is);
+
+        /* set irq mask (enables interrupts) */
+        writel(DEF_PORT_IRQ, &port_mmio->ie);
+
+        /* register linkup ports */
+        tmp = readl(&port_mmio->ssts);
+        debug("Port %d status: 0x%x\n", i, tmp);
+        if ((tmp & SATA_PORT_SSTS_DET_MASK) == 0x03)
+        {
+            uc_priv->link_port_map |= (0x01 << i);
+        }
+    }
+
+    tmp = readl(&host_mmio->ghc);
+    debug("GHC 0x%x\n", tmp);
+    //Interrupt Enable
+    writel(tmp | SATA_HOST_GHC_IE, &host_mmio->ghc);
+    tmp = readl(&host_mmio->ghc);
+    debug("GHC 0x%x\n", tmp);
+
+    return 0;
+}
+
+int rt_hw_ahci_host_init()
+{
+    struct ahci_uc_priv *ahci_device;
+    ahci_device = (struct ahci_uc_priv *)rt_device_create(RT_Device_Class_Miscellaneous, sizeof(struct ahci_uc_priv) - sizeof(struct rt_device));
+
+    ahci_device->mmio_base = (void *)DWCAHSATA_BASE;
+    ahci_device->parent.init = NULL;
+    ahci_device->parent.open = NULL;
+    ahci_device->parent.close = NULL;
+    ahci_device->parent.read = NULL;
+    ahci_device->parent.write = NULL;
+    ahci_device->parent.control = NULL;
+
+    if (rt_device_register((rt_device_t)ahci_device, "dwc_ahsata_ahci", 0) != RT_EOK)
+    {
+        rt_kprintf("dwc_ahsata_ahci device register failed!\n");
+        return -RT_ERROR;
+    }
+
+    if (dwc_ahsata_probe((rt_device_t)ahci_device) != 0)
+    {
+        rt_kprintf("ahci probe failed!\n");
+        return -RT_ERROR;
+    }
+
+    if (dwc_ahsata_scan((rt_device_t)ahci_device) != 0)
+    {
+        rt_kprintf("ahci host sata device scan failed!\n");
+        return -RT_ERROR;
+    }
+
+    return RT_EOK;
+}
+INIT_COMPONENT_EXPORT(rt_hw_ahci_host_init);
+
+static void ahci_print_info(struct ahci_uc_priv *uc_priv)
+{
+    struct sata_host_regs *host_mmio = uc_priv->mmio_base;
+    u32 vers, cap, impl, speed;
+    const char *speed_s;
+    const char *scc_s;
+
+    vers = readl(&host_mmio->vs);
+    cap = uc_priv->cap;
+    impl = uc_priv->port_map;
+
+    speed = (cap & SATA_HOST_CAP_ISS_MASK) >> SATA_HOST_CAP_ISS_OFFSET;
+
+    if (speed == 1)
+    {
+        speed_s = "1.5";
+    }
+    else if (speed == 2)
+    {
+        speed_s = "3";
+    }
+    else
+    {
+        speed_s = "?";
+    }
+
+    scc_s = "SATA";
+
+    rt_kprintf("AHCI %02x%02x.%02x%02x "
+               "%u slots %u ports %s Gbps 0x%x impl %s mode\n",
+               (vers >> 24) & 0xff,
+               (vers >> 16) & 0xff,
+               (vers >> 8) & 0xff,
+               vers & 0xff,
+               ((cap >> 8) & 0x1f) + 1,
+               (cap & 0x1f) + 1,
+               speed_s,
+               impl,
+               scc_s);
+
+    rt_kprintf("flags: "
+               "%s%s%s%s%s%s"
+               "%s%s%s%s%s%s%s\n",
+               cap & (1 << 31) ? "64bit " : "",
+               cap & (1 << 30) ? "ncq " : "",
+               cap & (1 << 28) ? "ilck " : "",
+               cap & (1 << 27) ? "stag " : "",
+               cap & (1 << 26) ? "pm " : "",
+               cap & (1 << 25) ? "led " : "",
+               cap & (1 << 24) ? "clo " : "",
+               cap & (1 << 19) ? "nz " : "",
+               cap & (1 << 18) ? "only " : "",
+               cap & (1 << 17) ? "pmp " : "",
+               cap & (1 << 15) ? "pio " : "",
+               cap & (1 << 14) ? "slum " : "",
+               cap & (1 << 13) ? "part " : "");
+
+    rt_kprintf("version = %08x\n", ((struct sata_host_regs *)(uc_priv->mmio_base))->versionr);
+}
+
+static int ahci_fill_sg(struct ahci_uc_priv *uc_priv, u8 port,
+                        unsigned char *buf, int buf_len)
+{
+    struct ahci_ioports *pp = &uc_priv->port[port];
+    struct ahci_sg *ahci_sg = pp->cmd_tbl_sg;
+    u32 sg_count, max_bytes;
+    int i;
+
+    max_bytes = MAX_DATA_BYTES_PER_SG;
+    sg_count = ((buf_len - 1) / max_bytes) + 1;
+
+    if (sg_count > AHCI_MAX_SG)
+    {
+        rt_kprintf("Error:Too much sg!\n");
+        return -1;
+    }
+
+    for (i = 0; i < sg_count; i++)
+    {
+        ahci_sg->addr = VADDR_TO_PHY(buf + i * max_bytes);
+        //ahci_sg->addr_hi = 0;
+        ahci_sg->flags_size = cpu_to_le32(0x3fffff &
+                                          (buf_len < max_bytes
+                                               ? (buf_len - 1)
+                                               : (max_bytes - 1)));
+        ahci_sg++;
+        buf_len -= max_bytes;
+    }
+
+    return sg_count;
+}
+
+static void ahci_fill_cmd_slot(struct ahci_ioports *pp, u32 cmd_slot, u32 opts)
+{
+    struct ahci_cmd_hdr *cmd_hdr = (struct ahci_cmd_hdr *)(pp->cmd_slot +
+                                                           AHCI_CMD_SLOT_SZ * cmd_slot);
+
+    memset(cmd_hdr, 0, AHCI_CMD_SLOT_SZ);
+    cmd_hdr->opts = cpu_to_le32(opts);
+    cmd_hdr->status = 0;
+    pp->cmd_slot->tbl_addr = VADDR_TO_PHY(pp->cmd_tbl);
+    /*#ifdef CONFIG_PHYS_64BIT
+    pp->cmd_slot->tbl_addr_hi =
+        cpu_to_le32((u32)(((pp->cmd_tbl) >> 16) >> 16));
+#endif*/
+}
+
+#define AHCI_GET_CMD_SLOT(c) ((c) ? ffs(c) : 0)
+
+static int ahci_exec_ata_cmd(struct ahci_uc_priv *uc_priv, u8 port,
+                             struct sata_fis_h2d *cfis, u8 *buf, u32 buf_len,
+                             s32 is_write)
+{
+    struct ahci_ioports *pp = &uc_priv->port[port];
+    struct sata_port_regs *port_mmio = pp->port_mmio;
+    u32 opts;
+    int sg_count = 0, cmd_slot = 0;
+
+    cmd_slot = AHCI_GET_CMD_SLOT(readl(&port_mmio->ci));
+
+    if (32 == cmd_slot)
+    {
+        rt_kprintf("Can't find empty command slot!\n");
+        return 0;
+    }
+
+    /* Check xfer length */
+    if (buf_len > MAX_BYTES_PER_TRANS)
+    {
+        rt_kprintf("Max transfer length is %dB\n\r",
+                   MAX_BYTES_PER_TRANS);
+        return 0;
+    }
+
+    memcpy((u8 *)(pp->cmd_tbl), cfis, sizeof(struct sata_fis_h2d));
+
+    if (buf && buf_len)
+    {
+        sg_count = ahci_fill_sg(uc_priv, port, buf, buf_len);
+    }
+
+    opts = (sizeof(struct sata_fis_h2d) >> 2) | (sg_count << 16);
+
+    if (is_write)
+    {
+        opts |= 0x40;
+        flush_cache((ulong)buf, buf_len);
+    }
+
+    ahci_fill_cmd_slot(pp, cmd_slot, opts);
+
+    flush_cache((int)(pp->cmd_slot), AHCI_PORT_PRIV_DMA_SZ);
+    writel_with_flush(1 << cmd_slot, &port_mmio->ci);
+
+    if (waiting_for_cmd_completed((u8 *)&port_mmio->ci, 10000,
+                                  0x1 << cmd_slot))
+    {
+        rt_kprintf("timeout exit!\n");
+        return -1;
+    }
+
+    invalidate_dcache_range((int)(pp->cmd_slot),
+                            (int)(pp->cmd_slot) + AHCI_PORT_PRIV_DMA_SZ);
+
+    debug("ahci_exec_ata_cmd: %d byte transferred.\n",
+          pp->cmd_slot->status);
+
+    if (!is_write)
+    {
+        invalidate_dcache_range((ulong)buf, (ulong)buf + buf_len);
+    }
+
+    return buf_len;
+}
+
+static void ahci_set_feature(struct ahci_uc_priv *uc_priv, u8 port)
+{
+    struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN);
+    struct sata_fis_h2d *cfis = &h2d;
+
+    memset(cfis, 0, sizeof(struct sata_fis_h2d));
+    cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+    cfis->pm_port_c = 1 << 7;
+    cfis->command = ATA_CMD_SET_FEATURES;
+    cfis->features = SETFEATURES_XFER;
+    cfis->sector_count = ffs(uc_priv->udma_mask + 1) + 0x3e;
+
+    ahci_exec_ata_cmd(uc_priv, port, cfis, NULL, 0, READ_CMD);
+}
+
+static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
+{
+    struct ahci_ioports *pp = &uc_priv->port[port];
+    struct sata_port_regs *port_mmio = pp->port_mmio;
+    u32 port_status;
+    u64 mem;
+    int timeout = 10000000;
+
+    debug("Enter start port: %d\n", port);
+    port_status = readl(&port_mmio->ssts);
+    debug("Port %d status: %x\n", port, port_status);
+
+    if ((port_status & 0xf) != 0x03)
+    {
+        rt_kprintf("No Link on this port!\n");
+        return -1;
+    }
+
+    mem = (u64)malloc(AHCI_PORT_PRIV_DMA_SZ + 1024);
+
+    if (!mem)
+    {
+        rt_kprintf("No mem for table!\n");
+        return -ENOMEM;
+    }
+
+    mem = (mem + 0x400) & (~0x3ff); /* Aligned to 1024-bytes */
+    memset((u8 *)mem, 0, AHCI_PORT_PRIV_DMA_SZ);
+
+    /*
+     * First item in chunk of DMA memory: 32-slot command table,
+     * 32 bytes each in size
+     */
+    pp->cmd_slot = (struct ahci_cmd_hdr *)mem;
+    debug("cmd_slot = 0x%p\n", pp->cmd_slot);
+    mem += (AHCI_CMD_SLOT_SZ * DWC_AHSATA_MAX_CMD_SLOTS);
+
+    /*
+     * Second item: Received-FIS area, 256-Byte aligned
+     */
+    pp->rx_fis = mem;
+    mem += AHCI_RX_FIS_SZ;
+
+    /*
+     * Third item: data area for storing a single command
+     * and its scatter-gather table
+     */
+    pp->cmd_tbl = mem;
+    debug("cmd_tbl_dma = 0x%lx\n", pp->cmd_tbl);
+
+    mem += AHCI_CMD_TBL_HDR;
+
+    writel_with_flush(0x00004444, &port_mmio->dmacr);
+    pp->cmd_tbl_sg = (struct ahci_sg *)mem;
+    writel_with_flush(LOW_PHY(pp->cmd_slot), &port_mmio->clb);
+    writel_with_flush(HIGH_PHY(pp->cmd_slot), &port_mmio->clbu);
+    writel_with_flush(LOW_PHY(pp->rx_fis), &port_mmio->fb);
+    writel_with_flush(HIGH_PHY(pp->rx_fis), &port_mmio->fbu);
+
+    /* Enable FRE */
+    writel_with_flush((SATA_PORT_CMD_FRE | readl(&port_mmio->cmd)),
+                      &port_mmio->cmd);
+
+    /* Wait device ready */
+    while ((readl(&port_mmio->tfd) & (SATA_PORT_TFD_STS_ERR |
+                                      SATA_PORT_TFD_STS_DRQ | SATA_PORT_TFD_STS_BSY)) &&
+           --timeout)
+        ;
+    if (timeout <= 0)
+    {
+        debug("Device not ready for BSY, DRQ and"
+              "ERR in TFD!\n");
+        return -1;
+    }
+
+    writel_with_flush(PORT_CMD_ICC_ACTIVE | PORT_CMD_FIS_RX |
+                          PORT_CMD_POWER_ON | PORT_CMD_SPIN_UP |
+                          PORT_CMD_START,
+                      &port_mmio->cmd);
+
+    debug("Exit start port %d\n", port);
+
+    return 0;
+}
+
+static void dwc_ahsata_print_info(struct blk_device *pdev)
+{
+    rt_kprintf("SATA Device Info:\n\r");
+    rt_kprintf("S/N: %s\n\rProduct model number: %s\n\r"
+               "Firmware version: %s\n\rCapacity: %lu sectors\n\r",
+               pdev->product, pdev->vendor, pdev->revision, pdev->lba);
+}
+
+static void dwc_ahsata_identify(struct ahci_uc_priv *uc_priv, u16 *id)
+{
+    struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN);
+    struct sata_fis_h2d *cfis = &h2d;
+    u8 port = uc_priv->hard_port_no;
+
+    memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+    cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+    cfis->pm_port_c = 0x80; /* is command */
+    cfis->command = ATA_CMD_ID_ATA;
+
+    ahci_exec_ata_cmd(uc_priv, port, cfis, (u8 *)id, ATA_ID_WORDS * 2,
+                      READ_CMD);
+    ata_swap_buf_le16(id, ATA_ID_WORDS);
+}
+
+static void dwc_ahsata_xfer_mode(struct ahci_uc_priv *uc_priv, u16 *id)
+{
+    uc_priv->pio_mask = id[ATA_ID_PIO_MODES];
+    uc_priv->udma_mask = id[ATA_ID_UDMA_MODES];
+    debug("pio %04x, udma %04x\n\r", uc_priv->pio_mask, uc_priv->udma_mask);
+}
+
+static u32 dwc_ahsata_rw_cmd(struct ahci_uc_priv *uc_priv, u32 start,
+                             u32 blkcnt, u8 *buffer, int is_write)
+{
+    struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN);
+    struct sata_fis_h2d *cfis = &h2d;
+    u8 port = uc_priv->hard_port_no;
+    u32 block;
+
+    block = start;
+
+    memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+    cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+    cfis->pm_port_c = 0x80; /* is command */
+    cfis->command = (is_write) ? ATA_CMD_WRITE : ATA_CMD_READ;
+    cfis->device = ATA_LBA;
+
+    cfis->device |= (block >> 24) & 0xf;
+    cfis->lba_high = (block >> 16) & 0xff;
+    cfis->lba_mid = (block >> 8) & 0xff;
+    cfis->lba_low = block & 0xff;
+    cfis->sector_count = (u8)(blkcnt & 0xff);
+
+    if (ahci_exec_ata_cmd(uc_priv, port, cfis, buffer,
+                          ATA_SECT_SIZE * blkcnt, is_write) > 0)
+        return blkcnt;
+    else
+        return 0;
+}
+
+static void dwc_ahsata_flush_cache(struct ahci_uc_priv *uc_priv)
+{
+    struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN);
+    struct sata_fis_h2d *cfis = &h2d;
+    u8 port = uc_priv->hard_port_no;
+
+    memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+    cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+    cfis->pm_port_c = 0x80; /* is command */
+    cfis->command = ATA_CMD_FLUSH;
+
+    ahci_exec_ata_cmd(uc_priv, port, cfis, NULL, 0, 0);
+}
+
+static u32 dwc_ahsata_rw_cmd_ext(struct ahci_uc_priv *uc_priv, u32 start,
+                                 lbaint_t blkcnt, u8 *buffer, int is_write)
+{
+    struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN);
+    struct sata_fis_h2d *cfis = &h2d;
+    u8 port = uc_priv->hard_port_no;
+    u64 block;
+
+    block = (u64)start;
+
+    memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+    cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+    cfis->pm_port_c = 0x80; /* is command */
+
+    cfis->command = (is_write) ? ATA_CMD_WRITE_EXT
+                               : ATA_CMD_READ_EXT;
+
+    cfis->lba_high_exp = (block >> 40) & 0xff;
+    cfis->lba_mid_exp = (block >> 32) & 0xff;
+    cfis->lba_low_exp = (block >> 24) & 0xff;
+    cfis->lba_high = (block >> 16) & 0xff;
+    cfis->lba_mid = (block >> 8) & 0xff;
+    cfis->lba_low = block & 0xff;
+    cfis->device = ATA_LBA;
+    cfis->sector_count_exp = (blkcnt >> 8) & 0xff;
+    cfis->sector_count = blkcnt & 0xff;
+
+    if (ahci_exec_ata_cmd(uc_priv, port, cfis, buffer,
+                          ATA_SECT_SIZE * blkcnt, is_write) > 0)
+        return blkcnt;
+    else
+        return 0;
+}
+
+static void dwc_ahsata_flush_cache_ext(struct ahci_uc_priv *uc_priv)
+{
+    struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN);
+    struct sata_fis_h2d *cfis = &h2d;
+    u8 port = uc_priv->hard_port_no;
+
+    memset(cfis, 0, sizeof(struct sata_fis_h2d));
+
+    cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
+    cfis->pm_port_c = 0x80; /* is command */
+    cfis->command = ATA_CMD_FLUSH_EXT;
+
+    ahci_exec_ata_cmd(uc_priv, port, cfis, NULL, 0, 0);
+}
+
+static void dwc_ahsata_init_wcache(struct ahci_uc_priv *uc_priv, u16 *id)
+{
+    if (ata_id_has_wcache(id) && ata_id_wcache_enabled(id))
+        uc_priv->flags |= SATA_FLAG_WCACHE;
+    if (ata_id_has_flush(id))
+        uc_priv->flags |= SATA_FLAG_FLUSH;
+    if (ata_id_has_flush_ext(id))
+        uc_priv->flags |= SATA_FLAG_FLUSH_EXT;
+}
+
+static u32 ata_low_level_rw_lba48(struct ahci_uc_priv *uc_priv, u32 blknr,
+                                  lbaint_t blkcnt, const void *buffer,
+                                  int is_write)
+{
+    u32 start, blks;
+    u8 *addr;
+    int max_blks;
+
+    start = blknr;
+    blks = blkcnt;
+    addr = (u8 *)buffer;
+
+    max_blks = ATA_MAX_SECTORS_LBA48;
+
+    do
+    {
+        if (blks > max_blks)
+        {
+            if (max_blks != dwc_ahsata_rw_cmd_ext(uc_priv, start,
+                                                  max_blks, addr,
+                                                  is_write))
+                return 0;
+            start += max_blks;
+            blks -= max_blks;
+            addr += ATA_SECT_SIZE * max_blks;
+        }
+        else
+        {
+            if (blks != dwc_ahsata_rw_cmd_ext(uc_priv, start, blks,
+                                              addr, is_write))
+                return 0;
+            start += blks;
+            blks = 0;
+            addr += ATA_SECT_SIZE * blks;
+        }
+    } while (blks != 0);
+
+    return blkcnt;
+}
+
+static u32 ata_low_level_rw_lba28(struct ahci_uc_priv *uc_priv, u32 blknr,
+                                  lbaint_t blkcnt, const void *buffer,
+                                  int is_write)
+{
+    u32 start, blks;
+    u8 *addr;
+    int max_blks;
+
+    start = blknr;
+    blks = blkcnt;
+    addr = (u8 *)buffer;
+
+    max_blks = ATA_MAX_SECTORS;
+    do
+    {
+        if (blks > max_blks)
+        {
+            if (max_blks != dwc_ahsata_rw_cmd(uc_priv, start,
+                                              max_blks, addr,
+                                              is_write))
+                return 0;
+            start += max_blks;
+            blks -= max_blks;
+            addr += ATA_SECT_SIZE * max_blks;
+        }
+        else
+        {
+            if (blks != dwc_ahsata_rw_cmd(uc_priv, start, blks,
+                                          addr, is_write))
+                return 0;
+            start += blks;
+            blks = 0;
+            addr += ATA_SECT_SIZE * blks;
+        }
+    } while (blks != 0);
+
+    return blkcnt;
+}
+
+static int dwc_ahci_start_ports(struct ahci_uc_priv *uc_priv)
+{
+    u32 linkmap;
+    int i;
+
+    linkmap = uc_priv->link_port_map;
+
+    if (0 == linkmap)
+    {
+        rt_kprintf("No port device detected!\n");
+        return -ENXIO;
+    }
+
+    for (i = 0; i < uc_priv->n_ports; i++)
+    {
+        if ((linkmap >> i) && ((linkmap >> i) & 0x01))
+        {
+            if (ahci_port_start(uc_priv, (u8)i))
+            {
+                rt_kprintf("Can not start port %d\n", i);
+                return 1;
+            }
+
+            uc_priv->hard_port_no = i;
+            break;
+        }
+    }
+
+    return 0;
+}
+
+unsigned char sector_data[512];
+
+void dump_pbuf(void *p, int len)
+{
+    rt_kprintf("----dump_pbuf----\n");
+    rt_kprintf("pbuf = 0x%p,len = %d\n", p, len);
+    u32 i;
+    u8 *q = p;
+    rt_kprintf("%p", q);
+
+    for (i = 0; i < 16; i++)
+    {
+        rt_kprintf(" %02x", i);
+    }
+
+    rt_kprintf("\n");
+
+    for (i = 0; i < len; i++)
+    {
+        if (!(i & 0xF))
+        {
+            rt_kprintf("%p", &q[i]);
+        }
+
+        rt_kprintf(" %02x", q[i]);
+
+        if ((i & 0xF) == 0xF)
+        {
+            rt_kprintf("\n");
+        }
+    }
+
+    rt_kprintf("\n-----------------\n");
+}
+
+static int dwc_ahsata_scan_common(struct ahci_uc_priv *uc_priv,
+                                  struct blk_device *pdev)
+{
+    u8 serial[ATA_ID_SERNO_LEN + 1] = {0};
+    u8 firmware[ATA_ID_FW_REV_LEN + 1] = {0};
+    u8 product[ATA_ID_PROD_LEN + 1] = {0};
+    u8 port = uc_priv->hard_port_no;
+    ALLOC_CACHE_ALIGN_BUFFER(u16, id, ATA_ID_WORDS);
+
+    /* Identify device to get information */
+    dwc_ahsata_identify(uc_priv, id);
+
+    /* Serial number */
+    ata_id_c_string(id, serial, ATA_ID_SERNO, sizeof(serial));
+    memcpy(pdev->product, serial, sizeof(serial));
+
+    /* Firmware version */
+    ata_id_c_string(id, firmware, ATA_ID_FW_REV, sizeof(firmware));
+    memcpy(pdev->revision, firmware, sizeof(firmware));
+
+    /* Product model */
+    ata_id_c_string(id, product, ATA_ID_PROD, sizeof(product));
+    memcpy(pdev->vendor, product, sizeof(product));
+
+    /* Total sectors */
+    pdev->lba = ata_id_n_sectors(id);
+
+    pdev->type = DEV_TYPE_HARDDISK;
+    pdev->blksz = ATA_SECT_SIZE;
+    pdev->lun = 0;
+
+    /* Check if support LBA48 */
+    if (ata_id_has_lba48(id))
+    {
+        pdev->lba48 = 1;
+        debug("Device support LBA48\n\r");
+    }
+
+    /* Get the NCQ queue depth from device */
+    uc_priv->flags &= (~SATA_FLAG_Q_DEP_MASK);
+    uc_priv->flags |= ata_id_queue_depth(id);
+
+    /* Get the xfer mode from device */
+    dwc_ahsata_xfer_mode(uc_priv, id);
+
+    /* Get the write cache status from device */
+    dwc_ahsata_init_wcache(uc_priv, id);
+
+    /* Set the xfer mode to highest speed */
+    ahci_set_feature(uc_priv, port);
+    dwc_ahsata_read((rt_device_t)pdev, 0, sector_data, 1);
+    //dump_pbuf(sector_data, 512);
+    dwc_ahsata_print_info(pdev);
+
+    return 0;
+}
+
+/*
+ * SATA interface between low level driver and command layer
+ */
+static ulong sata_read_common(struct ahci_uc_priv *uc_priv,
+                              struct blk_device *desc, ulong blknr,
+                              lbaint_t blkcnt, void *buffer)
+{
+    u32 rc;
+
+    if (desc->lba48)
+        rc = ata_low_level_rw_lba48(uc_priv, blknr, blkcnt, buffer,
+                                    READ_CMD);
+    else
+        rc = ata_low_level_rw_lba28(uc_priv, blknr, blkcnt, buffer,
+                                    READ_CMD);
+
+    return rc;
+}
+
+static ulong sata_write_common(struct ahci_uc_priv *uc_priv,
+                               struct blk_device *desc, ulong blknr,
+                               lbaint_t blkcnt, const void *buffer)
+{
+    u32 rc;
+    u32 flags = uc_priv->flags;
+
+    if (desc->lba48)
+    {
+        rc = ata_low_level_rw_lba48(uc_priv, blknr, blkcnt, buffer,
+                                    WRITE_CMD);
+        if ((flags & SATA_FLAG_WCACHE) && (flags & SATA_FLAG_FLUSH_EXT))
+            dwc_ahsata_flush_cache_ext(uc_priv);
+    }
+    else
+    {
+        rc = ata_low_level_rw_lba28(uc_priv, blknr, blkcnt, buffer,
+                                    WRITE_CMD);
+        if ((flags & SATA_FLAG_WCACHE) && (flags & SATA_FLAG_FLUSH))
+            dwc_ahsata_flush_cache(uc_priv);
+    }
+
+    return rc;
+}
+
+#if !CONFIG_IS_ENABLED(AHCI)
+static int ahci_init_one(int pdev)
+{
+    int rc;
+    struct ahci_uc_priv *uc_priv = NULL;
+
+    uc_priv = malloc(sizeof(struct ahci_uc_priv));
+    if (!uc_priv)
+        return -ENOMEM;
+
+    memset(uc_priv, 0, sizeof(struct ahci_uc_priv));
+    uc_priv->dev = pdev;
+
+    uc_priv->host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | ATA_FLAG_NO_ATAPI;
+
+    uc_priv->mmio_base = (void __iomem *)CONFIG_DWC_AHSATA_BASE_ADDR;
+
+    /* initialize adapter */
+    rc = ahci_host_init(uc_priv);
+    if (rc)
+        goto err_out;
+
+    ahci_print_info(uc_priv);
+
+    /* Save the uc_private struct to block device struct */
+    sata_dev_desc[pdev].priv = uc_priv;
+
+    return 0;
+
+err_out:
+    if (uc_priv)
+        free(uc_priv);
+    return rc;
+}
+
+int init_sata(int dev)
+{
+    struct ahci_uc_priv *uc_priv = NULL;
+
+#if defined(CONFIG_MX6)
+    if (!is_mx6dq() && !is_mx6dqp())
+        return 1;
+#endif
+    if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1))
+    {
+        rt_kprintf("The sata index %d is out of ranges\n\r", dev);
+        return -1;
+    }
+
+    ahci_init_one(dev);
+
+    uc_priv = sata_dev_desc[dev].priv;
+
+    return dwc_ahci_start_ports(uc_priv) ? 1 : 0;
+}
+
+int reset_sata(int dev)
+{
+    struct ahci_uc_priv *uc_priv;
+    struct sata_host_regs *host_mmio;
+
+    if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1))
+    {
+        rt_kprintf("The sata index %d is out of ranges\n\r", dev);
+        return -1;
+    }
+
+    uc_priv = sata_dev_desc[dev].priv;
+    if (NULL == uc_priv)
+        /* not initialized, so nothing to reset */
+        return 0;
+
+    host_mmio = uc_priv->mmio_base;
+    setbits_le32(&host_mmio->ghc, SATA_HOST_GHC_HR);
+    while (readl(&host_mmio->ghc) & SATA_HOST_GHC_HR)
+        udelay(100);
+
+    free(uc_priv);
+    memset(&sata_dev_desc[dev], 0, sizeof(struct blk_desc));
+
+    return 0;
+}
+
+int sata_port_status(int dev, int port)
+{
+    struct sata_port_regs *port_mmio;
+    struct ahci_uc_priv *uc_priv = NULL;
+
+    if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1))
+        return -EINVAL;
+
+    if (sata_dev_desc[dev].priv == NULL)
+        return -ENODEV;
+
+    uc_priv = sata_dev_desc[dev].priv;
+    port_mmio = uc_priv->port[port].port_mmio;
+
+    return readl(&port_mmio->ssts) & SATA_PORT_SSTS_DET_MASK;
+}
+
+/*
+ * SATA interface between low level driver and command layer
+ */
+ulong sata_read(int dev, ulong blknr, lbaint_t blkcnt, void *buffer)
+{
+    struct ahci_uc_priv *uc_priv = sata_dev_desc[dev].priv;
+
+    return sata_read_common(uc_priv, &sata_dev_desc[dev], blknr, blkcnt,
+                            buffer);
+}
+
+ulong sata_write(int dev, ulong blknr, lbaint_t blkcnt, const void *buffer)
+{
+    struct ahci_uc_priv *uc_priv = sata_dev_desc[dev].priv;
+
+    return sata_write_common(uc_priv, &sata_dev_desc[dev], blknr, blkcnt,
+                             buffer);
+}
+
+int scan_sata(int dev)
+{
+    struct ahci_uc_priv *uc_priv = sata_dev_desc[dev].priv;
+    struct blk_desc *pdev = &sata_dev_desc[dev];
+
+    return dwc_ahsata_scan_common(uc_priv, pdev);
+}
+#endif /* CONFIG_IS_ENABLED(AHCI) */
+
+#if CONFIG_IS_ENABLED(AHCI)
+
+int dwc_ahsata_port_status(struct rt_device *dev, int port)
+{
+    struct ahci_uc_priv *uc_priv = (struct ahci_uc_priv *)dev;
+    struct sata_port_regs *port_mmio;
+
+    port_mmio = uc_priv->port[port].port_mmio;
+    return readl(&port_mmio->ssts) & SATA_PORT_SSTS_DET_MASK ? 0 : -ENXIO;
+}
+
+int dwc_ahsata_bus_reset(struct rt_device *dev)
+{
+    struct ahci_uc_priv *uc_priv = (struct ahci_uc_priv *)dev;
+    struct sata_host_regs *host_mmio = uc_priv->mmio_base;
+
+    setbits_le32(&host_mmio->ghc, SATA_HOST_GHC_HR);
+
+    while (readl(&host_mmio->ghc) & SATA_HOST_GHC_HR)
+    {
+        udelay(100);
+    }
+
+    return 0;
+}
+
+int dwc_ahsata_scan(struct rt_device *dev)
+{
+    struct ahci_uc_priv *uc_priv = (struct ahci_uc_priv *)dev;
+    struct blk_device *blk;
+    rt_err_t ret;
+
+    blk = (struct blk_device *)rt_device_create(RT_Device_Class_Block, sizeof(struct blk_device) - sizeof(struct rt_device));
+    blk->parent.init = NULL;
+    blk->parent.open = NULL;
+    blk->parent.close = NULL;
+    blk->parent.control = dwc_ahsata_control;
+    blk->parent.read = dwc_ahsata_read;
+    blk->parent.write = dwc_ahsata_write;
+    blk->ahci_device = uc_priv;
+    blk->blksz = 512;
+    blk->log2blksz = 9;
+    blk->lba = 0;
+    ret = rt_device_register((rt_device_t)blk, "dwc_ahsata_blk", RT_DEVICE_FLAG_RDWR);
+
+    if (ret != RT_EOK)
+    {
+        debug("Can't create device\n");
+        return ret;
+    }
+
+    ret = dwc_ahsata_scan_common(uc_priv, blk);
+
+    if (ret)
+    {
+        debug("%s: Failed to scan bus\n", __func__);
+        return ret;
+    }
+
+    return 0;
+}
+
+int dwc_ahsata_probe(struct rt_device *dev)
+{
+    struct ahci_uc_priv *uc_priv = (struct ahci_uc_priv *)dev;
+    int ret;
+
+    uc_priv->host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+                          ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | ATA_FLAG_NO_ATAPI;
+
+    /* initialize adapter */
+    ret = ahci_host_init(uc_priv);
+    if (ret)
+        return ret;
+
+    ahci_print_info(uc_priv);
+
+    return dwc_ahci_start_ports(uc_priv);
+}
+
+rt_size_t dwc_ahsata_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
+{
+    struct blk_device *blk = (struct blk_device *)dev;
+    return sata_read_common(blk->ahci_device, blk, pos, size, buffer);
+}
+
+rt_size_t dwc_ahsata_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
+{
+    struct blk_device *blk = (struct blk_device *)dev;
+    return sata_write_common(blk->ahci_device, blk, pos, size, buffer);
+}
+
+rt_err_t dwc_ahsata_control(rt_device_t dev, int cmd, void *args)
+{
+    struct blk_device *blk = (struct blk_device *)dev;
+
+    switch (cmd)
+    {
+    case RT_DEVICE_CTRL_BLK_GETGEOME:
+
+        if (args != NULL)
+        {
+            struct rt_device_blk_geometry *info = (struct rt_device_blk_geometry *)args;
+            info->sector_count = blk->lba;
+            info->bytes_per_sector = blk->blksz;
+            info->block_size = 0;
+        }
+
+        break;
+    }
+
+    return RT_EOK;
+}
+
+#endif

+ 25 - 0
bsp/ls2kdev/drivers/ata/dwc_ahsata.h

@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     porting to ls2k
+ */
+
+
+#ifndef __DWC_AHSATA_H__
+#define __DWC_AHSATA_H__
+
+#define DWCAHSATA_BASE (0x9000000000000000 | 0x400e0000)
+
+int dwc_ahsata_bus_reset(struct rt_device *dev);
+int dwc_ahsata_probe(struct rt_device *dev);
+int dwc_ahsata_scan(struct rt_device *dev);
+int dwc_ahsata_port_status(struct rt_device *dev, int port);
+rt_size_t dwc_ahsata_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size);
+rt_size_t dwc_ahsata_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
+rt_err_t dwc_ahsata_control(rt_device_t dev, int cmd, void *args);
+
+#endif

+ 323 - 0
bsp/ls2kdev/drivers/ata/dwc_ahsata_priv.h

@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     porting to ls2k
+ */
+
+#ifndef __DWC_AHSATA_PRIV_H__
+#define __DWC_AHSATA_PRIV_H__
+
+#define DWC_AHSATA_MAX_CMD_SLOTS 32
+
+/* Max host controller numbers */
+#define SATA_HC_MAX_NUM 4
+/* Max command queue depth per host controller */
+#define DWC_AHSATA_HC_MAX_CMD 32
+/* Max port number per host controller */
+#define SATA_HC_MAX_PORT 16
+
+/* Generic Host Register */
+
+/* HBA Capabilities Register */
+#define SATA_HOST_CAP_S64A 0x80000000
+#define SATA_HOST_CAP_SNCQ 0x40000000
+#define SATA_HOST_CAP_SSNTF 0x20000000
+#define SATA_HOST_CAP_SMPS 0x10000000
+#define SATA_HOST_CAP_SSS 0x08000000
+#define SATA_HOST_CAP_SALP 0x04000000
+#define SATA_HOST_CAP_SAL 0x02000000
+#define SATA_HOST_CAP_SCLO 0x01000000
+#define SATA_HOST_CAP_ISS_MASK 0x00f00000
+#define SATA_HOST_CAP_ISS_OFFSET 20
+#define SATA_HOST_CAP_SNZO 0x00080000
+#define SATA_HOST_CAP_SAM 0x00040000
+#define SATA_HOST_CAP_SPM 0x00020000
+#define SATA_HOST_CAP_PMD 0x00008000
+#define SATA_HOST_CAP_SSC 0x00004000
+#define SATA_HOST_CAP_PSC 0x00002000
+#define SATA_HOST_CAP_NCS 0x00001f00
+#define SATA_HOST_CAP_CCCS 0x00000080
+#define SATA_HOST_CAP_EMS 0x00000040
+#define SATA_HOST_CAP_SXS 0x00000020
+#define SATA_HOST_CAP_NP_MASK 0x0000001f
+
+/* Global HBA Control Register */
+#define SATA_HOST_GHC_AE 0x80000000
+#define SATA_HOST_GHC_IE 0x00000002
+#define SATA_HOST_GHC_HR 0x00000001
+
+/* Interrupt Status Register */
+
+/* Ports Implemented Register */
+
+/* AHCI Version Register */
+#define SATA_HOST_VS_MJR_MASK 0xffff0000
+#define SATA_HOST_VS_MJR_OFFSET 16
+#define SATA_HOST_VS_MJR_MNR 0x0000ffff
+
+/* Command Completion Coalescing Control */
+#define SATA_HOST_CCC_CTL_TV_MASK 0xffff0000
+#define SATA_HOST_CCC_CTL_TV_OFFSET 16
+#define SATA_HOST_CCC_CTL_CC_MASK 0x0000ff00
+#define SATA_HOST_CCC_CTL_CC_OFFSET 8
+#define SATA_HOST_CCC_CTL_INT_MASK 0x000000f8
+#define SATA_HOST_CCC_CTL_INT_OFFSET 3
+#define SATA_HOST_CCC_CTL_EN 0x00000001
+
+/* Command Completion Coalescing Ports */
+
+/* HBA Capabilities Extended Register */
+#define SATA_HOST_CAP2_APST 0x00000004
+
+/* BIST Activate FIS Register */
+#define SATA_HOST_BISTAFR_NCP_MASK 0x0000ff00
+#define SATA_HOST_BISTAFR_NCP_OFFSET 8
+#define SATA_HOST_BISTAFR_PD_MASK 0x000000ff
+#define SATA_HOST_BISTAFR_PD_OFFSET 0
+
+/* BIST Control Register */
+#define SATA_HOST_BISTCR_FERLB 0x00100000
+#define SATA_HOST_BISTCR_TXO 0x00040000
+#define SATA_HOST_BISTCR_CNTCLR 0x00020000
+#define SATA_HOST_BISTCR_NEALB 0x00010000
+#define SATA_HOST_BISTCR_LLC_MASK 0x00000700
+#define SATA_HOST_BISTCR_LLC_OFFSET 8
+#define SATA_HOST_BISTCR_ERREN 0x00000040
+#define SATA_HOST_BISTCR_FLIP 0x00000020
+#define SATA_HOST_BISTCR_PV 0x00000010
+#define SATA_HOST_BISTCR_PATTERN_MASK 0x0000000f
+#define SATA_HOST_BISTCR_PATTERN_OFFSET 0
+
+/* BIST FIS Count Register */
+
+/* BIST Status Register */
+#define SATA_HOST_BISTSR_FRAMERR_MASK 0x0000ffff
+#define SATA_HOST_BISTSR_FRAMERR_OFFSET 0
+#define SATA_HOST_BISTSR_BRSTERR_MASK 0x00ff0000
+#define SATA_HOST_BISTSR_BRSTERR_OFFSET 16
+
+/* BIST DWORD Error Count Register */
+
+/* OOB Register*/
+#define SATA_HOST_OOBR_WE 0x80000000
+#define SATA_HOST_OOBR_cwMin_MASK 0x7f000000
+#define SATA_HOST_OOBR_cwMAX_MASK 0x00ff0000
+#define SATA_HOST_OOBR_ciMin_MASK 0x0000ff00
+#define SATA_HOST_OOBR_ciMax_MASK 0x000000ff
+
+/* Timer 1-ms Register */
+
+/* Global Parameter 1 Register */
+#define SATA_HOST_GPARAM1R_ALIGN_M 0x80000000
+#define SATA_HOST_GPARAM1R_RX_BUFFER 0x40000000
+#define SATA_HOST_GPARAM1R_PHY_DATA_MASK 0x30000000
+#define SATA_HOST_GPARAM1R_PHY_RST 0x08000000
+#define SATA_HOST_GPARAM1R_PHY_CTRL_MASK 0x07e00000
+#define SATA_HOST_GPARAM1R_PHY_STAT_MASK 0x001f8000
+#define SATA_HOST_GPARAM1R_LATCH_M 0x00004000
+#define SATA_HOST_GPARAM1R_BIST_M 0x00002000
+#define SATA_HOST_GPARAM1R_PHY_TYPE 0x00001000
+#define SATA_HOST_GPARAM1R_RETURN_ERR 0x00000400
+#define SATA_HOST_GPARAM1R_AHB_ENDIAN_MASK 0x00000300
+#define SATA_HOST_GPARAM1R_S_HADDR 0X00000080
+#define SATA_HOST_GPARAM1R_M_HADDR 0X00000040
+
+/* Global Parameter 2 Register */
+#define SATA_HOST_GPARAM2R_DEV_CP 0x00004000
+#define SATA_HOST_GPARAM2R_DEV_MP 0x00002000
+#define SATA_HOST_GPARAM2R_DEV_ENCODE_M 0x00001000
+#define SATA_HOST_GPARAM2R_RXOOB_CLK_M 0x00000800
+#define SATA_HOST_GPARAM2R_RXOOB_M 0x00000400
+#define SATA_HOST_GPARAM2R_TX_OOB_M 0x00000200
+#define SATA_HOST_GPARAM2R_RXOOB_CLK_MASK 0x000001ff
+
+/* Port Parameter Register */
+#define SATA_HOST_PPARAMR_TX_MEM_M 0x00000200
+#define SATA_HOST_PPARAMR_TX_MEM_S 0x00000100
+#define SATA_HOST_PPARAMR_RX_MEM_M 0x00000080
+#define SATA_HOST_PPARAMR_RX_MEM_S 0x00000040
+#define SATA_HOST_PPARAMR_TXFIFO_DEPTH_MASK 0x00000038
+#define SATA_HOST_PPARAMR_RXFIFO_DEPTH_MASK 0x00000007
+
+/* Test Register */
+#define SATA_HOST_TESTR_PSEL_MASK 0x00070000
+#define SATA_HOST_TESTR_TEST_IF 0x00000001
+
+/* Port Register Descriptions */
+/* Port# Command List Base Address Register */
+#define SATA_PORT_CLB_CLB_MASK 0xfffffc00
+
+/* Port# Command List Base Address Upper 32-Bits Register */
+
+/* Port# FIS Base Address Register */
+#define SATA_PORT_FB_FB_MASK 0xfffffff0
+
+/* Port# FIS Base Address Upper 32-Bits Register */
+
+/* Port# Interrupt Status Register */
+#define SATA_PORT_IS_CPDS 0x80000000
+#define SATA_PORT_IS_TFES 0x40000000
+#define SATA_PORT_IS_HBFS 0x20000000
+#define SATA_PORT_IS_HBDS 0x10000000
+#define SATA_PORT_IS_IFS 0x08000000
+#define SATA_PORT_IS_INFS 0x04000000
+#define SATA_PORT_IS_OFS 0x01000000
+#define SATA_PORT_IS_IPMS 0x00800000
+#define SATA_PORT_IS_PRCS 0x00400000
+#define SATA_PORT_IS_DMPS 0x00000080
+#define SATA_PORT_IS_PCS 0x00000040
+#define SATA_PORT_IS_DPS 0x00000020
+#define SATA_PORT_IS_UFS 0x00000010
+#define SATA_PORT_IS_SDBS 0x00000008
+#define SATA_PORT_IS_DSS 0x00000004
+#define SATA_PORT_IS_PSS 0x00000002
+#define SATA_PORT_IS_DHRS 0x00000001
+
+/* Port# Interrupt Enable Register */
+#define SATA_PORT_IE_CPDE 0x80000000
+#define SATA_PORT_IE_TFEE 0x40000000
+#define SATA_PORT_IE_HBFE 0x20000000
+#define SATA_PORT_IE_HBDE 0x10000000
+#define SATA_PORT_IE_IFE 0x08000000
+#define SATA_PORT_IE_INFE 0x04000000
+#define SATA_PORT_IE_OFE 0x01000000
+#define SATA_PORT_IE_IPME 0x00800000
+#define SATA_PORT_IE_PRCE 0x00400000
+#define SATA_PORT_IE_DMPE 0x00000080
+#define SATA_PORT_IE_PCE 0x00000040
+#define SATA_PORT_IE_DPE 0x00000020
+#define SATA_PORT_IE_UFE 0x00000010
+#define SATA_PORT_IE_SDBE 0x00000008
+#define SATA_PORT_IE_DSE 0x00000004
+#define SATA_PORT_IE_PSE 0x00000002
+#define SATA_PORT_IE_DHRE 0x00000001
+
+/* Port# Command Register */
+#define SATA_PORT_CMD_ICC_MASK 0xf0000000
+#define SATA_PORT_CMD_ASP 0x08000000
+#define SATA_PORT_CMD_ALPE 0x04000000
+#define SATA_PORT_CMD_DLAE 0x02000000
+#define SATA_PORT_CMD_ATAPI 0x01000000
+#define SATA_PORT_CMD_APSTE 0x00800000
+#define SATA_PORT_CMD_ESP 0x00200000
+#define SATA_PORT_CMD_CPD 0x00100000
+#define SATA_PORT_CMD_MPSP 0x00080000
+#define SATA_PORT_CMD_HPCP 0x00040000
+#define SATA_PORT_CMD_PMA 0x00020000
+#define SATA_PORT_CMD_CPS 0x00010000
+#define SATA_PORT_CMD_CR 0x00008000
+#define SATA_PORT_CMD_FR 0x00004000
+#define SATA_PORT_CMD_MPSS 0x00002000
+#define SATA_PORT_CMD_CCS_MASK 0x00001f00
+#define SATA_PORT_CMD_FRE 0x00000010
+#define SATA_PORT_CMD_CLO 0x00000008
+#define SATA_PORT_CMD_POD 0x00000004
+#define SATA_PORT_CMD_SUD 0x00000002
+#define SATA_PORT_CMD_ST 0x00000001
+
+/* Port# Task File Data Register */
+#define SATA_PORT_TFD_ERR_MASK 0x0000ff00
+#define SATA_PORT_TFD_STS_MASK 0x000000ff
+#define SATA_PORT_TFD_STS_ERR 0x00000001
+#define SATA_PORT_TFD_STS_DRQ 0x00000008
+#define SATA_PORT_TFD_STS_BSY 0x00000080
+
+/* Port# Signature Register */
+
+/* Port# Serial ATA Status {SStatus} Register */
+#define SATA_PORT_SSTS_IPM_MASK 0x00000f00
+#define SATA_PORT_SSTS_SPD_MASK 0x000000f0
+#define SATA_PORT_SSTS_DET_MASK 0x0000000f
+
+/* Port# Serial ATA Control {SControl} Register */
+#define SATA_PORT_SCTL_IPM_MASK 0x00000f00
+#define SATA_PORT_SCTL_SPD_MASK 0x000000f0
+#define SATA_PORT_SCTL_DET_MASK 0x0000000f
+
+/* Port# Serial ATA Error {SError} Register */
+#define SATA_PORT_SERR_DIAG_X 0x04000000
+#define SATA_PORT_SERR_DIAG_F 0x02000000
+#define SATA_PORT_SERR_DIAG_T 0x01000000
+#define SATA_PORT_SERR_DIAG_S 0x00800000
+#define SATA_PORT_SERR_DIAG_H 0x00400000
+#define SATA_PORT_SERR_DIAG_C 0x00200000
+#define SATA_PORT_SERR_DIAG_D 0x00100000
+#define SATA_PORT_SERR_DIAG_B 0x00080000
+#define SATA_PORT_SERR_DIAG_W 0x00040000
+#define SATA_PORT_SERR_DIAG_I 0x00020000
+#define SATA_PORT_SERR_DIAG_N 0x00010000
+#define SATA_PORT_SERR_ERR_E 0x00000800
+#define SATA_PORT_SERR_ERR_P 0x00000400
+#define SATA_PORT_SERR_ERR_C 0x00000200
+#define SATA_PORT_SERR_ERR_T 0x00000100
+#define SATA_PORT_SERR_ERR_M 0x00000002
+#define SATA_PORT_SERR_ERR_I 0x00000001
+
+/* Port# Serial ATA Active {SActive} Register */
+
+/* Port# Command Issue Register */
+
+/* Port# Serial ATA Notification Register */
+
+/* Port# DMA Control Register */
+#define SATA_PORT_DMACR_RXABL_MASK 0x0000f000
+#define SATA_PORT_DMACR_TXABL_MASK 0x00000f00
+#define SATA_PORT_DMACR_RXTS_MASK 0x000000f0
+#define SATA_PORT_DMACR_TXTS_MASK 0x0000000f
+
+/* Port# PHY Control Register */
+
+/* Port# PHY Status Register */
+
+#define SATA_HC_CMD_HDR_ENTRY_SIZE sizeof(struct cmd_hdr_entry)
+
+/* DW0
+*/
+#define CMD_HDR_DI_CFL_MASK 0x0000001f
+#define CMD_HDR_DI_CFL_OFFSET 0
+#define CMD_HDR_DI_A 0x00000020
+#define CMD_HDR_DI_W 0x00000040
+#define CMD_HDR_DI_P 0x00000080
+#define CMD_HDR_DI_R 0x00000100
+#define CMD_HDR_DI_B 0x00000200
+#define CMD_HDR_DI_C 0x00000400
+#define CMD_HDR_DI_PMP_MASK 0x0000f000
+#define CMD_HDR_DI_PMP_OFFSET 12
+#define CMD_HDR_DI_PRDTL 0xffff0000
+#define CMD_HDR_DI_PRDTL_OFFSET 16
+
+/* prde_fis_len
+*/
+#define CMD_HDR_PRD_ENTRY_SHIFT 16
+#define CMD_HDR_PRD_ENTRY_MASK 0x003f0000
+#define CMD_HDR_FIS_LEN_SHIFT 2
+
+/* attribute
+*/
+#define CMD_HDR_ATTR_RES 0x00000800   /* Reserved bit, should be 1 */
+#define CMD_HDR_ATTR_VBIST 0x00000400 /* Vendor BIST */
+/* Snoop enable for all descriptor */
+#define CMD_HDR_ATTR_SNOOP 0x00000200
+#define CMD_HDR_ATTR_FPDMA 0x00000100 /* FPDMA queued command */
+#define CMD_HDR_ATTR_RESET 0x00000080 /* Reset - a SRST or device reset */
+/* BIST - require the host to enter BIST mode */
+#define CMD_HDR_ATTR_BIST 0x00000040
+#define CMD_HDR_ATTR_ATAPI 0x00000020 /* ATAPI command */
+#define CMD_HDR_ATTR_TAG 0x0000001f   /* TAG mask */
+
+#define FLAGS_DMA 0x00000000
+#define FLAGS_FPDMA 0x00000001
+
+#define SATA_FLAG_Q_DEP_MASK 0x0000000f
+#define SATA_FLAG_WCACHE 0x00000100
+#define SATA_FLAG_FLUSH 0x00000200
+#define SATA_FLAG_FLUSH_EXT 0x00000400
+
+#define READ_CMD 0
+#define WRITE_CMD 1
+
+#endif /* __DWC_AHSATA_H__ */

+ 152 - 0
bsp/ls2kdev/drivers/ata/fis.h

@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     porting to ls2k
+ */
+
+#ifndef __FIS_H__
+#define __FIS_H__
+/*
+* Register - Host to Device FIS
+*/
+typedef struct sata_fis_h2d
+{
+    u8 fis_type;
+    u8 pm_port_c;
+    u8 command;
+    u8 features;
+    u8 lba_low;
+    u8 lba_mid;
+    u8 lba_high;
+    u8 device;
+    u8 lba_low_exp;
+    u8 lba_mid_exp;
+    u8 lba_high_exp;
+    u8 features_exp;
+    u8 sector_count;
+    u8 sector_count_exp;
+    u8 res1;
+    u8 control;
+    u8 res2[4];
+} __attribute__((packed)) sata_fis_h2d_t;
+
+/*
+* Register - Host to Device FIS for read/write FPDMA queued
+*/
+typedef struct sata_fis_h2d_ncq
+{
+    u8 fis_type;
+    u8 pm_port_c;
+    u8 command;
+    u8 sector_count_low;
+    u8 lba_low;
+    u8 lba_mid;
+    u8 lba_high;
+    u8 device;
+    u8 lba_low_exp;
+    u8 lba_mid_exp;
+    u8 lba_high_exp;
+    u8 sector_count_high;
+    u8 tag;
+    u8 res1;
+    u8 res2;
+    u8 control;
+    u8 res3[4];
+} __attribute__((packed)) sata_fis_h2d_ncq_t;
+
+/*
+* Register - Device to Host FIS
+*/
+typedef struct sata_fis_d2h
+{
+    u8 fis_type;
+    u8 pm_port_i;
+    u8 status;
+    u8 error;
+    u8 lba_low;
+    u8 lba_mid;
+    u8 lba_high;
+    u8 device;
+    u8 lba_low_exp;
+    u8 lba_mid_exp;
+    u8 lba_high_exp;
+    u8 res1;
+    u8 sector_count;
+    u8 sector_count_exp;
+    u8 res2[2];
+    u8 res3[4];
+} __attribute__((packed)) sata_fis_d2h_t;
+
+/*
+* DMA Setup - Device to Host or Host to Device FIS
+*/
+typedef struct sata_fis_dma_setup
+{
+    u8 fis_type;
+    u8 pm_port_dir_int_act;
+    u8 res1;
+    u8 res2;
+    u32 dma_buffer_id_low;
+    u32 dma_buffer_id_high;
+    u32 res3;
+    u32 dma_buffer_offset;
+    u32 dma_transfer_count;
+    u32 res4;
+} __attribute__((packed)) sata_fis_dma_setup_t;
+
+/*
+* PIO Setup - Device to Host FIS
+*/
+typedef struct sata_fis_pio_setup
+{
+    u8 fis_type;
+    u8 pm_port_dir_int;
+    u8 status;
+    u8 error;
+    u8 lba_low;
+    u8 lba_mid;
+    u8 lba_high;
+    u8 res1;
+    u8 lba_low_exp;
+    u8 lba_mid_exp;
+    u8 lba_high_exp;
+    u8 res2;
+    u8 sector_count;
+    u8 sector_count_exp;
+    u8 res3;
+    u8 e_status;
+    u16 transfer_count;
+    u16 res4;
+} __attribute__((packed)) sata_fis_pio_setup_t;
+
+/*
+* Data - Host to Device or Device to Host FIS
+*/
+typedef struct sata_fis_data
+{
+    u8 fis_type;
+    u8 pm_port;
+    u8 res1;
+    u8 res2;
+    u32 data[2048];
+} __attribute__((packed)) sata_fis_data_t;
+
+/* fis_type - SATA FIS type
+ */
+enum sata_fis_type
+{
+    SATA_FIS_TYPE_REGISTER_H2D = 0x27,
+    SATA_FIS_TYPE_REGISTER_D2H = 0x34,
+    SATA_FIS_TYPE_DMA_ACT_D2H = 0x39,
+    SATA_FIS_TYPE_DMA_SETUP_BI = 0x41,
+    SATA_FIS_TYPE_DATA_BI = 0x46,
+    SATA_FIS_TYPE_BIST_ACT_BI = 0x58,
+    SATA_FIS_TYPE_PIO_SETUP_D2H = 0x5F,
+    SATA_FIS_TYPE_SET_DEVICE_BITS_D2H = 0xA1,
+};
+
+#endif /* __FIS_H__ */

+ 150 - 0
bsp/ls2kdev/drivers/ata/libata.c

@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     porting to ls2k
+ */
+
+#include <rtthread.h>
+#include <ata_interface.h>
+#include <libata.h>
+
+u64 ata_id_n_sectors(u16 *id)
+{
+    if (ata_id_has_lba(id)) {
+        if (ata_id_has_lba48(id))
+            return ata_id_u64(id, ATA_ID_LBA48_SECTORS);
+        else
+            return ata_id_u32(id, ATA_ID_LBA_SECTORS);
+    } else {
+        return 0;
+    }
+}
+
+u32 ata_dev_classify(u32 sig)
+{
+    u8 lbam, lbah;
+
+    lbam = (sig >> 16) & 0xff;
+    lbah = (sig >> 24) & 0xff;
+
+    if (((lbam == 0) && (lbah == 0)) ||
+        ((lbam == 0x3c) && (lbah == 0xc3)))
+        return ATA_DEV_ATA;
+
+    if ((lbam == 0x14) && (lbah == 0xeb))
+        return ATA_DEV_ATAPI;
+
+    if ((lbam == 0x69) && (lbah == 0x96))
+        return ATA_DEV_PMP;
+
+    return ATA_DEV_UNKNOWN;
+}
+
+static void ata_id_string(const u16 *id, unsigned char *s,
+             unsigned int ofs, unsigned int len)
+{
+    unsigned int c;
+
+    while (len > 0) {
+        c = id[ofs] >> 8;
+        *s = c;
+        s++;
+
+        c = id[ofs] & 0xff;
+        *s = c;
+        s++;
+
+        ofs++;
+        len -= 2;
+    }
+}
+
+void ata_id_c_string(const u16 *id, unsigned char *s,
+             unsigned int ofs, unsigned int len)
+{
+    unsigned char *p;
+
+    ata_id_string(id, s, ofs, len - 1);
+
+    p = s + strnlen((char *)s, len - 1);
+    while (p > s && p[-1] == ' ')
+        p--;
+    *p = '\0';
+}
+
+void ata_dump_id(u16 *id)
+{
+    unsigned char serial[ATA_ID_SERNO_LEN + 1];
+    unsigned char firmware[ATA_ID_FW_REV_LEN + 1];
+    unsigned char product[ATA_ID_PROD_LEN + 1];
+    u64 n_sectors;
+
+    /* Serial number */
+    ata_id_c_string(id, serial, ATA_ID_SERNO, sizeof(serial));
+    printf("S/N: %s\n\r", serial);
+
+    /* Firmware version */
+    ata_id_c_string(id, firmware, ATA_ID_FW_REV, sizeof(firmware));
+    printf("Firmware version: %s\n\r", firmware);
+
+    /* Product model */
+    ata_id_c_string(id, product, ATA_ID_PROD, sizeof(product));
+    printf("Product model number: %s\n\r", product);
+
+    /* Total sectors of device  */
+    n_sectors = ata_id_n_sectors(id);
+    printf("Capablity: %lld sectors\n\r", n_sectors);
+
+    printf ("id[49]: capabilities = 0x%04x\n"
+        "id[53]: field valid = 0x%04x\n"
+        "id[63]: mwdma = 0x%04x\n"
+        "id[64]: pio = 0x%04x\n"
+        "id[75]: queue depth = 0x%04x\n",
+        id[49],
+        id[53],
+        id[63],
+        id[64],
+        id[75]);
+
+    printf ("id[76]: sata capablity = 0x%04x\n"
+        "id[78]: sata features supported = 0x%04x\n"
+        "id[79]: sata features enable = 0x%04x\n",
+        id[76],
+        id[78],
+        id[79]);
+
+    printf ("id[80]: major version = 0x%04x\n"
+        "id[81]: minor version = 0x%04x\n"
+        "id[82]: command set supported 1 = 0x%04x\n"
+        "id[83]: command set supported 2 = 0x%04x\n"
+        "id[84]: command set extension = 0x%04x\n",
+        id[80],
+        id[81],
+        id[82],
+        id[83],
+        id[84]);
+    printf ("id[85]: command set enable 1 = 0x%04x\n"
+        "id[86]: command set enable 2 = 0x%04x\n"
+        "id[87]: command set default = 0x%04x\n"
+        "id[88]: udma = 0x%04x\n"
+        "id[93]: hardware reset result = 0x%04x\n",
+        id[85],
+        id[86],
+        id[87],
+        id[88],
+        id[93]);
+}
+
+void ata_swap_buf_le16(u16 *buf, unsigned int buf_words)
+{
+    unsigned int i;
+
+    for (i = 0; i < buf_words; i++)
+    {
+        buf[i] = le16_to_cpu(buf[i]);
+    }
+}

+ 653 - 0
bsp/ls2kdev/drivers/ata/libata.h

@@ -0,0 +1,653 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-08-19     lizhirui     porting to ls2k
+ */
+
+#ifndef __LIBATA_H__
+#define __LIBATA_H__
+
+enum {
+    /* various global constants */
+    ATA_MAX_DEVICES        = 2,    /* per bus/port */
+    ATA_MAX_PRD        = 256,    /* we could make these 256/256 */
+    ATA_SECT_SIZE        = 512,
+    ATA_MAX_SECTORS_128    = 128,
+    ATA_MAX_SECTORS        = 256,
+    ATA_MAX_SECTORS_LBA48    = 65535,
+    ATA_MAX_SECTORS_TAPE    = 65535,
+
+    ATA_ID_WORDS        = 256,
+    ATA_ID_SERNO        = 10,
+    ATA_ID_FW_REV        = 23,
+    ATA_ID_PROD        = 27,
+    ATA_ID_OLD_PIO_MODES    = 51,
+    ATA_ID_FIELD_VALID    = 53,
+    ATA_ID_LBA_SECTORS    = 60,
+    ATA_ID_MWDMA_MODES    = 63,
+    ATA_ID_PIO_MODES    = 64,
+    ATA_ID_EIDE_DMA_MIN    = 65,
+    ATA_ID_EIDE_PIO        = 67,
+    ATA_ID_EIDE_PIO_IORDY    = 68,
+    ATA_ID_PIO4        = (1 << 1),
+    ATA_ID_QUEUE_DEPTH    = 75,
+    ATA_ID_SATA_CAP        = 76,
+    ATA_ID_SATA_FEATURES    = 78,
+    ATA_ID_SATA_FEATURES_EN    = 79,
+    ATA_ID_MAJOR_VER    = 80,
+    ATA_ID_MINOR_VER    = 81,
+    ATA_ID_UDMA_MODES    = 88,
+    ATA_ID_LBA48_SECTORS    = 100,
+
+    ATA_ID_SERNO_LEN    = 20,
+    ATA_ID_FW_REV_LEN    = 8,
+    ATA_ID_PROD_LEN        = 40,
+
+    ATA_PCI_CTL_OFS        = 2,
+
+    ATA_PIO0        = (1 << 0),
+    ATA_PIO1        = ATA_PIO0 | (1 << 1),
+    ATA_PIO2        = ATA_PIO1 | (1 << 2),
+    ATA_PIO3        = ATA_PIO2 | (1 << 3),
+    ATA_PIO4        = ATA_PIO3 | (1 << 4),
+    ATA_PIO5        = ATA_PIO4 | (1 << 5),
+    ATA_PIO6        = ATA_PIO5 | (1 << 6),
+
+    ATA_SWDMA0        = (1 << 0),
+    ATA_SWDMA1        = ATA_SWDMA0 | (1 << 1),
+    ATA_SWDMA2        = ATA_SWDMA1 | (1 << 2),
+
+    ATA_SWDMA2_ONLY        = (1 << 2),
+
+    ATA_MWDMA0        = (1 << 0),
+    ATA_MWDMA1        = ATA_MWDMA0 | (1 << 1),
+    ATA_MWDMA2        = ATA_MWDMA1 | (1 << 2),
+
+    ATA_MWDMA12_ONLY    = (1 << 1) | (1 << 2),
+    ATA_MWDMA2_ONLY        = (1 << 2),
+
+    ATA_UDMA0        = (1 << 0),
+    ATA_UDMA1        = ATA_UDMA0 | (1 << 1),
+    ATA_UDMA2        = ATA_UDMA1 | (1 << 2),
+    ATA_UDMA3        = ATA_UDMA2 | (1 << 3),
+    ATA_UDMA4        = ATA_UDMA3 | (1 << 4),
+    ATA_UDMA5        = ATA_UDMA4 | (1 << 5),
+    ATA_UDMA6        = ATA_UDMA5 | (1 << 6),
+    ATA_UDMA7        = ATA_UDMA6 | (1 << 7),
+    /* ATA_UDMA7 is just for completeness... doesn't exist (yet?).  */
+
+    ATA_UDMA_MASK_40C    = ATA_UDMA2,    /* udma0-2 */
+
+    /* DMA-related */
+    ATA_PRD_SZ        = 8,
+    ATA_PRD_TBL_SZ        = (ATA_MAX_PRD * ATA_PRD_SZ),
+    ATA_PRD_EOT        = (1 << 31),    /* end-of-table flag */
+
+    ATA_DMA_TABLE_OFS    = 4,
+    ATA_DMA_STATUS        = 2,
+    ATA_DMA_CMD        = 0,
+    ATA_DMA_WR        = (1 << 3),
+    ATA_DMA_START        = (1 << 0),
+    ATA_DMA_INTR        = (1 << 2),
+    ATA_DMA_ERR        = (1 << 1),
+    ATA_DMA_ACTIVE        = (1 << 0),
+
+    /* bits in ATA command block registers */
+    ATA_HOB            = (1 << 7),    /* LBA48 selector */
+    ATA_NIEN        = (1 << 1),    /* disable-irq flag */
+    ATA_LBA            = (1 << 6),    /* LBA28 selector */
+    ATA_DEV1        = (1 << 4),    /* Select Device 1 (slave) */
+    ATA_DEVICE_OBS        = (1 << 7) | (1 << 5), /* obs bits in dev reg */
+    ATA_DEVCTL_OBS        = (1 << 3),    /* obsolete bit in devctl reg */
+    ATA_BUSY        = (1 << 7),    /* BSY status bit */
+    ATA_DRDY        = (1 << 6),    /* device ready */
+    ATA_DF            = (1 << 5),    /* device fault */
+    ATA_DRQ            = (1 << 3),    /* data request i/o */
+    ATA_ERR            = (1 << 0),    /* have an error */
+    ATA_SRST        = (1 << 2),    /* software reset */
+    ATA_ICRC        = (1 << 7),    /* interface CRC error */
+    ATA_UNC            = (1 << 6),    /* uncorrectable media error */
+    ATA_IDNF        = (1 << 4),    /* ID not found */
+    ATA_ABORTED        = (1 << 2),    /* command aborted */
+
+    /* ATA command block registers */
+    ATA_REG_DATA        = 0x00,
+    ATA_REG_ERR        = 0x01,
+    ATA_REG_NSECT        = 0x02,
+    ATA_REG_LBAL        = 0x03,
+    ATA_REG_LBAM        = 0x04,
+    ATA_REG_LBAH        = 0x05,
+    ATA_REG_DEVICE        = 0x06,
+    ATA_REG_STATUS        = 0x07,
+
+    ATA_REG_FEATURE        = ATA_REG_ERR, /* and their aliases */
+    ATA_REG_CMD        = ATA_REG_STATUS,
+    ATA_REG_BYTEL        = ATA_REG_LBAM,
+    ATA_REG_BYTEH        = ATA_REG_LBAH,
+    ATA_REG_DEVSEL        = ATA_REG_DEVICE,
+    ATA_REG_IRQ        = ATA_REG_NSECT,
+
+    /* ATA device commands */
+    ATA_CMD_DEV_RESET        = 0x08, /* ATAPI device reset */
+    ATA_CMD_PIO_READ        = 0x20, /* Read sectors with retry */
+    ATA_CMD_PIO_READ_EXT        = 0x24,
+    ATA_CMD_READ_EXT        = 0x25,
+    ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
+    ATA_CMD_READ_MULTI_EXT        = 0x29,
+    ATA_CMD_READ_LOG_EXT        = 0x2f,
+    ATA_CMD_PIO_WRITE        = 0x30, /* write sectors with retry */
+    ATA_CMD_PIO_WRITE_EXT        = 0x34,
+    ATA_CMD_WRITE_EXT        = 0x35,
+    ATA_CMD_SET_MAX_EXT        = 0x37,
+    ATA_CMD_WRITE_MULTI_EXT        = 0x39,
+    ATA_CMD_WRITE_FUA_EXT        = 0x3D,
+    ATA_CMD_VERIFY            = 0x40, /* read verify sectors with retry */
+    ATA_CMD_VERIFY_EXT        = 0x42,
+    ATA_CMD_FPDMA_READ        = 0x60,
+    ATA_CMD_FPDMA_WRITE        = 0x61,
+    ATA_CMD_EDD            = 0x90, /* execute device diagnostic */
+    ATA_CMD_INIT_DEV_PARAMS        = 0x91, /* initialize device parameters */
+    ATA_CMD_PACKET            = 0xA0, /* ATAPI packet */
+    ATA_CMD_ID_ATAPI        = 0xA1, /* ATAPI identify device */
+    ATA_CMD_CONF_OVERLAY        = 0xB1,
+    ATA_CMD_READ_MULTI        = 0xC4, /* read multiple */
+    ATA_CMD_WRITE_MULTI        = 0xC5, /* write multiple */
+    ATA_CMD_SET_MULTI        = 0xC6, /* set multiple mode */
+    ATA_CMD_READ            = 0xC8, /* read DMA with retry */
+    ATA_CMD_WRITE            = 0xCA, /* write DMA with retry */
+    ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
+    ATA_CMD_STANDBYNOW1        = 0xE0, /* standby immediate */
+    ATA_CMD_IDLEIMMEDIATE        = 0xE1, /* idle immediate */
+    ATA_CMD_STANDBY            = 0xE2, /* place in standby power mode */
+    ATA_CMD_IDLE            = 0xE3, /* place in idle power mode */
+    ATA_CMD_PMP_READ        = 0xE4, /* read buffer */
+    ATA_CMD_CHK_POWER        = 0xE5, /* check power mode */
+    ATA_CMD_SLEEP            = 0xE6, /* sleep */
+    ATA_CMD_FLUSH            = 0xE7,
+    ATA_CMD_PMP_WRITE        = 0xE8, /* write buffer */
+    ATA_CMD_FLUSH_EXT        = 0xEA,
+    ATA_CMD_ID_ATA            = 0xEC, /* identify device */
+    ATA_CMD_SET_FEATURES        = 0xEF, /* set features */
+    ATA_CMD_SEC_FREEZE_LOCK        = 0xF5, /* security freeze */
+    ATA_CMD_READ_NATIVE_MAX        = 0xF8,
+    ATA_CMD_SET_MAX            = 0xF9,
+
+    /* READ_LOG_EXT pages */
+    ATA_LOG_SATA_NCQ    = 0x10,
+
+    /* READ/WRITE LONG (obsolete) */
+    ATA_CMD_READ_LONG    = 0x22,
+    ATA_CMD_READ_LONG_ONCE    = 0x23,
+    ATA_CMD_WRITE_LONG    = 0x32,
+    ATA_CMD_WRITE_LONG_ONCE    = 0x33,
+
+    /* SETFEATURES stuff */
+    SETFEATURES_XFER    = 0x03,
+    XFER_UDMA_7        = 0x47,
+    XFER_UDMA_6        = 0x46,
+    XFER_UDMA_5        = 0x45,
+    XFER_UDMA_4        = 0x44,
+    XFER_UDMA_3        = 0x43,
+    XFER_UDMA_2        = 0x42,
+    XFER_UDMA_1        = 0x41,
+    XFER_UDMA_0        = 0x40,
+    XFER_MW_DMA_4        = 0x24,    /* CFA only */
+    XFER_MW_DMA_3        = 0x23,    /* CFA only */
+    XFER_MW_DMA_2        = 0x22,
+    XFER_MW_DMA_1        = 0x21,
+    XFER_MW_DMA_0        = 0x20,
+    XFER_SW_DMA_2        = 0x12,
+    XFER_SW_DMA_1        = 0x11,
+    XFER_SW_DMA_0        = 0x10,
+    XFER_PIO_6        = 0x0E,    /* CFA only */
+    XFER_PIO_5        = 0x0D,    /* CFA only */
+    XFER_PIO_4        = 0x0C,
+    XFER_PIO_3        = 0x0B,
+    XFER_PIO_2        = 0x0A,
+    XFER_PIO_1        = 0x09,
+    XFER_PIO_0        = 0x08,
+    XFER_PIO_SLOW        = 0x00,
+
+    SETFEATURES_WC_ON    = 0x02, /* Enable write cache */
+    SETFEATURES_WC_OFF    = 0x82, /* Disable write cache */
+
+    SETFEATURES_SPINUP    = 0x07, /* Spin-up drive */
+
+    SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
+    SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
+
+    /* SETFEATURE Sector counts for SATA features */
+    SATA_AN            = 0x05,  /* Asynchronous Notification */
+    SATA_DIPM        = 0x03,  /* Device Initiated Power Management */
+
+    /* feature values for SET_MAX */
+    ATA_SET_MAX_ADDR    = 0x00,
+    ATA_SET_MAX_PASSWD    = 0x01,
+    ATA_SET_MAX_LOCK    = 0x02,
+    ATA_SET_MAX_UNLOCK    = 0x03,
+    ATA_SET_MAX_FREEZE_LOCK    = 0x04,
+
+    /* feature values for DEVICE CONFIGURATION OVERLAY */
+    ATA_DCO_RESTORE        = 0xC0,
+    ATA_DCO_FREEZE_LOCK    = 0xC1,
+    ATA_DCO_IDENTIFY    = 0xC2,
+    ATA_DCO_SET        = 0xC3,
+
+    /* ATAPI stuff */
+    ATAPI_PKT_DMA        = (1 << 0),
+    ATAPI_DMADIR        = (1 << 2),    /* ATAPI data dir:
+                           0=to device, 1=to host */
+    ATAPI_CDB_LEN        = 16,
+
+    /* PMP stuff */
+    SATA_PMP_MAX_PORTS    = 15,
+    SATA_PMP_CTRL_PORT    = 15,
+
+    SATA_PMP_GSCR_DWORDS    = 128,
+    SATA_PMP_GSCR_PROD_ID    = 0,
+    SATA_PMP_GSCR_REV    = 1,
+    SATA_PMP_GSCR_PORT_INFO    = 2,
+    SATA_PMP_GSCR_ERROR    = 32,
+    SATA_PMP_GSCR_ERROR_EN    = 33,
+    SATA_PMP_GSCR_FEAT    = 64,
+    SATA_PMP_GSCR_FEAT_EN    = 96,
+
+    SATA_PMP_PSCR_STATUS    = 0,
+    SATA_PMP_PSCR_ERROR    = 1,
+    SATA_PMP_PSCR_CONTROL    = 2,
+
+    SATA_PMP_FEAT_BIST    = (1 << 0),
+    SATA_PMP_FEAT_PMREQ    = (1 << 1),
+    SATA_PMP_FEAT_DYNSSC    = (1 << 2),
+    SATA_PMP_FEAT_NOTIFY    = (1 << 3),
+
+    /* cable types */
+    ATA_CBL_NONE        = 0,
+    ATA_CBL_PATA40        = 1,
+    ATA_CBL_PATA80        = 2,
+    ATA_CBL_PATA40_SHORT    = 3,    /* 40 wire cable to high UDMA spec */
+    ATA_CBL_PATA_UNK    = 4,    /* don't know, maybe 80c? */
+    ATA_CBL_PATA_IGN    = 5,    /* don't know, ignore cable handling */
+    ATA_CBL_SATA        = 6,
+
+    /* SATA Status and Control Registers */
+    SCR_STATUS        = 0,
+    SCR_ERROR        = 1,
+    SCR_CONTROL        = 2,
+    SCR_ACTIVE        = 3,
+    SCR_NOTIFICATION    = 4,
+
+    /* SError bits */
+    SERR_DATA_RECOVERED    = (1 << 0), /* recovered data error */
+    SERR_COMM_RECOVERED    = (1 << 1), /* recovered comm failure */
+    SERR_DATA        = (1 << 8), /* unrecovered data error */
+    SERR_PERSISTENT        = (1 << 9), /* persistent data/comm error */
+    SERR_PROTOCOL        = (1 << 10), /* protocol violation */
+    SERR_INTERNAL        = (1 << 11), /* host internal error */
+    SERR_PHYRDY_CHG        = (1 << 16), /* PHY RDY changed */
+    SERR_PHY_INT_ERR    = (1 << 17), /* PHY internal error */
+    SERR_COMM_WAKE        = (1 << 18), /* Comm wake */
+    SERR_10B_8B_ERR        = (1 << 19), /* 10b to 8b decode error */
+    SERR_DISPARITY        = (1 << 20), /* Disparity */
+    SERR_CRC        = (1 << 21), /* CRC error */
+    SERR_HANDSHAKE        = (1 << 22), /* Handshake error */
+    SERR_LINK_SEQ_ERR    = (1 << 23), /* Link sequence error */
+    SERR_TRANS_ST_ERROR    = (1 << 24), /* Transport state trans. error */
+    SERR_UNRECOG_FIS    = (1 << 25), /* Unrecognized FIS */
+    SERR_DEV_XCHG        = (1 << 26), /* device exchanged */
+
+    /* struct ata_taskfile flags */
+    ATA_TFLAG_LBA48        = (1 << 0), /* enable 48-bit LBA and "HOB" */
+    ATA_TFLAG_ISADDR    = (1 << 1), /* enable r/w to nsect/lba regs */
+    ATA_TFLAG_DEVICE    = (1 << 2), /* enable r/w to device reg */
+    ATA_TFLAG_WRITE        = (1 << 3), /* data dir: host->dev==1 (write) */
+    ATA_TFLAG_LBA        = (1 << 4), /* enable LBA */
+    ATA_TFLAG_FUA        = (1 << 5), /* enable FUA */
+    ATA_TFLAG_POLLING    = (1 << 6), /* set nIEN to 1 and use polling */
+
+    /* protocol flags */
+    ATA_PROT_FLAG_PIO    = (1 << 0), /* is PIO */
+    ATA_PROT_FLAG_DMA    = (1 << 1), /* is DMA */
+    ATA_PROT_FLAG_DATA    = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
+    ATA_PROT_FLAG_NCQ    = (1 << 2), /* is NCQ */
+    ATA_PROT_FLAG_ATAPI    = (1 << 3), /* is ATAPI */
+};
+
+enum ata_tf_protocols {
+    /* ATA taskfile protocols */
+    ATA_PROT_UNKNOWN,    /* unknown/invalid */
+    ATA_PROT_NODATA,    /* no data */
+    ATA_PROT_PIO,        /* PIO data xfer */
+    ATA_PROT_DMA,        /* DMA */
+    ATA_PROT_NCQ,        /* NCQ */
+    ATAPI_PROT_NODATA,    /* packet command, no data */
+    ATAPI_PROT_PIO,        /* packet command, PIO data xfer*/
+    ATAPI_PROT_DMA,        /* packet command with special DMA sauce */
+};
+
+enum ata_ioctls {
+    ATA_IOC_GET_IO32    = 0x309,
+    ATA_IOC_SET_IO32    = 0x324,
+};
+
+enum ata_dev_typed {
+    ATA_DEV_ATA,        /* ATA device */
+    ATA_DEV_ATAPI,        /* ATAPI device */
+    ATA_DEV_PMP,        /* Port Multiplier Port */
+    ATA_DEV_UNKNOWN,    /* unknown */
+};
+
+struct ata_taskfile {
+    unsigned long        flags;        /* ATA_TFLAG_xxx */
+    u8            protocol;    /* ATA_PROT_xxx */
+
+    u8            ctl;        /* control reg */
+
+    u8            hob_feature;    /* additional data */
+    u8            hob_nsect;    /* to support LBA48 */
+    u8            hob_lbal;
+    u8            hob_lbam;
+    u8            hob_lbah;
+
+    u8            feature;
+    u8            nsect;
+    u8            lbal;
+    u8            lbam;
+    u8            lbah;
+
+    u8            device;
+
+    u8            command;    /* IO operation */
+};
+
+/*
+ * protocol tests
+ */
+static inline unsigned int ata_prot_flags(u8 prot)
+{
+    switch (prot) {
+    case ATA_PROT_NODATA:
+        return 0;
+    case ATA_PROT_PIO:
+        return ATA_PROT_FLAG_PIO;
+    case ATA_PROT_DMA:
+        return ATA_PROT_FLAG_DMA;
+    case ATA_PROT_NCQ:
+        return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
+    case ATAPI_PROT_NODATA:
+        return ATA_PROT_FLAG_ATAPI;
+    case ATAPI_PROT_PIO:
+        return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
+    case ATAPI_PROT_DMA:
+        return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
+    }
+    return 0;
+}
+
+static inline int ata_is_atapi(u8 prot)
+{
+    return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
+}
+
+static inline int ata_is_nodata(u8 prot)
+{
+    return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
+}
+
+static inline int ata_is_pio(u8 prot)
+{
+    return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
+}
+
+static inline int ata_is_dma(u8 prot)
+{
+    return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
+}
+
+static inline int ata_is_ncq(u8 prot)
+{
+    return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
+}
+
+static inline int ata_is_data(u8 prot)
+{
+    return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
+}
+
+/*
+ * id tests
+ */
+#define ata_id_is_ata(id)        (((id)[0] & (1 << 15)) == 0)
+#define ata_id_has_lba(id)        ((id)[49] & (1 << 9))
+#define ata_id_has_dma(id)        ((id)[49] & (1 << 8))
+#define ata_id_has_ncq(id)        ((id)[76] & (1 << 8))
+#define ata_id_queue_depth(id)        (((id)[75] & 0x1f) + 1)
+#define ata_id_removeable(id)        ((id)[0] & (1 << 7))
+#define ata_id_iordy_disable(id)    ((id)[49] & (1 << 10))
+#define ata_id_has_iordy(id)        ((id)[49] & (1 << 11))
+
+#define ata_id_u32(id,n)    \
+    (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
+#define ata_id_u64(id,n)    \
+    ( ((u64) (id)[(n) + 3] << 48) | \
+      ((u64) (id)[(n) + 2] << 32) | \
+      ((u64) (id)[(n) + 1] << 16) | \
+      ((u64) (id)[(n) + 0]) )
+
+#define ata_id_cdb_intr(id)        (((id)[0] & 0x60) == 0x20)
+
+static inline int ata_id_has_fua(const u16 *id)
+{
+    if ((id[84] & 0xC000) != 0x4000)
+        return 0;
+    return id[84] & (1 << 6);
+}
+
+static inline int ata_id_has_flush(const u16 *id)
+{
+    if ((id[83] & 0xC000) != 0x4000)
+        return 0;
+    return id[83] & (1 << 12);
+}
+
+static inline int ata_id_has_flush_ext(const u16 *id)
+{
+    if ((id[83] & 0xC000) != 0x4000)
+        return 0;
+    return id[83] & (1 << 13);
+}
+
+static inline int ata_id_has_lba48(const u16 *id)
+{
+    if ((id[83] & 0xC000) != 0x4000)
+        return 0;
+    if (!ata_id_u64(id, 100))
+        return 0;
+    return id[83] & (1 << 10);
+}
+
+static inline int ata_id_hpa_enabled(const u16 *id)
+{
+    /* Yes children, word 83 valid bits cover word 82 data */
+    if ((id[83] & 0xC000) != 0x4000)
+        return 0;
+    /* And 87 covers 85-87 */
+    if ((id[87] & 0xC000) != 0x4000)
+        return 0;
+    /* Check command sets enabled as well as supported */
+    if ((id[85] & ( 1 << 10)) == 0)
+        return 0;
+    return id[82] & (1 << 10);
+}
+
+static inline int ata_id_has_wcache(const u16 *id)
+{
+    /* Yes children, word 83 valid bits cover word 82 data */
+    if ((id[83] & 0xC000) != 0x4000)
+        return 0;
+    return id[82] & (1 << 5);
+}
+
+static inline int ata_id_has_pm(const u16 *id)
+{
+    if ((id[83] & 0xC000) != 0x4000)
+        return 0;
+    return id[82] & (1 << 3);
+}
+
+static inline int ata_id_rahead_enabled(const u16 *id)
+{
+    if ((id[87] & 0xC000) != 0x4000)
+        return 0;
+    return id[85] & (1 << 6);
+}
+
+static inline int ata_id_wcache_enabled(const u16 *id)
+{
+    if ((id[87] & 0xC000) != 0x4000)
+        return 0;
+    return id[85] & (1 << 5);
+}
+
+static inline unsigned int ata_id_major_version(const u16 *id)
+{
+    unsigned int mver;
+
+    if (id[ATA_ID_MAJOR_VER] == 0xFFFF)
+        return 0;
+
+    for (mver = 14; mver >= 1; mver--)
+        if (id[ATA_ID_MAJOR_VER] & (1 << mver))
+            break;
+    return mver;
+}
+
+static inline int ata_id_is_sata(const u16 *id)
+{
+    return ata_id_major_version(id) >= 5 && id[93] == 0;
+}
+
+static inline int ata_id_has_tpm(const u16 *id)
+{
+    /* The TPM bits are only valid on ATA8 */
+    if (ata_id_major_version(id) < 8)
+        return 0;
+    if ((id[48] & 0xC000) != 0x4000)
+        return 0;
+    return id[48] & (1 << 0);
+}
+
+static inline int ata_id_has_dword_io(const u16 *id)
+{
+    /* ATA 8 reuses this flag for "trusted" computing */
+    if (ata_id_major_version(id) > 7)
+        return 0;
+    if (id[48] & (1 << 0))
+        return 1;
+    return 0;
+}
+
+static inline int ata_id_current_chs_valid(const u16 *id)
+{
+    /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
+       has not been issued to the device then the values of
+       id[54] to id[56] are vendor specific. */
+    return (id[53] & 0x01) && /* Current translation valid */
+        id[54] &&  /* cylinders in current translation */
+        id[55] &&  /* heads in current translation */
+        id[55] <= 16 &&
+        id[56];    /* sectors in current translation */
+}
+
+static inline int ata_id_is_cfa(const u16 *id)
+{
+    u16 v = id[0];
+    if (v == 0x848A)    /* Standard CF */
+        return 1;
+    /* Could be CF hiding as standard ATA */
+    if (ata_id_major_version(id) >= 3 &&  id[82] != 0xFFFF &&
+            (id[82] & ( 1 << 2)))
+        return 1;
+    return 0;
+}
+
+static inline int ata_drive_40wire(const u16 *dev_id)
+{
+    if (ata_id_is_sata(dev_id))
+        return 0;    /* SATA */
+    if ((dev_id[93] & 0xE000) == 0x6000)
+        return 0;    /* 80 wire */
+    return 1;
+}
+
+static inline int ata_drive_40wire_relaxed(const u16 *dev_id)
+{
+    if ((dev_id[93] & 0x2000) == 0x2000)
+        return 0;    /* 80 wire */
+    return 1;
+}
+
+static inline int atapi_cdb_len(const u16 *dev_id)
+{
+    u16 tmp = dev_id[0] & 0x3;
+    switch (tmp) {
+    case 0:        return 12;
+    case 1:        return 16;
+    default:    return -1;
+    }
+}
+
+static inline int atapi_command_packet_set(const u16 *dev_id)
+{
+    return (dev_id[0] >> 8) & 0x1f;
+}
+
+static inline int atapi_id_dmadir(const u16 *dev_id)
+{
+    return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
+}
+
+static inline int is_multi_taskfile(struct ata_taskfile *tf)
+{
+    return (tf->command == ATA_CMD_READ_MULTI) ||
+           (tf->command == ATA_CMD_WRITE_MULTI) ||
+           (tf->command == ATA_CMD_READ_MULTI_EXT) ||
+           (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
+           (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
+}
+
+static inline int ata_ok(u8 status)
+{
+    return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
+            == ATA_DRDY);
+}
+
+static inline int lba_28_ok(u64 block, u32 n_block)
+{
+    /* check the ending block number */
+    return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256);
+}
+
+static inline int lba_48_ok(u64 block, u32 n_block)
+{
+    /* check the ending block number */
+    return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536);
+}
+
+#define sata_pmp_gscr_vendor(gscr)    ((gscr)[SATA_PMP_GSCR_PROD_ID] & 0xffff)
+#define sata_pmp_gscr_devid(gscr)    ((gscr)[SATA_PMP_GSCR_PROD_ID] >> 16)
+#define sata_pmp_gscr_rev(gscr)        (((gscr)[SATA_PMP_GSCR_REV] >> 8) & 0xff)
+#define sata_pmp_gscr_ports(gscr)    ((gscr)[SATA_PMP_GSCR_PORT_INFO] & 0xf)
+
+u64 ata_id_n_sectors(u16 *id);
+u32 ata_dev_classify(u32 sig);
+void ata_id_c_string(const u16 *id, unsigned char *s,
+             unsigned int ofs, unsigned int len);
+void ata_dump_id(u16 *id);
+void ata_swap_buf_le16(u16 *buf, unsigned int buf_words);
+
+#endif /* __LIBATA_H__ */

+ 10 - 0
bsp/ls2kdev/drivers/pci/SConscript

@@ -0,0 +1,10 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c')
+
+CPPPATH = [cwd]
+
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')

+ 20 - 0
bsp/ls2kdev/drivers/pci/pci.c

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-12-28     lizhirui     first version
+ */
+
+#include <rtthread.h>
+#include <pci.h>
+
+rt_uint64_t pci_get_device_map_addr(rt_uint64_t bus,rt_uint64_t device,rt_uint64_t function,rt_uint32_t index)
+{
+
+    rt_uint64_t device_addr = 0xFE00000000 | (bus << 16) | ((device & 0x1f) << 11) | ((function & 0x07) << 8);
+    struct pci_header *p = (struct pci_header *)(0x9000000000000000UL | device_addr);
+    return 0x9000000000000000UL | ((rt_uint64_t)(p -> BaseAddressRegister[index] & 0xFFFFFFF0));
+}

+ 42 - 0
bsp/ls2kdev/drivers/pci/pci.h

@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2020-12-28     lizhirui     first version
+ */
+
+#ifndef __PCI_H__
+#define __PCI_H__
+
+    struct pci_header
+    {
+        rt_uint16_t VendorID;
+        rt_uint16_t DeviceID;
+        rt_uint16_t Command;
+        rt_uint16_t Status;
+        rt_uint32_t RevisionID : 8;
+        rt_uint32_t ClassCode : 24;
+        rt_uint8_t CachelineSize;
+        rt_uint8_t LatencyTimer;
+        rt_uint8_t HeaderType;
+        rt_uint8_t BIST;
+        rt_uint32_t BaseAddressRegister[6];
+        rt_uint32_t CardbusCISPointer;
+        rt_uint16_t SubsystemVendorID;
+        rt_uint16_t SubsystemID;
+        rt_uint32_t ExpansionROMBaseAddress;
+        rt_uint32_t CapabilitiesPointer : 8;
+        rt_uint32_t resv1 : 24;
+        rt_uint32_t resv2;
+        rt_uint8_t InterruptLine;
+        rt_uint8_t InterruptPin;
+        rt_uint8_t Min_Gnt;
+        rt_uint8_t Max_Lat;
+    };
+
+    rt_uint64_t pci_get_device_map_addr(rt_uint64_t bus,rt_uint64_t device,rt_uint64_t function,rt_uint32_t index);
+
+#endif

+ 6 - 3
bsp/ls2kdev/rtconfig.h

@@ -219,9 +219,9 @@
 
 /* system packages */
 
-#define PKG_USING_LWEXT4
-#define RT_USING_DFS_LWEXT4
-#define PKG_USING_LWEXT4_LATEST_VERSION
+
+/* Micrium: Micrium software products porting for RT-Thread */
+
 
 /* peripheral libraries and drivers */
 
@@ -231,6 +231,9 @@
 
 /* samples: kernel and components samples */
 
+
+/* games: games run on RT-Thread console */
+
 #define SOC_LS2K1000
 
 #endif

+ 12 - 1
bsp/nrf5x/libraries/templates/nrf52x/applications/ble_nus_app.c

@@ -599,9 +599,20 @@ static void _stack_thread(void *parameter)
     {
         rt_uint32_t event = 0;
         rt_tick_t dispatch_timeout = RT_WAITING_NO;
+        rt_err_t result;
 
-        rt_event_recv(stack_event, STACK_EV_DISCON | STACK_EV_DISPATCH | STACK_EV_KEY,
+        result = rt_event_recv(stack_event, STACK_EV_DISCON | STACK_EV_DISPATCH | STACK_EV_KEY,
                     RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, next_timeout, &event);
+        if (result == -RT_ETIMEOUT) 
+        {
+            LOG_E("wait completed timeout");
+            continue;
+        }
+        else if (result == -RT_ERROR) 
+        {
+            LOG_E("event received error");
+            continue;
+        }
 
         if (evt_dispatch_worker() != RT_EOK)
         {

+ 3 - 2
bsp/nuvoton/README.md

@@ -3,5 +3,6 @@ Current supported BSP shown in below table:
 
 | **BSP folder** | **Board name** |
 |:------------------------- |:-------------------------- |
-| [numaker-iot-m487](numaker-iot-m487) | Nuvoton NuMaker-IoT-m487 |
-| [numaker-pfm-m487](numaker-pfm-m487) | Nuvoton NuMaker-PFM-m487 |
+| [numaker-iot-m487](numaker-iot-m487) | Nuvoton NuMaker-IoT-M487 |
+| [numaker-pfm-m487](numaker-pfm-m487) | Nuvoton NuMaker-PFM-M487 |
+| [nk-980iot](nk-980iot) | Nuvoton NK-980IOT |

+ 2 - 2
bsp/nuvoton/libraries/m480/StdDriver/src/nu_can.c

@@ -1148,11 +1148,11 @@ int32_t CAN_SetRxMsgAndMsk(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType,
 int32_t CAN_SetMultiRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32MsgCount, uint32_t u32IDType, uint32_t u32ID)
 {
     int32_t  rev = (int32_t)TRUE;
-    uint32_t i = 0ul;
+    uint32_t i;
     uint32_t u32TimeOutCount;
     uint32_t u32EOB_Flag = 0ul;
 
-    for(i = 1ul; i < u32MsgCount; i++)
+    for(i = 1ul; i <= u32MsgCount; i++)
     {
         u32TimeOutCount = 0ul;
 

+ 1 - 1
bsp/nuvoton/libraries/m480/USBHostLib/inc/usbh_lib.h

@@ -141,7 +141,7 @@ typedef int (UAC_CB_FUNC)(struct uac_dev_t *dev, uint8_t *data, int len);    /*!
 /*                                                                  */
 /*------------------------------------------------------------------*/
 extern void usbh_core_init(void);
-extern int  usbh_pooling_root_hubs(void);
+extern int  usbh_polling_root_hubs(void);
 extern void usbh_install_conn_callback(CONN_FUNC *conn_func, CONN_FUNC *disconn_func);
 extern void usbh_suspend(void);
 extern void usbh_resume(void);

+ 1 - 1
bsp/nuvoton/libraries/m480/USBHostLib/src/usb_core.c

@@ -80,7 +80,7 @@ void  usbh_core_init()
   * @retval   0   No any hub port status changes found.
   * @retval   1   There's hub port status changes.
   */
-int  usbh_pooling_root_hubs(void)
+int  usbh_polling_root_hubs(void)
 {
     int   ret, change = 0;
 

+ 7 - 0
bsp/nuvoton/libraries/m480/rtt_port/Kconfig

@@ -941,6 +941,13 @@ config SOC_SERIES_M480
         select RT_USING_USB_HOST
         select RT_USBH_MSTORAGE
 
+    if BSP_USING_USBH || BSP_USING_HSUSBH
+        config NU_USBHOST_HUB_POLLING_INTERVAL
+            int "USB Root Hub Polling Interval(in Mili-seconds)"
+            range 100 2000
+            default 100
+    endif
+
     config BSP_USING_HSOTG
         bool "Enable High-Speed USB On-The-Go(HSOTG)"
         select BSP_USING_HSUSBH

+ 4 - 2
bsp/nuvoton/libraries/m480/rtt_port/drv_bpwm_capture.c

@@ -12,6 +12,7 @@
 #include <rtconfig.h>
 
 #if defined(BSP_USING_BPWM_CAPTURE)
+#if ((BSP_USING_BPWM0_CAPTURE_CHMSK+BSP_USING_BPWM1_CAPTURE_CHMSK)!=0)
 #include <rtdevice.h>
 #include <NuMicro.h>
 
@@ -211,7 +212,7 @@ static rt_err_t nu_bpwm_init(nu_capture_t *nu_capture)
             /* Enable BPWM0 clock */
             SYS_UnlockReg();
             CLK_EnableModuleClock(BPWM0_MODULE);
-            CLK_SetModuleClock(BPWM0_MODULE, CLK_CLKSEL2_BPWM0SEL_PLL, (uint32_t)NULL);
+            CLK_SetModuleClock(BPWM0_MODULE, CLK_CLKSEL2_BPWM0SEL_PLL, 0);
             SYS_LockReg();
             bpwm_config(nu_capture);
             bBPWM0Inited = RT_TRUE;
@@ -225,7 +226,7 @@ static rt_err_t nu_bpwm_init(nu_capture_t *nu_capture)
             /* Enable BPWM1 clock */
             SYS_UnlockReg();
             CLK_EnableModuleClock(BPWM1_MODULE);
-            CLK_SetModuleClock(BPWM1_MODULE, CLK_CLKSEL2_BPWM1SEL_PLL, (uint32_t)NULL);
+            CLK_SetModuleClock(BPWM1_MODULE, CLK_CLKSEL2_BPWM1SEL_PLL, 0);
             SYS_LockReg();
             bpwm_config(nu_capture);
             bBPWM1Inited = RT_TRUE;
@@ -330,4 +331,5 @@ static int nu_bpwm_capture_device_init(void)
 }
 INIT_DEVICE_EXPORT(nu_bpwm_capture_device_init);
 
+#endif  //#if ((BSP_USING_BPWM0_CAPTURE_CHMSK+BSP_USING_BPWM1_CAPTURE_CHMSK)!=0)
 #endif //#if defined(BSP_USING_BPWM_CAPTURE)

+ 41 - 30
bsp/nuvoton/libraries/m480/rtt_port/drv_can.c

@@ -166,33 +166,31 @@ static void nu_can_isr(nu_can_t can)
     CAN_T *can_base = ((nu_can_t)can)->can_base;
 
     /* Get interrupt event */
-    u32IIDRstatus = can_base->IIDR;
+    u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(can_base);
 
     if (u32IIDRstatus == 0x00008000)       /* Check Status Interrupt Flag (Error status Int and Status change Int) */
     {
         /**************************/
         /* Status Change interrupt*/
         /**************************/
-        if (can_base->STATUS & CAN_STATUS_RXOK_Msk)
+        if (can_base->STATUS & CAN_STATUS_TXOK_Msk)
         {
-
+            can_base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
 #ifndef RT_CAN_USING_HDR
             /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_RX_IND);
+            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_TX_DONE);
 #endif
-            can_base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
-            rt_kprintf("RX OK INT\n") ;
+            //rt_kprintf("[%s]TX OK INT\n", can->name) ;
         }
 
-        if (can_base->STATUS & CAN_STATUS_TXOK_Msk)
+        if (can_base->STATUS & CAN_STATUS_RXOK_Msk)
         {
-
+            can_base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
 #ifndef RT_CAN_USING_HDR
             /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_TX_DONE);
+            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_RX_IND);
 #endif
-            can_base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
-            rt_kprintf("TX OK INT\n") ;
+            //rt_kprintf("[%s]RX OK INT\n", can->name) ;
         }
 
         /**************************/
@@ -200,12 +198,12 @@ static void nu_can_isr(nu_can_t can)
         /**************************/
         if (can_base->STATUS & CAN_STATUS_EWARN_Msk)
         {
-            rt_kprintf("EWARN INT\n") ;
+            rt_kprintf("[%s]EWARN INT\n", can->name) ;
         }
 
         if (can_base->STATUS & CAN_STATUS_BOFF_Msk)
         {
-            rt_kprintf("BOFF INT\n") ;
+            rt_kprintf("[%s]BUSOFF INT\n", can->name) ;
 
             /* Do Init to release busoff pin */
             can_base->CON = (CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
@@ -214,18 +212,21 @@ static void nu_can_isr(nu_can_t can)
         }
     }
 #ifdef RT_CAN_USING_HDR
-    /*Number of Message Object which caused the interrupt*/
-    else if (u32IIDRstatus != 0 && u32IIDRstatus <= 32)
+    /*IntId: 0x0001-0x0020, Number of Message Object which caused the interrupt.*/
+    else if (u32IIDRstatus > 0 && u32IIDRstatus <= 32)
     {
-        rt_kprintf("=> Interrupt Pointer = %d\n", can_base->IIDR - 1);
-        /*Message RAM 0~15 for CAN Tx using*/
-        if (u32IIDRstatus < 16)
+        /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
+        if (u32IIDRstatus <= RX_MSG_ID_INDEX)
+        {
+            //rt_kprintf("[%s-Tx]IntId = %d\n", can->name, u32IIDRstatus);
             rt_hw_can_isr(&can->dev, RT_CAN_EVENT_TX_DONE);
-        else /*Message RAM 16~31 for CAN Rx using*/
+        }
+        else /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
         {
-            rt_hw_can_isr(&can->dev, (RT_CAN_EVENT_RX_IND | (((can_base->IIDR) - 1) << 8)));
+            //rt_kprintf("[%s-Rx]IntId = %d\n", can->name, u32IIDRstatus);
+            rt_hw_can_isr(&can->dev, (RT_CAN_EVENT_RX_IND | ((u32IIDRstatus - 1) << 8)));
         }
-        CAN_CLR_INT_PENDING_BIT(can_base, ((can_base->IIDR) - 1));     /* Clear Interrupt Pending */
+        CAN_CLR_INT_PENDING_BIT(can_base, (u32IIDRstatus - 1));     /* Clear Interrupt Pending */
     }
 #endif
 
@@ -316,7 +317,7 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
     CAN_T *can_base = ((nu_can_t)can)->can_base;
 
     RT_ASSERT(can_base != RT_NULL);
-    /* Check baudrate */
+    /* Check baud rate */
     RT_ASSERT(can->config.baud_rate != 0);
 
     switch (cmd)
@@ -359,8 +360,8 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
         }
         break;
 
-    case RT_CAN_CMD_SET_FILTER:
 #ifdef RT_CAN_USING_HDR
+    case RT_CAN_CMD_SET_FILTER:
         filter_cfg = (struct rt_can_filter_config *)arg;
 
         for (int i = 0; i < filter_cfg->count; i++)
@@ -369,7 +370,7 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
             /*set the filter message object*/
             if (filter_cfg->items[i].mode == 1)
             {
-                if (CAN_SetRxMsgObjAndMsk(can_base, MSG(i + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
+                if (CAN_SetRxMsgObjAndMsk(can_base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
@@ -378,14 +379,15 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 
             {
                 /*set the filter message object*/
-                if (CAN_SetRxMsgAndMsk(can_base, MSG(i + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
+                if (CAN_SetRxMsgAndMsk(can_base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
             }
         }
-#endif
         break;
+#endif
+
     case RT_CAN_CMD_SET_MODE:
         argval = (rt_uint32_t) arg;
         if (argval != RT_CAN_MODE_NORMAL && argval != RT_CAN_MODE_LISEN &&
@@ -399,6 +401,7 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
             return nu_can_configure(can, &can->config);
         }
         break;
+
     case RT_CAN_CMD_SET_BAUD:
         argval = (rt_uint32_t) arg;
         if (argval != CAN1MBaud && argval != CAN800kBaud && argval != CAN500kBaud && argval != CAN250kBaud &&
@@ -412,6 +415,7 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
             return nu_can_configure(can, &can->config);
         }
         break;
+
     case RT_CAN_CMD_SET_PRIV:
         argval = (rt_uint32_t) arg;
         if (argval != RT_CAN_MODE_PRIV && argval != RT_CAN_MODE_NOPRIV)
@@ -439,7 +443,7 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
     }
     break;
     default:
-       return -(RT_EINVAL);
+        return -(RT_EINVAL);
 
     }
 
@@ -503,11 +507,16 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
     RT_ASSERT(buf != RT_NULL);
 
     /* get data */
-    CAN_Receive(can_base, boxno, &tMsg);
+    if (CAN_Receive(can_base, boxno, &tMsg) == FALSE)
+    {
+        rt_kprintf("No available RX Msg.\n");
+        return -(RT_ERROR);
+    }
 
 #ifdef RT_CAN_USING_HDR
     /* Hardware filter messages are valid */
-    can->hdr->connected = 1;
+    pmsg->hdr = boxno - RX_MSG_ID_INDEX;
+    can->hdr[pmsg->hdr].connected = 1;
 #endif
 
     /* Standard ID (11 bits)*/
@@ -521,6 +530,7 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
         pmsg->ide = RT_CAN_EXTID;
         pmsg->id  = tMsg.Id;
     }
+
     if (tMsg.FrameType == CAN_DATA_FRAME)
     {
         /* Data frame */
@@ -531,9 +541,10 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
         /* Remote frame */
         pmsg->rtr = RT_CAN_RTR;
     }
+
     pmsg->len = tMsg.DLC ;
-    rt_memcpy(pmsg->data, tMsg.Data, pmsg->len);
 
+    rt_memcpy(pmsg->data, tMsg.Data, pmsg->len);
 
     return RT_EOK;
 }

+ 20 - 40
bsp/nuvoton/libraries/m480/rtt_port/drv_clk.c

@@ -89,64 +89,44 @@ static struct rt_pm_ops ops =
 
 struct rt_device pm;
 
-
+/* Sleep and power-down mapping */
+const static uint32_t g_au32SleepingMode[PM_SLEEP_MODE_MAX] =
+{
+    0,
+    0,
+    CONFIG_MODE_LIGHT,
+    CONFIG_MODE_DEEP,
+    CONFIG_MODE_STANDBY,
+    CONFIG_MODE_SHUTDOWN
+};
 
 /* pm sleep() entry */
 static void pm_sleep(struct rt_pm *pm, rt_uint8_t mode)
 {
-    SYS_UnlockReg();
+    RT_ASSERT(mode < PM_SLEEP_MODE_MAX);
+
+    if ((mode == PM_SLEEP_MODE_NONE) || (mode == PM_SLEEP_MODE_IDLE))
+        return;
 
-    switch (mode)
-    {
     /*  wake-up source:                                                    */
     /*      PM_SLEEP_MODE_LIGHT : TIMERn                                   */
     /*      PM_SLEEP_MODE_DEEP : TIMERn                                    */
     /*      PM_SLEEP_MODE_STANDBY : wake-up timer  (optional)              */
     /*      PM_SLEEP_MODE_SHUTDOWN : wake-up timer  (optional)             */
 
-    case PM_SLEEP_MODE_NONE:
-    case PM_SLEEP_MODE_IDLE:
-        break;
-
-    case PM_SLEEP_MODE_LIGHT:
-
-        CLK_SetPowerDownMode(CONFIG_MODE_LIGHT);
-        CLK_PowerDown();
-        break;
-
-    case PM_SLEEP_MODE_DEEP:
-
-        CLK_SetPowerDownMode(CONFIG_MODE_DEEP);
-        CLK_PowerDown();
-        break;
-
-    case PM_SLEEP_MODE_STANDBY:
-
-#if defined (NU_CLK_INVOKE_WKTMR)
-
-        /* Enable wake-up timer with pre-defined interval if it is invoked */
-        CLK_SET_WKTMR_INTERVAL(WKTMR_INTERVAL);
-        CLK_ENABLE_WKTMR();
-#endif
-        CLK_SetPowerDownMode(CONFIG_MODE_STANDBY);
-        CLK_PowerDown();
-        break;
-
-    case PM_SLEEP_MODE_SHUTDOWN:
+    SYS_UnlockReg();
 
 #if defined (NU_CLK_INVOKE_WKTMR)
+    if ((mode == PM_SLEEP_MODE_SHUTDOWN) || (mode == PM_SLEEP_MODE_STANDBY))
+    {
         /* Enable wake-up timer with pre-defined interval if it is invoked */
         CLK_SET_WKTMR_INTERVAL(WKTMR_INTERVAL);
         CLK_ENABLE_WKTMR();
+    }
 #endif
-        CLK_SetPowerDownMode(CONFIG_MODE_SHUTDOWN);
-        CLK_PowerDown();
-        break;
 
-    default:
-        RT_ASSERT(0);
-        break;
-    }
+    CLK_SetPowerDownMode(g_au32SleepingMode[mode]);
+    CLK_PowerDown();
 
     SYS_LockReg();
 }

+ 13 - 10
bsp/nuvoton/libraries/m480/rtt_port/drv_crc.c

@@ -25,6 +25,11 @@
 /* Private define ---------------------------------------------------------------*/
 #define NU_CRYPTO_CRC_NAME  "nu_CRC"
 
+#define CRC_32_POLY     0x04C11DB7
+#define CRC_CCITT_POLY  0x00001021
+#define CRC_16_POLY     0x00008005
+#define CRC_8_POLY      0x00000007
+
 /* Private variables ------------------------------------------------------------*/
 
 static struct rt_mutex s_CRC_mutex;
@@ -85,7 +90,6 @@ static rt_uint32_t nu_crc_run(
     return u32CalChecksum;
 }
 
-
 rt_err_t nu_crc_init(void)
 {
     SYS_ResetModule(CRC_RST);
@@ -103,30 +107,29 @@ rt_uint32_t nu_crc_update(struct hwcrypto_crc *ctx, const rt_uint8_t *in, rt_siz
     //select CRC operation mode
     switch (ctx->crc_cfg.poly)
     {
-    case 0x04C11DB7:
+    case CRC_32_POLY:
         u32OpMode = CRC_32;
         break;
-    case 0x00001021:
+    case CRC_CCITT_POLY:
         u32OpMode = CRC_CCITT;
         break;
-    case 0x00008005:
+    case CRC_16_POLY:
         u32OpMode = CRC_16;
         break;
-    case 0x00000007:
+    case CRC_8_POLY:
         u32OpMode = CRC_8;
         break;
     default:
         return 0;
     }
 
+    u32CRCAttr |= (ctx->crc_cfg.flags & CRC_FLAG_REFOUT) ? CRC_CHECKSUM_RVS : 0; //CRC Checksum Reverse
+    u32CRCAttr |= (ctx->crc_cfg.flags & CRC_FLAG_REFIN) ? CRC_WDATA_RVS : 0;  //CRC Write Data Reverse
 
-    u32CRCAttr |= ctx->crc_cfg.flags & CRC_FLAG_REFOUT ? CRC_CHECKSUM_RVS : 0; //CRC Checksum Reverse
-    u32CRCAttr |= ctx->crc_cfg.flags & CRC_FLAG_REFIN ? CRC_WDATA_RVS : 0;  //CRC Write Data Reverse
-
-    //Calcluate CRC checksum, using config's last value as CRC seed
+    //Calculate CRC checksum, using config's last value as CRC seed
     crc_result = nu_crc_run(u32OpMode, ctx->crc_cfg.last_val, u32CRCAttr, (uint8_t *)in, length);
 
-    //update CRC result to config's last vaule
+    //update CRC result to config's last value
     ctx->crc_cfg.last_val = crc_result;
     return crc_result ^ 0x00 ^ ctx->crc_cfg.xorout;
 }

+ 0 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_crc.h

@@ -17,5 +17,4 @@ rt_err_t nu_crc_init(void);
 
 rt_uint32_t nu_crc_update(struct hwcrypto_crc *ctx, const rt_uint8_t *in, rt_size_t length);
 
-
 #endif

+ 239 - 60
bsp/nuvoton/libraries/m480/rtt_port/drv_crypto.c

@@ -15,10 +15,9 @@
 
 #if ((defined(BSP_USING_CRYPTO) || defined(BSP_USING_TRNG) || defined(BSP_USING_CRC)) && defined(RT_USING_HWCRYPTO))
 
-#include <string.h>
-
 #include <rtdevice.h>
 #include <rtdbg.h>
+#include <board.h>
 #include "NuMicro.h"
 #include <nu_bitutil.h>
 
@@ -32,6 +31,14 @@
 
 /* Private typedef --------------------------------------------------------------*/
 
+typedef struct
+{
+    uint8_t *pu8SHATempBuf;
+    uint32_t u32SHATempBufLen;
+    uint32_t u32DMAMode;
+    uint32_t u32BlockSize;
+} S_SHA_CONTEXT;
+
 /* Private functions ------------------------------------------------------------*/
 static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx);
 static void nu_hwcrypto_destroy(struct rt_hwcrypto_ctx *ctx);
@@ -50,9 +57,6 @@ static const struct rt_hwcrypto_ops nu_hwcrypto_ops =
 /* Crypto engine operation ------------------------------------------------------------*/
 #if defined(BSP_USING_CRYPTO)
 
-//define NU_HWCRYPTO_NOT_ALIGN_CHECK to disable plain/cipher buffer address alignment checking
-//#define NU_HWCRYPTO_NOT_ALIGN_CHECK
-
 #define NU_HWCRYPTO_DES_3KEYS    1
 #define NU_HWCRYPTO_DES_NO3KEYS  0
 #define NU_HWCRYPTO_AES_NAME    "nu_AES"
@@ -102,6 +106,8 @@ void CRYPTO_IRQHandler()
 {
     if (AES_GET_INT_FLAG(CRPT))
     {
+        if (CRPT->INTSTS & (CRPT_INTSTS_AESEIF_Msk) || (CRPT->AES_STS & (CRPT_AES_STS_BUSERR_Msk | CRPT_AES_STS_CNTERR_Msk | (0x1ul << 21))))
+            rt_kprintf("AES ERROR\n");
         s_AES_done = 1;
         AES_CLR_INT_FLAG(CRPT);
     }
@@ -114,6 +120,8 @@ void CRYPTO_IRQHandler()
 
     if (SHA_GET_INT_FLAG(CRPT))
     {
+        if (CRPT->INTSTS & (CRPT_INTSTS_HMACEIF_Msk) || (CRPT->HMAC_STS & (CRPT_HMAC_STS_DMAERR_Msk | (0x1ul << 9))))
+            rt_kprintf("SHA ERROR\n");
         s_SHA_done = 1;
         SHA_CLR_INT_FLAG(CRPT);
     }
@@ -218,8 +226,11 @@ static rt_err_t nu_aes_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
     uint32_t u32AESOpMode;
     uint32_t u32AESKeySize;
     unsigned char *in, *out;
+    unsigned char in_align_flag = 0;
+    unsigned char out_align_flag = 0;
+    unsigned char iv_temp[16];
 
-    if ((symmetric_info->length % 16) != 0)
+    if ((symmetric_info->length % 4) != 0)
     {
         return -RT_EINVAL;
     }
@@ -267,12 +278,8 @@ static rt_err_t nu_aes_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
     in = (unsigned char *)symmetric_info->in;
     out = (unsigned char *)symmetric_info->out;
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
-    unsigned char in_align_flag = 0;
-    unsigned char out_align_flag = 0;
-
-    //Checking in/out data buffer address alignment or not
-    if (((rt_uint32_t)in % 4) != 0)
+    //Checking in/out data buffer address not alignment or out of SRAM
+    if (((rt_uint32_t)in % 4) != 0 || ((rt_uint32_t)in < SRAM_BASE) || ((rt_uint32_t)in > SRAM_END))
     {
         in = rt_malloc(symmetric_info->length);
         if (in == RT_NULL)
@@ -281,11 +288,11 @@ static rt_err_t nu_aes_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
             return -RT_ENOMEM;
         }
 
-        memcpy(in, symmetric_info->in, symmetric_info->length);
+        rt_memcpy(in, symmetric_info->in, symmetric_info->length);
         in_align_flag = 1;
     }
 
-    if (((rt_uint32_t)out % 4) != 0)
+    if (((rt_uint32_t)out % 4) != 0 || ((rt_uint32_t)out < SRAM_BASE) || ((rt_uint32_t)out > SRAM_END))
     {
         out = rt_malloc(symmetric_info->length);
         if (out == RT_NULL)
@@ -298,14 +305,35 @@ static rt_err_t nu_aes_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
 
         out_align_flag = 1;
     }
-#endif
+
+    if ((u32AESOpMode == AES_MODE_CBC) && (symmetric_info->mode == HWCRYPTO_MODE_DECRYPT))
+    {
+        uint32_t loop;
+
+        loop = (symmetric_info->length - 1) / 16;
+        rt_memcpy(iv_temp, in + (loop * 16), 16);
+    }
 
     nu_aes_crypt_run(symmetric_info->mode == HWCRYPTO_MODE_ENCRYPT ? TRUE : FALSE, u32AESOpMode, symmetric_ctx->key, u32AESKeySize, symmetric_ctx->iv, in, out, symmetric_info->length);
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
+    if (u32AESOpMode == AES_MODE_CBC)
+    {
+        if (symmetric_info->mode == HWCRYPTO_MODE_DECRYPT)
+        {
+            rt_memcpy(symmetric_ctx->iv, iv_temp, 16);
+        }
+        else
+        {
+            uint32_t loop;
+
+            loop = (symmetric_info->length - 1) / 16;
+            rt_memcpy(symmetric_ctx->iv, out + (loop * 16), 16);
+        }
+    }
+
     if (out_align_flag)
     {
-        memcpy(symmetric_info->out, out, symmetric_info->length);
+        rt_memcpy(symmetric_info->out, out, symmetric_info->length);
         rt_free(out);
     }
 
@@ -313,7 +341,6 @@ static rt_err_t nu_aes_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
     {
         rt_free(in);
     }
-#endif
 
     return RT_EOK;
 }
@@ -371,6 +398,8 @@ static rt_err_t nu_des_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
     uint32_t u32DESOpMode;
     uint32_t u32DESKeySize;
     unsigned char *in, *out;
+    unsigned char in_align_flag = 0;
+    unsigned char out_align_flag = 0;
 
     if ((symmetric_info->length % 8) != 0)
     {
@@ -413,12 +442,8 @@ static rt_err_t nu_des_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
     in = (unsigned char *)symmetric_info->in;
     out = (unsigned char *)symmetric_info->out;
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
-    unsigned char in_align_flag = 0;
-    unsigned char out_align_flag = 0;
-
-    //Checking in/out data buffer address alignment or not
-    if (((rt_uint32_t)in % 4) != 0)
+    //Checking in/out data buffer address not alignment or out of SRAM
+    if (((rt_uint32_t)in % 4) != 0 || ((rt_uint32_t)in < SRAM_BASE) || ((rt_uint32_t)in > SRAM_END))
     {
         in = rt_malloc(symmetric_info->length);
         if (in == RT_NULL)
@@ -427,11 +452,11 @@ static rt_err_t nu_des_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
             return -RT_ENOMEM;
         }
 
-        memcpy(in, symmetric_info->in, symmetric_info->length);
+        rt_memcpy(in, symmetric_info->in, symmetric_info->length);
         in_align_flag = 1;
     }
 
-    if (((rt_uint32_t)out % 4) != 0)
+    if (((rt_uint32_t)out % 4) != 0 || ((rt_uint32_t)out < SRAM_BASE) || ((rt_uint32_t)out > SRAM_END))
     {
         out = rt_malloc(symmetric_info->length);
         if (out == RT_NULL)
@@ -444,14 +469,12 @@ static rt_err_t nu_des_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
 
         out_align_flag = 1;
     }
-#endif
 
     nu_des_crypt_run(symmetric_info->mode == HWCRYPTO_MODE_ENCRYPT ? TRUE : FALSE, u32DESOpMode, symmetric_ctx->key, u32DESKeySize, symmetric_ctx->iv, in, out, symmetric_info->length);
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
     if (out_align_flag)
     {
-        memcpy(symmetric_info->out, out, symmetric_info->length);
+        rt_memcpy(symmetric_info->out, out, symmetric_info->length);
         rt_free(out);
     }
 
@@ -459,12 +482,53 @@ static rt_err_t nu_des_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hw
     {
         rt_free(in);
     }
-#endif
 
     return RT_EOK;
 }
 
+#define CRPT_HMAC_CTL_DMAFIRST_Pos     (4)                                               /*!< CRPT_T::HMAC_CTL: DMAFIRST Position  */
+#define CRPT_HMAC_CTL_DMAFIRST_Msk     (0x1ul << CRPT_HMAC_CTL_DMAFIRST_Pos)           /*!< CRPT_T::HMAC_CTL: DMAFIRST Mask      */
+
+static void SHABlockUpdate(uint32_t u32OpMode, uint32_t u32SrcAddr, uint32_t u32Len, uint32_t u32Mode)
+{
+    SHA_Open(CRPT, u32OpMode, SHA_IN_OUT_SWAP, 0);
+
+    //Setup SHA DMA
+    SHA_SetDMATransfer(CRPT, u32SrcAddr, u32Len);
+    SHA_CLR_INT_FLAG(CRPT);
+
+    //Start SHA
+    s_SHA_done = 0;
+
+    if (u32Mode == CRYPTO_DMA_FIRST)
+    {
+        if ((SYS->CSERVER & SYS_CSERVER_VERSION_Msk) == 0x0)
+        {
+            //M480MD version
+            u32Mode = CRYPTO_DMA_CONTINUE;
+        }
+        else
+        {
+            //M480LD version
+            CRPT->HMAC_CTL |= CRPT_HMAC_CTL_DMAFIRST_Msk;
+        }
+    }
+    else
+    {
+        if ((SYS->CSERVER & SYS_CSERVER_VERSION_Msk) != 0x0)
+        {
+            //M480LD version
+            CRPT->HMAC_CTL &= ~CRPT_HMAC_CTL_DMAFIRST_Msk;
+        }
+    }
+
+    SHA_Start(CRPT, u32Mode);
+
+    while (!s_SHA_done) {};
+}
+
 static rt_err_t nu_sha_hash_run(
+    S_SHA_CONTEXT *psSHACtx,
     uint32_t u32OpMode,
     uint8_t *pu8InData,
     uint32_t u32DataLen
@@ -472,16 +536,82 @@ static rt_err_t nu_sha_hash_run(
 {
     rt_mutex_take(&s_SHA_mutex, RT_WAITING_FOREVER);
 
-    //Using SHA
-    SHA_Open(CRPT, u32OpMode, SHA_IN_OUT_SWAP, 0);
+    uint8_t *pu8SrcAddr = (uint8_t *)pu8InData;
+    uint32_t u32CopyLen = 0;
 
-    //Setup SHA DMA
-    SHA_SetDMATransfer(CRPT, (uint32_t)pu8InData, u32DataLen);
-    SHA_CLR_INT_FLAG(CRPT);
-    //Start SHA
-    s_SHA_done = 0;
-    SHA_Start(CRPT, CRYPTO_DMA_ONE_SHOT);
-    while (!s_SHA_done) {};
+    while ((psSHACtx->u32SHATempBufLen + u32DataLen) > psSHACtx->u32BlockSize)
+    {
+        if (psSHACtx->pu8SHATempBuf)
+        {
+            if (psSHACtx->u32SHATempBufLen == psSHACtx->u32BlockSize)
+            {
+                //Trigger SHA block update
+                SHABlockUpdate(u32OpMode, (uint32_t)psSHACtx->pu8SHATempBuf, psSHACtx->u32BlockSize, psSHACtx->u32DMAMode);
+                psSHACtx->u32DMAMode = CRYPTO_DMA_CONTINUE;
+                //free SHATempBuff
+                rt_free(psSHACtx->pu8SHATempBuf);
+                psSHACtx->pu8SHATempBuf = NULL;
+                psSHACtx->u32SHATempBufLen = 0;
+                continue;
+            }
+            else
+            {
+                u32CopyLen = psSHACtx->u32BlockSize - psSHACtx->u32SHATempBufLen;
+                if (u32DataLen < u32CopyLen)
+                    u32CopyLen = u32DataLen;
+                rt_memcpy(psSHACtx->pu8SHATempBuf + psSHACtx->u32SHATempBufLen, pu8SrcAddr, u32CopyLen);
+                psSHACtx->u32SHATempBufLen += u32CopyLen;
+                pu8SrcAddr += u32CopyLen;
+                u32DataLen -= u32CopyLen;
+                continue;
+            }
+        }
+
+        if ((uint32_t) pu8SrcAddr & 3)  //address not aligned 4
+        {
+            psSHACtx->pu8SHATempBuf = rt_malloc(psSHACtx->u32BlockSize);
+
+            if (psSHACtx->pu8SHATempBuf == RT_NULL)
+            {
+                LOG_E("fun[%s] memory allocate %d bytes failed!", __FUNCTION__, psSHACtx->u32BlockSize);
+                rt_mutex_release(&s_SHA_mutex);
+                return -RT_ENOMEM;
+            }
+
+            rt_memcpy(psSHACtx->pu8SHATempBuf, pu8SrcAddr, psSHACtx->u32BlockSize);
+            psSHACtx->u32SHATempBufLen = psSHACtx->u32BlockSize;
+            pu8SrcAddr += psSHACtx->u32BlockSize;
+            u32DataLen -= psSHACtx->u32BlockSize;
+            continue;
+        }
+
+        //Trigger SHA block update
+        SHABlockUpdate(u32OpMode, (uint32_t)pu8SrcAddr, psSHACtx->u32BlockSize, psSHACtx->u32DMAMode);
+        psSHACtx->u32DMAMode = CRYPTO_DMA_CONTINUE;
+
+        pu8SrcAddr += psSHACtx->u32BlockSize;
+        u32DataLen -= psSHACtx->u32BlockSize;
+    }
+
+    if (u32DataLen)
+    {
+        if (psSHACtx->pu8SHATempBuf == NULL)
+        {
+            psSHACtx->pu8SHATempBuf = rt_malloc(psSHACtx->u32BlockSize);
+
+            if (psSHACtx->pu8SHATempBuf == RT_NULL)
+            {
+                LOG_E("fun[%s] memory allocate %d bytes failed!", __FUNCTION__, psSHACtx->u32BlockSize);
+                rt_mutex_release(&s_SHA_mutex);
+                return -RT_ENOMEM;
+            }
+
+            psSHACtx->u32SHATempBufLen = 0;
+        }
+
+        rt_memcpy(psSHACtx->pu8SHATempBuf, pu8SrcAddr, u32DataLen);
+        psSHACtx->u32SHATempBufLen += u32DataLen;
+    }
 
     rt_mutex_release(&s_SHA_mutex);
 
@@ -492,6 +622,7 @@ static rt_err_t nu_sha_update(struct hwcrypto_hash *hash_ctx, const rt_uint8_t *
 {
     uint32_t u32SHAOpMode;
     unsigned char *nu_in;
+    unsigned char in_align_flag = 0;
 
     //Select SHA operation mode
     switch (hash_ctx->parent.type & (HWCRYPTO_MAIN_TYPE_MASK | HWCRYPTO_SUB_TYPE_MASK))
@@ -517,11 +648,8 @@ static rt_err_t nu_sha_update(struct hwcrypto_hash *hash_ctx, const rt_uint8_t *
 
     nu_in = (unsigned char *)in;
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
-    unsigned char in_align_flag = 0;
-
-    //Checking in data buffer address alignment or not
-    if (((rt_uint32_t)nu_in % 4) != 0)
+    //Checking in data buffer address not alignment or out of SRAM
+    if (((rt_uint32_t)nu_in % 4) != 0 || ((rt_uint32_t)nu_in < SRAM_BASE) || ((rt_uint32_t)nu_in > SRAM_END))
     {
         nu_in = rt_malloc(length);
         if (nu_in == RT_NULL)
@@ -530,19 +658,16 @@ static rt_err_t nu_sha_update(struct hwcrypto_hash *hash_ctx, const rt_uint8_t *
             return -RT_ENOMEM;
         }
 
-        memcpy(nu_in, in, length);
+        rt_memcpy(nu_in, in, length);
         in_align_flag = 1;
     }
-#endif
 
-    nu_sha_hash_run(u32SHAOpMode, nu_in, length);
+    nu_sha_hash_run(hash_ctx->parent.contex, u32SHAOpMode, nu_in, length);
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
     if (in_align_flag)
     {
         rt_free(nu_in);
     }
-#endif
 
     return RT_EOK;
 }
@@ -550,35 +675,43 @@ static rt_err_t nu_sha_update(struct hwcrypto_hash *hash_ctx, const rt_uint8_t *
 static rt_err_t nu_sha_finish(struct hwcrypto_hash *hash_ctx, rt_uint8_t *out, rt_size_t length)
 {
     unsigned char *nu_out;
+    unsigned char out_align_flag = 0;
+    uint32_t u32SHAOpMode;
+    S_SHA_CONTEXT *psSHACtx = hash_ctx->parent.contex;
 
     //Check SHA Hash value buffer length
     switch (hash_ctx->parent.type & (HWCRYPTO_MAIN_TYPE_MASK | HWCRYPTO_SUB_TYPE_MASK))
     {
     case HWCRYPTO_TYPE_SHA1:
+        u32SHAOpMode = SHA_MODE_SHA1;
         if (length < 5UL)
         {
             return -RT_EINVAL;
         }
         break;
     case HWCRYPTO_TYPE_SHA224:
+        u32SHAOpMode = SHA_MODE_SHA224;
         if (length < 7UL)
         {
             return -RT_EINVAL;
         }
         break;
     case HWCRYPTO_TYPE_SHA256:
+        u32SHAOpMode = SHA_MODE_SHA256;
         if (length < 8UL)
         {
             return -RT_EINVAL;
         }
         break;
     case HWCRYPTO_TYPE_SHA384:
+        u32SHAOpMode = SHA_MODE_SHA384;
         if (length < 12UL)
         {
             return -RT_EINVAL;
         }
         break;
     case HWCRYPTO_TYPE_SHA512:
+        u32SHAOpMode = SHA_MODE_SHA512;
         if (length < 16UL)
         {
             return -RT_EINVAL;
@@ -590,9 +723,6 @@ static rt_err_t nu_sha_finish(struct hwcrypto_hash *hash_ctx, rt_uint8_t *out, r
 
     nu_out = (unsigned char *)out;
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
-    unsigned char out_align_flag = 0;
-
     //Checking out data buffer address alignment or not
     if (((rt_uint32_t)nu_out % 4) != 0)
     {
@@ -605,17 +735,31 @@ static rt_err_t nu_sha_finish(struct hwcrypto_hash *hash_ctx, rt_uint8_t *out, r
 
         out_align_flag = 1;
     }
-#endif
+
+    if (psSHACtx->pu8SHATempBuf)
+    {
+        if (psSHACtx->u32DMAMode ==  CRYPTO_DMA_FIRST)
+            SHABlockUpdate(u32SHAOpMode, (uint32_t)psSHACtx->pu8SHATempBuf, psSHACtx->u32SHATempBufLen, CRYPTO_DMA_ONE_SHOT);
+        else
+            SHABlockUpdate(u32SHAOpMode, (uint32_t)psSHACtx->pu8SHATempBuf, psSHACtx->u32SHATempBufLen, CRYPTO_DMA_LAST);
+
+        //free SHATempBuf
+        rt_free(psSHACtx->pu8SHATempBuf);
+        psSHACtx->pu8SHATempBuf = RT_NULL;
+        psSHACtx->u32SHATempBufLen = 0;
+    }
+    else
+    {
+        SHABlockUpdate(u32SHAOpMode, (uint32_t)NULL, 0, CRYPTO_DMA_LAST);
+    }
 
     SHA_Read(CRPT, (uint32_t *)nu_out);
 
-#if !defined(NU_HWCRYPTO_NOT_ALIGN_CHECK)
     if (out_align_flag)
     {
-        memcpy(out, out, length);
-        rt_free(out);
+        rt_memcpy(out, nu_out, length);
+        rt_free(nu_out);
     }
-#endif
 
     return RT_EOK;
 }
@@ -728,7 +872,12 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
 
     case HWCRYPTO_TYPE_SHA1:
     {
-        ctx->contex = RT_NULL;
+        ctx->contex = rt_malloc(sizeof(S_SHA_CONTEXT));
+
+        if (ctx->contex == RT_NULL)
+            return -RT_ERROR;
+
+        rt_memset(ctx->contex, 0, sizeof(S_SHA_CONTEXT));
         //Setup SHA1 operation
         ((struct hwcrypto_hash *)ctx)->ops = &nu_sha_ops;
         break;
@@ -736,7 +885,12 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
 
     case HWCRYPTO_TYPE_SHA2:
     {
-        ctx->contex = RT_NULL;
+        ctx->contex = rt_malloc(sizeof(S_SHA_CONTEXT));
+
+        if (ctx->contex == RT_NULL)
+            return -RT_ERROR;
+
+        rt_memset(ctx->contex, 0, sizeof(S_SHA_CONTEXT));
         //Setup SHA2 operation
         ((struct hwcrypto_hash *)ctx)->ops = &nu_sha_ops;
         break;
@@ -758,7 +912,6 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
 
 #endif /* BSP_USING_CRYPTO */
 
-
     default:
         res = -RT_ERROR;
         break;
@@ -801,6 +954,32 @@ static void nu_hwcrypto_reset(struct rt_hwcrypto_ctx *ctx)
         break;
     }
 #endif /* !BSP_USING_TRNG */
+#if defined(BSP_USING_CRYPTO)
+    case HWCRYPTO_TYPE_SHA1:
+    case HWCRYPTO_TYPE_SHA2:
+    {
+        S_SHA_CONTEXT *psSHACtx = (S_SHA_CONTEXT *)ctx->contex;
+
+        if (psSHACtx->pu8SHATempBuf)
+        {
+            rt_free(psSHACtx->pu8SHATempBuf);
+        }
+
+        psSHACtx->pu8SHATempBuf = RT_NULL;
+        psSHACtx->u32SHATempBufLen = 0;
+        psSHACtx->u32DMAMode = CRYPTO_DMA_FIRST;
+
+        if ((ctx->type == HWCRYPTO_TYPE_SHA384) || (ctx->type == HWCRYPTO_TYPE_SHA512))
+        {
+            psSHACtx->u32BlockSize = 128;
+        }
+        else
+        {
+            psSHACtx->u32BlockSize = 64;
+        }
+        break;
+    }
+#endif
 
     default:
         break;

+ 5 - 4
bsp/nuvoton/libraries/m480/rtt_port/drv_ecap.c

@@ -12,6 +12,7 @@
 #include <rtconfig.h>
 
 #if defined(BSP_USING_ECAP)
+#if ((BSP_USING_ECAP0_CHMSK+BSP_USING_ECAP1_CHMSK)!=0)
 #include <rtdevice.h>
 #include <NuMicro.h>
 
@@ -262,7 +263,7 @@ static rt_err_t nu_capture_get_pulsewidth(struct rt_inputcapture_device *inputca
     else    /* Overrun case */
         fTempCnt = nu_capture->u32CurrentCnt + ((0x1000000 - nu_capture->u32LastCnt) + 1);
 
-    *pulsewidth_us =(int)(fTempCnt * nu_capture->ecap_dev->fUsPerTick);
+    *pulsewidth_us = (int)(fTempCnt * nu_capture->ecap_dev->fUsPerTick);
 
     nu_capture->u32LastCnt = nu_capture->u32CurrentCnt;
 
@@ -430,7 +431,7 @@ static int nu_ecap_capture_device_init(void)
 #if (BSP_USING_ECAP0_CHMSK!=0)
         if (BSP_USING_ECAP0_CHMSK & (0x1 << i))
         {
-            nu_ecap0_capture[i] = (nu_capture_t*)rt_malloc(sizeof(nu_capture_t));
+            nu_ecap0_capture[i] = (nu_capture_t *)rt_malloc(sizeof(nu_capture_t));
             ecap_init(nu_ecap0_capture[i], i, &nu_ecap0_dev, nu_ecap0_device_name[i]);
         }
 #endif //#if (BSP_USING_ECAP0_CHMSK!=0)
@@ -438,7 +439,7 @@ static int nu_ecap_capture_device_init(void)
 #if (BSP_USING_ECAP1_CHMSK!=0)
         if (BSP_USING_ECAP1_CHMSK & (0x1 << i))
         {
-            nu_ecap1_capture[i] = (nu_capture_t*)rt_malloc(sizeof(nu_capture_t));
+            nu_ecap1_capture[i] = (nu_capture_t *)rt_malloc(sizeof(nu_capture_t));
             ecap_init(nu_ecap1_capture[i], i, &nu_ecap1_dev, nu_ecap1_device_name[i]);
         }
 #endif //#if (BSP_USING_ECAP1_CHMSK!=0)
@@ -447,5 +448,5 @@ static int nu_ecap_capture_device_init(void)
     return 0;
 }
 INIT_DEVICE_EXPORT(nu_ecap_capture_device_init);
-
+#endif //#if ((BSP_USING_ECAP0_CHMSK+BSP_USING_ECAP1_CHMSK)!=0)
 #endif //#if defined(BSP_USING_ECAP)

+ 8 - 7
bsp/nuvoton/libraries/m480/rtt_port/drv_epwm_capture.c

@@ -12,6 +12,7 @@
 #include <rtconfig.h>
 
 #if defined(BSP_USING_EPWM_CAPTURE)
+#if ((BSP_USING_EPWM0_CAPTURE_CHMSK+BSP_USING_EPWM1_CAPTURE_CHMSK)!=0)
 #include <rtdevice.h>
 #include <NuMicro.h>
 
@@ -73,7 +74,7 @@ static rt_err_t CalPulseWidth(nu_capture_t *nu_capture)
         bWrapAroundFlag = RT_TRUE;
     }
 
-    /* Read the capture counter value if falling/risning edge */
+    /* Read the capture counter value if falling/rising edge */
     if (EPWM_GetCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel) == 1)//Rising edge
     {
         EPWM_ClearCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel, EPWM_CAPTURE_INT_RISING_LATCH);
@@ -294,7 +295,7 @@ void EPWM1P1_IRQHandler(void)
 void EPWM1P2_IRQHandler(void)
 {
     /* enter interrupt */
-    rt_interrupt_enter()
+    rt_interrupt_enter();
 
     /* Avoid excessive iteration by monitoring enabled channels */
 #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x1<<EPWM_CH4CH5_POS))
@@ -366,7 +367,7 @@ static rt_err_t nu_epwm_init(nu_capture_t *nu_capture)
             /* Enable EPWM0 clock */
             SYS_UnlockReg();
             CLK_EnableModuleClock(EPWM0_MODULE);
-            CLK_SetModuleClock(EPWM0_MODULE, CLK_CLKSEL2_EPWM0SEL_PLL, (uint32_t)NULL);
+            CLK_SetModuleClock(EPWM0_MODULE, CLK_CLKSEL2_EPWM0SEL_PLL, 0);
             SYS_LockReg();
             bEPWM0Inited = RT_TRUE;
         }
@@ -379,7 +380,7 @@ static rt_err_t nu_epwm_init(nu_capture_t *nu_capture)
             /* Enable EPWM1 clock */
             SYS_UnlockReg();
             CLK_EnableModuleClock(EPWM1_MODULE);
-            CLK_SetModuleClock(EPWM1_MODULE, CLK_CLKSEL2_EPWM1SEL_PLL, (uint32_t)NULL);
+            CLK_SetModuleClock(EPWM1_MODULE, CLK_CLKSEL2_EPWM1SEL_PLL, 0);
             SYS_LockReg();
             bEPWM1Inited = RT_TRUE;
         }
@@ -416,7 +417,7 @@ static rt_err_t nu_capture_open(struct rt_inputcapture_device *inputcapture)
 
     nu_capture = (nu_capture_t *) inputcapture;
 
-    /* Set capture time as 1000 nano second */
+    /* Set capture time as 1000 nanosecond */
     EPWM_ConfigCaptureChannel(nu_capture->epwm, nu_capture->u8Channel, 1000, 0);
 
     /* Enable capture rising/falling edge interrupt */
@@ -500,10 +501,10 @@ int nu_epwm_capture_device_init(void)
             rt_device_inputcapture_register(&nu_epwm1_capture[i].parent, nu_epwm1_device_name[i], &nu_epwm1_capture[i]);
         }
     }
-#endif //#if (BSP_USING_EPWM1_CAPTURE_CHMSK!=0) 
+#endif //#if (BSP_USING_EPWM1_CAPTURE_CHMSK!=0)
     return 0;
 
 }
 INIT_DEVICE_EXPORT(nu_epwm_capture_device_init);
-
+#endif  //#if ((BSP_USING_EPWM0_CAPTURE_CHMSK+BSP_USING_EPWM1_CAPTURE_CHMSK)!=0)
 #endif //#if defined(BSP_USING_EPWM_CAPTURE)

+ 6 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_fmc.c

@@ -159,7 +159,7 @@ int nu_fmc_erase(long addr, size_t size)
     uint32_t addr_end = addr + size;
 
 #if defined(NU_SUPPORT_NONALIGN)
-    uint8_t *page_sdtemp = RT_NULL; 
+    uint8_t *page_sdtemp = RT_NULL;
     uint8_t *page_edtemp = RT_NULL;
 
 
@@ -316,6 +316,11 @@ static int nu_fmc_init(void)
 
     g_mutex_fmc = rt_mutex_create("nu_fmc_lock", RT_IPC_FLAG_FIFO);
 
+    /* PKG_USING_FAL */
+#if defined(PKG_USING_FAL)
+    fal_init();
+#endif
+
     return (int)RT_EOK;
 }
 INIT_APP_EXPORT(nu_fmc_init);

+ 28 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_gpio.c

@@ -19,6 +19,7 @@
 #include <NuMicro.h>
 #include <nu_bitutil.h>
 #include <drv_gpio.h>
+#include <stdlib.h>
 
 /* Private define ---------------------------------------------------------------*/
 
@@ -34,6 +35,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
 static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
 static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
 static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
+static rt_base_t nu_gpio_pin_get(const char *name);
 
 /* Private variables ------------------------------------------------------------*/
 static struct rt_pin_irq_hdr pin_irq_hdr_tab[IRQ_MAX_NUM];
@@ -45,7 +47,7 @@ static struct rt_pin_ops nu_gpio_ops =
     nu_gpio_attach_irq,
     nu_gpio_detach_irq,
     nu_gpio_irq_enable,
-    RT_NULL,
+    nu_gpio_pin_get,
 };
 
 static IRQn_Type au32GPIRQ[NU_PORT_CNT] = {GPA_IRQn, GPB_IRQn, GPC_IRQn, GPD_IRQn, GPE_IRQn, GPF_IRQn, GPG_IRQn, GPH_IRQn};
@@ -102,6 +104,31 @@ static void pin_irq_hdr(rt_uint32_t irq_status, rt_uint32_t port_index)
     }
 }
 
+static rt_base_t nu_gpio_pin_get(const char *name)
+{
+    /* Get pin number by name,such as PA.0, PF12 */
+    if ((name[2] == '\0') || ((name[2] == '.') && (name[3] == '\0')))
+        return -(RT_EINVAL);
+
+    long number;
+
+    if ((name[2] == '.'))
+        number = atol(&name[3]);
+    else
+        number = atol(&name[2]);
+
+    if (number > 15)
+        return -(RT_EINVAL);
+
+    if (name[1] >= 'A' && name[1] <= 'H')
+        return ((name[1] - 'A') * 0x10) + number;
+
+    if (name[1] >= 'a' && name[1] <= 'h')
+        return ((name[1] - 'a') * 0x10) + number;
+
+    return -(RT_EINVAL);
+}
+
 static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
 {
     GPIO_T *PORT;

+ 3 - 3
bsp/nuvoton/libraries/m480/rtt_port/drv_i2c.c

@@ -202,9 +202,9 @@ static rt_err_t nu_i2c_send_address(nu_i2c_bus_t *nu_i2c,
         if (ret != RT_EOK) /* for timeout condition */
             return -RT_EIO;
 
-        if (   (I2C_GET_STATUS(nu_i2c->I2C)
-            != ((flags & RT_I2C_RD) ? u32I2C_MASTER_STATUS_RECEIVE_ADDRESS_ACK : u32I2C_MASTER_STATUS_TRANSMIT_ADDRESS_ACK))
-            && !ignore_nack)
+        if ((I2C_GET_STATUS(nu_i2c->I2C)
+                != ((flags & RT_I2C_RD) ? u32I2C_MASTER_STATUS_RECEIVE_ADDRESS_ACK : u32I2C_MASTER_STATUS_TRANSMIT_ADDRESS_ACK))
+                && !ignore_nack)
         {
             LOG_E("sending address failed\n");
             return -RT_EIO;

+ 76 - 33
bsp/nuvoton/libraries/m480/rtt_port/drv_pdma.c

@@ -54,7 +54,6 @@ struct nu_pdma_memfun_actor
 {
     int         m_i32ChannID;
     uint32_t    m_u32Result;
-    uint32_t    m_u32TrigTransferCnt;
     rt_sem_t    m_psSemMemFun;
 } ;
 typedef struct nu_pdma_memfun_actor *nu_pdma_memfun_actor_t;
@@ -553,6 +552,8 @@ rt_err_t nu_pdma_desc_setup(int i32ChannID, nu_pdma_desc_t dma_desc, uint32_t u3
         goto exit_nu_pdma_desc_setup;
     else if ((u32AddrSrc % (u32DataWidth / 8)) || (u32AddrDst % (u32DataWidth / 8)))
         goto exit_nu_pdma_desc_setup;
+    else if ( i32TransferCnt > NU_PDMA_MAX_TXCNT )
+        goto exit_nu_pdma_desc_setup;
 
     psPeriphCtl = &nu_pdma_chn_arr[i32ChannID - NU_PDMA_CH_Pos].m_spPeripCtl;
 
@@ -701,9 +702,10 @@ static rt_err_t nu_pdma_sgtbls_valid(nu_pdma_desc_t head)
 
         node = (nu_pdma_desc_t)(node->NEXT + PDMA->SCATBA);
 
-    } while (((uint32_t)node != PDMA->SCATBA) && (node != head));
+    }
+    while (((uint32_t)node != PDMA->SCATBA) && (node != head));
 
-     return RT_EOK;
+    return RT_EOK;
 }
 
 static void _nu_pdma_transfer(int i32ChannID, uint32_t u32Peripheral, nu_pdma_desc_t head, uint32_t u32IdleTimeout_us)
@@ -718,7 +720,7 @@ static void _nu_pdma_transfer(int i32ChannID, uint32_t u32Peripheral, nu_pdma_de
     PDMA_SetTransferMode(PDMA,
                          i32ChannID,
                          u32Peripheral,
-                         (head != NULL) ? 1 : 0,
+                         (head->NEXT != 0) ? 1 : 0,
                          (uint32_t)head);
 
     /* If peripheral is M2M, trigger it. */
@@ -747,7 +749,7 @@ rt_err_t nu_pdma_transfer(int i32ChannID, uint32_t u32DataWidth, uint32_t u32Add
     if (ret != RT_EOK)
         goto exit_nu_pdma_transfer;
 
-    _nu_pdma_transfer(i32ChannID, psPeriphCtl->m_u32Peripheral, NULL, u32IdleTimeout_us);
+    _nu_pdma_transfer(i32ChannID, psPeriphCtl->m_u32Peripheral,  &PDMA->DSCT[i32ChannID], u32IdleTimeout_us);
 
     ret = RT_EOK;
 
@@ -765,7 +767,7 @@ rt_err_t nu_pdma_sg_transfer(int i32ChannID, nu_pdma_desc_t head, uint32_t u32Id
         goto exit_nu_pdma_sg_transfer;
     else if (!(nu_pdma_chn_mask & (1 << i32ChannID)))
         goto exit_nu_pdma_sg_transfer;
-    else if ( (ret=nu_pdma_sgtbls_valid(head)) != RT_EOK ) /* Check SG-tbls. */
+    else if ((ret = nu_pdma_sgtbls_valid(head)) != RT_EOK) /* Check SG-tbls. */
         goto exit_nu_pdma_sg_transfer;
 
     psPeriphCtl = &nu_pdma_chn_arr[i32ChannID - NU_PDMA_CH_Pos].m_spPeripCtl;
@@ -912,11 +914,14 @@ static int nu_pdma_memfun_employ(void)
     return idx;
 }
 
-static rt_size_t nu_pdma_memfun(void *dest, void *src, uint32_t u32DataWidth, unsigned int count, nu_pdma_memctrl_t eMemCtl)
+static rt_size_t nu_pdma_memfun(void *dest, void *src, uint32_t u32DataWidth, unsigned int u32TransferCnt, nu_pdma_memctrl_t eMemCtl)
 {
     nu_pdma_memfun_actor_t psMemFunActor = NULL;
     int idx;
     rt_size_t ret = 0;
+    rt_uint32_t u32Offset = 0;
+    rt_uint32_t u32TxCnt = 0;
+
     while (1)
     {
         /* Employ actor */
@@ -925,37 +930,51 @@ static rt_size_t nu_pdma_memfun(void *dest, void *src, uint32_t u32DataWidth, un
 
         psMemFunActor = &nu_pdma_memfun_actor_arr[idx];
 
-        psMemFunActor->m_u32TrigTransferCnt = count;
+        do
+        {
 
-        /* Set PDMA memory control to eMemCtl. */
-        nu_pdma_channel_memctrl_set(psMemFunActor->m_i32ChannID, eMemCtl);
+            u32TxCnt = (u32TransferCnt > NU_PDMA_MAX_TXCNT) ? NU_PDMA_MAX_TXCNT : u32TransferCnt;
 
-        /* Register ISR callback function */
-        nu_pdma_callback_register(psMemFunActor->m_i32ChannID, nu_pdma_memfun_cb, (void *)psMemFunActor, NU_PDMA_EVENT_ABORT | NU_PDMA_EVENT_TRANSFER_DONE);
+            /* Set PDMA memory control to eMemCtl. */
+            nu_pdma_channel_memctrl_set(psMemFunActor->m_i32ChannID, eMemCtl);
 
-        psMemFunActor->m_u32Result = 0;
+            /* Register ISR callback function */
+            nu_pdma_callback_register(psMemFunActor->m_i32ChannID, nu_pdma_memfun_cb, (void *)psMemFunActor, NU_PDMA_EVENT_ABORT | NU_PDMA_EVENT_TRANSFER_DONE);
 
-        /* Trigger it */
-        nu_pdma_transfer(psMemFunActor->m_i32ChannID, u32DataWidth, (uint32_t)src, (uint32_t)dest, count, 0);
+            psMemFunActor->m_u32Result = 0;
 
-        /* Wait it done. */
-        rt_sem_take(psMemFunActor->m_psSemMemFun, RT_WAITING_FOREVER);
+            /* Trigger it */
+            nu_pdma_transfer(psMemFunActor->m_i32ChannID,
+                             u32DataWidth,
+                             (eMemCtl & 0x2ul) ? (uint32_t)src + u32Offset : (uint32_t)src, /* Src address is Inc or not. */
+                             (eMemCtl & 0x1ul) ? (uint32_t)dest + u32Offset : (uint32_t)dest, /* Dst address is Inc or not. */
+                             u32TxCnt,
+                             0);
 
-        /* Give result if get NU_PDMA_EVENT_TRANSFER_DONE.*/
-        if (psMemFunActor->m_u32Result & NU_PDMA_EVENT_TRANSFER_DONE)
-        {
-            ret = psMemFunActor->m_u32TrigTransferCnt;
-        }
-        else
-        {
-            ret = psMemFunActor->m_u32TrigTransferCnt - nu_pdma_non_transfer_count_get(psMemFunActor->m_i32ChannID);
-        }
+            /* Wait it done. */
+            rt_sem_take(psMemFunActor->m_psSemMemFun, RT_WAITING_FOREVER);
 
-        /* Terminate it if get ABORT event */
-        if (psMemFunActor->m_u32Result & NU_PDMA_EVENT_ABORT)
-        {
-            nu_pdma_channel_terminate(psMemFunActor->m_i32ChannID);
+            /* Give result if get NU_PDMA_EVENT_TRANSFER_DONE.*/
+            if (psMemFunActor->m_u32Result & NU_PDMA_EVENT_TRANSFER_DONE)
+            {
+                ret +=  u32TxCnt;
+            }
+            else
+            {
+                ret += (u32TxCnt - nu_pdma_non_transfer_count_get(psMemFunActor->m_i32ChannID));
+            }
+
+            /* Terminate it if get ABORT event */
+            if (psMemFunActor->m_u32Result & NU_PDMA_EVENT_ABORT)
+            {
+                nu_pdma_channel_terminate(psMemFunActor->m_i32ChannID);
+                break;
+            }
+
+            u32TransferCnt -= u32TxCnt;
+            u32Offset += u32TxCnt;
         }
+        while (u32TransferCnt > 0);
 
         rt_mutex_take(nu_pdma_memfun_actor_pool_lock, RT_WAITING_FOREVER);
         nu_pdma_memfun_actor_mask &= ~(1 << idx);
@@ -979,10 +998,34 @@ rt_size_t nu_pdma_mempush(void *dest, void *src, uint32_t data_width, unsigned i
 
 void *nu_pdma_memcpy(void *dest, void *src, unsigned int count)
 {
-    if (count == nu_pdma_memfun(dest, src, 8, count, eMemCtl_SrcInc_DstInc))
+    int i = 0;
+    uint32_t u32Offset = 0;
+    uint32_t u32Remaining = count;
+
+    for (i = 4; (i > 0) && (u32Remaining > 0) ; i >>= 1)
+    {
+        uint32_t u32src   = (uint32_t)src + u32Offset;
+        uint32_t u32dest  = (uint32_t)dest + u32Offset;
+
+        if (((u32src % i) == (u32dest % i)) &&
+                ((u32src % i) == 0) &&
+                (RT_ALIGN_DOWN(u32Remaining, i) >= i))
+        {
+            uint32_t u32TXCnt = u32Remaining / i;
+            if (u32TXCnt != nu_pdma_memfun((void *)u32dest, (void *)u32src, i * 8, u32TXCnt, eMemCtl_SrcInc_DstInc))
+                goto exit_nu_pdma_memcpy;
+
+            u32Offset += (u32TXCnt * i);
+            u32Remaining -= (u32TXCnt * i);
+        }
+    }
+
+    if (count == u32Offset)
         return dest;
-    else
-        return NULL;
+
+exit_nu_pdma_memcpy:
+
+    return NULL;
 }
 
 /**

+ 1 - 0
bsp/nuvoton/libraries/m480/rtt_port/drv_pdma.h

@@ -31,6 +31,7 @@
 #define NU_PDMA_UNUSED                  (-1)
 
 #define NU_PDMA_SG_LIMITED_DISTANCE     ((PDMA_DSCT_NEXT_NEXT_Msk>>PDMA_DSCT_NEXT_NEXT_Pos)+1)
+#define NU_PDMA_MAX_TXCNT               ((PDMA_DSCT_CTL_TXCNT_Msk>>PDMA_DSCT_CTL_TXCNT_Pos) + 1)
 
 typedef enum
 {

+ 5 - 5
bsp/nuvoton/libraries/m480/rtt_port/drv_rtc.c

@@ -52,21 +52,21 @@
 static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args);
 
 #if defined (NU_RTC_SUPPORT_IO_RW)
-static rt_size_t nu_rtc_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size);
-static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
+    static rt_size_t nu_rtc_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size);
+    static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
 #endif
 
 static rt_err_t nu_rtc_is_date_valid(const time_t *const t);
 static void nu_rtc_init(void);
 
 #if defined(RT_USING_ALARM)
-static void nu_rtc_alarm_reset(void);
+    static void nu_rtc_alarm_reset(void);
 #endif
 
 /* Public functions -------------------------------------------------------------*/
 #if defined (NU_RTC_SUPPORT_MSH_CMD)
-extern rt_err_t set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day);
-extern rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second);
+    extern rt_err_t set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day);
+    extern rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second);
 #endif
 
 /* Private variables ------------------------------------------------------------*/

+ 24 - 11
bsp/nuvoton/libraries/m480/rtt_port/drv_spi.c

@@ -342,25 +342,38 @@ exit_nu_pdma_spi_tx_config:
 static rt_size_t nu_spi_pdma_transmit(struct nu_spi *spi_bus, const uint8_t *send_addr, uint8_t *recv_addr, int length, uint8_t bytes_per_word)
 {
     rt_err_t result = RT_EOK;
+    rt_uint32_t u32Offset = 0;
+    rt_uint32_t u32TransferCnt = length / bytes_per_word;
+    rt_uint32_t u32TxCnt = 0;
 
     /* Get base address of spi register */
     SPI_T *spi_base = spi_bus->spi_base;
 
-    result = nu_pdma_spi_rx_config(spi_bus, recv_addr, length, bytes_per_word);
-    RT_ASSERT(result == RT_EOK);
-    result = nu_pdma_spi_tx_config(spi_bus, send_addr, length, bytes_per_word);
-    RT_ASSERT(result == RT_EOK);
+    do
+    {
+        u32TxCnt = (u32TransferCnt > NU_PDMA_MAX_TXCNT) ? NU_PDMA_MAX_TXCNT : u32TransferCnt;
+        result = nu_pdma_spi_rx_config(spi_bus, (recv_addr == RT_NULL) ? recv_addr : &recv_addr[u32Offset], (u32TxCnt * bytes_per_word), bytes_per_word);
+        RT_ASSERT(result == RT_EOK);
 
-    /* Trigger TX/RX PDMA transfer. */
-    SPI_TRIGGER_TX_RX_PDMA(spi_base);
+        result = nu_pdma_spi_tx_config(spi_bus, (send_addr == RT_NULL) ? send_addr : &send_addr[u32Offset], (u32TxCnt * bytes_per_word), bytes_per_word);
+        RT_ASSERT(result == RT_EOK);
 
-    /* Wait RX-PDMA transfer done */
-    rt_sem_take(spi_bus->m_psSemBus, RT_WAITING_FOREVER);
+        /* Trigger TX/RX PDMA transfer. */
+        SPI_TRIGGER_TX_RX_PDMA(spi_base);
 
-    /* Stop TX/RX DMA transfer. */
-    SPI_DISABLE_TX_RX_PDMA(spi_base);
+        /* Wait RX-PDMA transfer done */
+        rt_sem_take(spi_bus->m_psSemBus, RT_WAITING_FOREVER);
 
-    return result;
+        /* Stop TX/RX DMA transfer. */
+        SPI_DISABLE_TX_RX_PDMA(spi_base);
+
+        u32TransferCnt -= u32TxCnt;
+        u32Offset += u32TxCnt;
+
+    }
+    while (u32TransferCnt > 0);
+
+    return length;
 }
 
 rt_err_t nu_hw_spi_pdma_allocate(struct nu_spi *spi_bus)

+ 14 - 10
bsp/nuvoton/libraries/m480/rtt_port/drv_timer_capture.c

@@ -13,6 +13,10 @@
 #include <rtconfig.h>
 
 #if defined(BSP_USING_TIMER_CAPTURE)
+#if defined(BSP_USING_TIMER0_CAPTURE)|| \
+    defined(BSP_USING_TIMER1_CAPTURE)|| \
+    defined(BSP_USING_TIMER2_CAPTURE)|| \
+    defined(BSP_USING_TIMER3_CAPTURE)
 
 #include <rtdevice.h>
 #include <NuMicro.h>
@@ -150,8 +154,6 @@ static rt_err_t nu_capture_get_pulsewidth(struct rt_inputcapture_device *inputca
 
 static rt_err_t nu_timer_init(nu_capture_t *nu_capture)
 {
-    rt_err_t ret = RT_ERROR;
-
     SYS_UnlockReg();
 
 #if defined(BSP_USING_TIMER0_CAPTURE)
@@ -160,8 +162,6 @@ static rt_err_t nu_timer_init(nu_capture_t *nu_capture)
         /* Enable TIMER0 clock */
         CLK_EnableModuleClock(TMR0_MODULE);
         CLK_SetModuleClock(TMR0_MODULE, CLK_CLKSEL1_TMR0SEL_PCLK0, 0);
-
-        ret = RT_EOK;
         goto exit_nu_timer_init;
     }
 #endif
@@ -171,8 +171,6 @@ static rt_err_t nu_timer_init(nu_capture_t *nu_capture)
         /* Enable TIMER1 clock */
         CLK_EnableModuleClock(TMR1_MODULE);
         CLK_SetModuleClock(TMR1_MODULE, CLK_CLKSEL1_TMR1SEL_PCLK0, 0);
-
-        ret = RT_EOK;
         goto exit_nu_timer_init;
     }
 #endif
@@ -182,8 +180,6 @@ static rt_err_t nu_timer_init(nu_capture_t *nu_capture)
         /* Enable TIMER2 clock */
         CLK_EnableModuleClock(TMR2_MODULE);
         CLK_SetModuleClock(TMR2_MODULE, CLK_CLKSEL1_TMR2SEL_PCLK1, 0);
-
-        ret = RT_EOK;
         goto exit_nu_timer_init;
     }
 #endif
@@ -193,12 +189,17 @@ static rt_err_t nu_timer_init(nu_capture_t *nu_capture)
         /* Enable TIMER3 clock */
         CLK_EnableModuleClock(TMR3_MODULE);
         CLK_SetModuleClock(TMR3_MODULE, CLK_CLKSEL1_TMR3SEL_PCLK1, 0);
+        goto exit_nu_timer_init;
     }
 #endif
 
+    SYS_LockReg();
+    return -(RT_ERROR);
+
 exit_nu_timer_init:
+
     SYS_LockReg();
-    return -(ret);
+    return RT_EOK;
 }
 
 static rt_err_t nu_capture_init(struct rt_inputcapture_device *inputcapture)
@@ -241,6 +242,9 @@ static rt_err_t nu_capture_open(struct rt_inputcapture_device *inputcapture)
     /* Enable Timer NVIC */
     NVIC_EnableIRQ(nu_capture->irq);
 
+    /* Reset counter before openning. */
+    TIMER_ResetCounter(nu_capture->timer);
+
     TIMER_Open(nu_capture->timer, TIMER_CONTINUOUS_MODE, 1);
     TIMER_SET_PRESCALE_VALUE(nu_capture->timer, cal_time_prescale(nu_capture));
     TIMER_SET_CMP_VALUE(nu_capture->timer, 0xFFFFFF);
@@ -318,5 +322,5 @@ static int nu_timer_capture_device_init(void)
     return 0;
 }
 INIT_DEVICE_EXPORT(nu_timer_capture_device_init);
-
+#endif //#if defined(BSP_USING_TIMER*_CAPTURE)
 #endif //#if defined(BSP_USING_TIMER_CAPTURE)

+ 1 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_trng.c

@@ -15,8 +15,8 @@
 #if (defined(BSP_USING_TRNG) && defined(RT_HWCRYPTO_USING_RNG))
 
 #include <rtdevice.h>
-#include <stdlib.h>
 #include "NuMicro.h"
+#include <stdlib.h>
 
 #define NU_CRYPTO_TRNG_NAME "nu_TRNG"
 

+ 0 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_trng.h

@@ -18,4 +18,3 @@ void nu_trng_open(void);
 rt_uint32_t nu_trng_rand(struct hwcrypto_rng *ctx);
 
 #endif
-

+ 2 - 2
bsp/nuvoton/libraries/m480/rtt_port/drv_uart.c

@@ -546,7 +546,7 @@ static rt_err_t nu_pdma_uart_rx_config(struct rt_serial_device *serial, uint8_t
                                        nu_pdma_uart_rx_cb,
                                        (void *)serial,
                                        NU_PDMA_EVENT_TRANSFER_DONE | NU_PDMA_EVENT_TIMEOUT);
-    if ( result != RT_EOK )
+    if (result != RT_EOK)
     {
         goto exit_nu_pdma_uart_rx_config;
     }
@@ -557,7 +557,7 @@ static rt_err_t nu_pdma_uart_rx_config(struct rt_serial_device *serial, uint8_t
                               (uint32_t)pu8Buf,
                               i32TriggerLen,
                               1000);  //Idle-timeout, 1ms
-    if ( result != RT_EOK )
+    if (result != RT_EOK)
     {
         goto exit_nu_pdma_uart_rx_config;
     }

+ 1 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_usbd.c

@@ -364,7 +364,7 @@ __STATIC_INLINE void _USBD_IRQHandler(void)
             /* Clear event flag */
             USBD_CLR_INT_FLAG(USBD_INTSTS_EP0);
 
-            if (       (USBD_GET_ADDR() == 0)
+            if ((USBD_GET_ADDR() == 0)
                     && (nu_usbd.address_tmp)
                )
             {

+ 72 - 32
bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c

@@ -22,6 +22,10 @@
 #include "usb.h"
 #include "usbh_lib.h"
 
+#if !defined(NU_USBHOST_HUB_POLLING_INTERVAL)
+    #define NU_USBHOST_HUB_POLLING_INTERVAL    (100)
+#endif
+
 #define NU_MAX_USBH_PORT    2        //USB1.1 + USB2.0 port
 #define NU_MAX_USBH_PIPE    16
 #define NU_USBH_THREAD_STACK_SIZE    2048
@@ -51,6 +55,7 @@ typedef struct nu_port_ctrl
 struct nu_usbh_dev
 {
     uhcd_t uhcd;
+    rt_thread_t polling_thread;
     S_NU_RH_PORT_CTRL asPortCtrl[NU_MAX_USBH_PORT];
 };
 
@@ -290,7 +295,6 @@ static rt_err_t nu_open_pipe(upipe_t pipe)
 
 static rt_err_t nu_close_pipe(upipe_t pipe)
 {
-    int i;
     S_NU_RH_PORT_CTRL *psPortCtrl;
     S_NU_PORT_DEV *psPortDev;
 
@@ -309,6 +313,7 @@ static rt_err_t nu_close_pipe(upipe_t pipe)
         {
             if (psPortDev->pUDev)
             {
+                int i;
                 for (i = 0; i < NU_MAX_USBH_PIPE; i++)
                 {
                     if (psPortDev->apsEPInfo[i] != NULL)
@@ -320,7 +325,6 @@ static rt_err_t nu_close_pipe(upipe_t pipe)
                 free_device(psPortDev->pUDev);
                 psPortDev->pUDev = NULL;
             }
-            psPortDev->port_num = 0;
         }
     }
 
@@ -615,8 +619,8 @@ static void nu_usbh_rh_thread_entry(void *parameter)
 {
     while (1)
     {
-        usbh_pooling_root_hubs();
-        rt_thread_delay(10);
+        usbh_polling_root_hubs();
+        rt_thread_mdelay(NU_USBHOST_HUB_POLLING_INTERVAL);
     }
 }
 
@@ -674,6 +678,8 @@ static void nu_hcd_disconnect_callback(
         return;
     }
 
+    port_index = i + 1;
+
     for (i = 0; i < NU_MAX_USBH_PIPE; i++)
     {
         if (psPortCtrl->sRHPortDev.apsEPInfo[i] != NULL)
@@ -682,10 +688,9 @@ static void nu_hcd_disconnect_callback(
         }
     }
 
-    port_index = i + 1;
     psPortCtrl->sRHPortDev.pUDev = NULL;
 
-    RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnnect\n"));
+    RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnect\n"));
     rt_usbh_root_hub_disconnect_handler(s_sUSBHDev.uhcd, port_index);
 }
 
@@ -701,22 +706,21 @@ static struct uhcd_ops nu_uhcd_ops =
 
 static rt_err_t nu_hcd_init(rt_device_t device)
 {
-    rt_thread_t thread;
-
+    struct nu_usbh_dev * pNuUSBHDev = (struct nu_usbh_dev *)device;
     usbh_core_init();
 
     //install connect/disconnect callback
     usbh_install_conn_callback(nu_hcd_connect_callback, nu_hcd_disconnect_callback);
-    usbh_pooling_root_hubs();
+    usbh_polling_root_hubs();
 
     //create thread for polling usbh port status
     /* create usb hub thread */
-    thread = rt_thread_create("usbh_drv", nu_usbh_rh_thread_entry, RT_NULL,
+    pNuUSBHDev->polling_thread = rt_thread_create("usbh_drv", nu_usbh_rh_thread_entry, RT_NULL,
                               NU_USBH_THREAD_STACK_SIZE, 8, 20);
-    if (thread != RT_NULL)
+    if ( pNuUSBHDev->polling_thread != RT_NULL)
     {
         /* startup usb host thread */
-        rt_thread_startup(thread);
+        rt_thread_startup( pNuUSBHDev->polling_thread );
     }
     else
     {
@@ -742,6 +746,54 @@ uint32_t usbh_tick_from_millisecond(uint32_t msec)
     return rt_tick_from_millisecond(msec);
 }
 
+#if defined(RT_USING_PM)
+
+/* device pm suspend() entry. */
+static int usbhost_pm_suspend(const struct rt_device *device, rt_uint8_t mode)
+{
+    struct nu_usbh_dev * pNuUSBHDev = (struct nu_usbh_dev *)device;
+
+    RT_ASSERT(pNuUSBHDev!=RT_NULL);
+    switch (mode)
+    {
+    case PM_SLEEP_MODE_LIGHT:
+    case PM_SLEEP_MODE_DEEP:
+        pNuUSBHDev->polling_thread->stat = RT_THREAD_READY;
+        rt_thread_suspend(pNuUSBHDev->polling_thread);
+        break;
+
+    default:
+        break;
+    }
+
+    return (int)RT_EOK;
+}
+
+/* device pm resume() entry. */
+static void usbhost_pm_resume(const struct rt_device *device, rt_uint8_t mode)
+{
+    struct nu_usbh_dev * pNuUSBHDev = (struct nu_usbh_dev *)device;
+    RT_ASSERT(pNuUSBHDev!=RT_NULL);
+
+    switch (mode)
+    {
+    case PM_SLEEP_MODE_LIGHT:
+    case PM_SLEEP_MODE_DEEP:
+        rt_thread_resume(pNuUSBHDev->polling_thread);
+        break;
+
+    default:
+        break;
+    }
+}
+
+static struct rt_device_pm_ops device_pm_ops =
+{
+    .suspend = usbhost_pm_suspend,
+    .resume = usbhost_pm_resume,
+    .frequency_change = RT_NULL
+};
+#endif
 
 int nu_usbh_register(void)
 {
@@ -760,9 +812,6 @@ int nu_usbh_register(void)
 #endif
 
 #if defined(BSP_USING_USBH)
-    /* Enable USBD and OTG clock */
-    CLK_EnableModuleClock(USBD_MODULE);
-    CLK_EnableModuleClock(OTG_MODULE);
     /* Set USB Host role */
     SYS->USBPHY = (SYS->USBPHY & ~SYS_USBPHY_USBROLE_Msk) | (0x1u << SYS_USBPHY_USBROLE_Pos);
     SYS->USBPHY |= SYS_USBPHY_USBEN_Msk | SYS_USBPHY_SBO_Msk ;
@@ -775,11 +824,7 @@ int nu_usbh_register(void)
     rt_memset(&s_sUSBHDev, 0x0, sizeof(struct nu_usbh_dev));
 
     uhcd_t uhcd = (uhcd_t)rt_malloc(sizeof(struct uhcd));
-    if (uhcd == RT_NULL)
-    {
-        rt_kprintf("uhcd malloc failed\r\n");
-        return -RT_ERROR;
-    }
+    RT_ASSERT(res != RT_NULL);
 
     rt_memset((void *)uhcd, 0, sizeof(struct uhcd));
 
@@ -792,23 +837,18 @@ int nu_usbh_register(void)
     s_sUSBHDev.uhcd = uhcd;
 
     res = rt_device_register(&uhcd->parent, "usbh", RT_DEVICE_FLAG_DEACTIVATE);
-    if (res != RT_EOK)
-    {
-        rt_kprintf("register usb host failed res = %d\r\n", res);
-        return -RT_ERROR;
-    }
+    RT_ASSERT(res == RT_EOK);
 
-    /*initialize the usb host functin */
+    /*initialize the usb host function */
     res = rt_usb_host_init();
+    RT_ASSERT(res == RT_EOK);
 
+#if defined(RT_USING_PM)
+    rt_pm_device_register(&uhcd->parent, &device_pm_ops);
+#endif
+		
     return RT_EOK;
 }
 INIT_DEVICE_EXPORT(nu_usbh_register);
 
 #endif
-
-
-
-
-
-

+ 1 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_uspi.c

@@ -493,7 +493,7 @@ static void nu_uspi_transfer(struct nu_uspi *uspi_bus, uint8_t *tx, uint8_t *rx,
     /* DMA transfer constrains */
     if ((uspi_bus->pdma_chanid_rx >= 0) &&
             !((uint32_t)tx % bytes_per_word) &&
-            !((uint32_t)rx % bytes_per_word) )
+            !((uint32_t)rx % bytes_per_word))
         nu_uspi_pdma_transmit(uspi_bus, tx, rx, length, bytes_per_word);
     else
         nu_uspi_transmission_with_poll(uspi_bus, tx, rx, length, bytes_per_word);

+ 12 - 11
bsp/nuvoton/libraries/m480/rtt_port/drv_wdt.c

@@ -91,16 +91,17 @@ typedef volatile struct soft_time_handle soft_time_handle_t;
 /* Private functions ------------------------------------------------------------*/
 static rt_err_t wdt_init(rt_watchdog_t *dev);
 static rt_err_t wdt_control(rt_watchdog_t *dev, int cmd, void *args);
+static uint32_t wdt_get_module_clock(void);
 static uint32_t wdt_get_working_hz(void);
 static void soft_time_init(soft_time_handle_t *const soft_time);
 static void soft_time_setup(uint32_t wanted_sec, uint32_t hz, soft_time_handle_t *const soft_time);
 static void soft_time_feed_dog(soft_time_handle_t *const soft_time);
 
 #if defined(RT_USING_PM)
-static int wdt_pm_suspend(const struct rt_device *device, rt_uint8_t mode);
-static void wdt_pm_resume(const struct rt_device *device, rt_uint8_t mode);
-static int wdt_pm_frequency_change(const struct rt_device *device, rt_uint8_t mode);
-static void soft_time_freqeucy_change(uint32_t new_hz, soft_time_handle_t *const soft_time);
+    static int wdt_pm_suspend(const struct rt_device *device, rt_uint8_t mode);
+    static void wdt_pm_resume(const struct rt_device *device, rt_uint8_t mode);
+    static int wdt_pm_frequency_change(const struct rt_device *device, rt_uint8_t mode);
+    static void soft_time_freqeucy_change(uint32_t new_hz, soft_time_handle_t *const soft_time);
 #endif
 
 /* Public functions -------------------------------------------------------------*/
@@ -118,7 +119,6 @@ static struct rt_watchdog_ops ops_wdt =
 
 static struct rt_device_pm_ops device_pm_ops =
 {
-
     .suspend = wdt_pm_suspend,
     .resume = wdt_pm_resume,
     .frequency_change = wdt_pm_frequency_change
@@ -180,12 +180,6 @@ static void wdt_pm_resume(const struct rt_device *device, rt_uint8_t mode)
 }
 
 
-static uint32_t wdt_get_module_clock(void)
-{
-    return (CLK_GetModuleClockSource(WDT_MODULE) << CLK_CLKSEL1_WDTSEL_Pos);
-}
-
-
 /* device pm frequency_change() entry. */
 static int wdt_pm_frequency_change(const struct rt_device *device, rt_uint8_t mode)
 {
@@ -288,6 +282,12 @@ static rt_err_t wdt_init(rt_watchdog_t *dev)
 }
 
 
+static uint32_t wdt_get_module_clock(void)
+{
+    return (CLK_GetModuleClockSource(WDT_MODULE) << CLK_CLKSEL1_WDTSEL_Pos);
+}
+
+
 static uint32_t wdt_get_working_hz(void)
 {
     uint32_t clk, hz = 0;
@@ -408,6 +408,7 @@ static rt_err_t wdt_control(rt_watchdog_t *dev, int cmd, void *args)
 
     case RT_DEVICE_CTRL_WDT_START:
 
+        WDT_RESET_COUNTER();
         WDT_Open(MIN_TOUTSEL, WDT_RESET_DELAY_1026CLK, TRUE, TRUE);
         WDT_EnableInt();
         break;

+ 12 - 5
bsp/nuvoton/libraries/nu_packages/AudioCodec/SConscript

@@ -3,12 +3,19 @@ from building import *
 
 cwd = GetCurrentDir()
 group = []
+
+src = Split("""
+audio_test.c
+""")
+
+CPPPATH = [cwd]
+
 if GetDepend('NU_PKG_USING_NAU88L25'):
-    src = Split("""
-    acodec_nau88l25.c
-    audio_test.c
-    """)
-    CPPPATH = [cwd]
+    src += Glob('acodec_nau88l25.c')
     group = DefineGroup('nu_pkgs_nau88l25', src, depend = [''], CPPPATH = CPPPATH)
 
+elif GetDepend('NU_PKG_USING_NAU8822'):
+    src += Glob('acodec_nau8822.c')
+    group = DefineGroup('nu_pkgs_nau8822', src, depend = [''], CPPPATH = CPPPATH)
+
 Return('group')

+ 448 - 0
bsp/nuvoton/libraries/nu_packages/AudioCodec/acodec_nau8822.c

@@ -0,0 +1,448 @@
+/**************************************************************************//**
+*
+* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
+*
+* SPDX-License-Identifier: Apache-2.0
+*
+* Change Logs:
+* Date            Author       Notes
+* 2020-12-12      Wayne        First version
+*
+******************************************************************************/
+
+#include <rtconfig.h>
+
+#if defined(NU_PKG_USING_NAU8822)
+
+#include <rtthread.h>
+#include <rtdevice.h>
+
+#include "acodec_nau8822.h"
+#include "drv_i2s.h"
+
+#define DBG_ENABLE
+#define DBG_LEVEL DBG_LOG
+#define DBG_SECTION_NAME  "acodec.nau8822"
+#define DBG_COLOR
+#include <rtdbg.h>
+
+#define DEF_NAU8822_ADDR    0x1A
+
+static struct rt_i2c_bus_device *g_I2cBusDev = NULL;
+S_NU_NAU8822_CONFIG *g_psCodecConfig = NULL;
+
+static rt_err_t nau8822_init(void);
+static rt_err_t nau8822_reset(void);
+static rt_err_t nau8822_dsp_control(struct rt_audio_configure *config);
+static rt_err_t nau8822_mixer_control(rt_uint32_t ui32Units, rt_uint32_t ui32Value);
+static rt_err_t nau8822_mixer_query(rt_uint32_t ui32Units, rt_uint32_t *ui32Value);
+
+nu_acodec_ops nu_acodec_ops_nau8822 =
+{
+    .name = "NAU8822",
+    .role = NU_ACODEC_ROLE_SLAVE,
+    .config = { // Default settings.
+        .samplerate = 16000,
+        .channels = 2,
+        .samplebits = 16
+    },
+    .nu_acodec_init = nau8822_init,
+    .nu_acodec_reset = nau8822_reset,
+
+    .nu_acodec_dsp_control = nau8822_dsp_control,
+    .nu_acodec_mixer_control = nau8822_mixer_control,
+    .nu_acodec_mixer_query = nau8822_mixer_query
+};
+
+static void nau8822_delay_ms(rt_uint32_t nms)
+{
+    rt_thread_mdelay(nms);
+}
+
+static int I2C_ReadNAU8822(uint8_t u8addr, uint16_t *pu16data)
+{
+    struct rt_i2c_msg msgs[2];
+    uint8_t u8TxData = (u8addr << 1);
+
+    RT_ASSERT(g_I2cBusDev != NULL);
+    RT_ASSERT(pu16data != NULL);
+
+    msgs[0].addr  = DEF_NAU8822_ADDR;         /* Slave address */
+    msgs[0].flags = RT_I2C_WR;                /* Write flag */
+    msgs[0].buf   = (rt_uint8_t *)&u8TxData;  /* Number of bytes sent */
+    msgs[0].len   = sizeof(u8TxData);         /* Number of bytes read */
+
+    msgs[1].addr  = DEF_NAU8822_ADDR;         /* Slave address */
+    msgs[1].flags = RT_I2C_RD;                /* Read flag */
+    msgs[1].buf   = (rt_uint8_t *)pu16data;   /* Read data pointer */
+    msgs[1].len   = 2;                        /* Number of bytes read */
+
+    if (rt_i2c_transfer(g_I2cBusDev, &msgs[0], 2) != 2)
+    {
+        return -RT_ERROR;
+    }
+
+    return RT_EOK;
+}
+
+static int I2C_WriteNAU8822(uint8_t u8addr, uint16_t u16data)
+{
+    /* Write 9-bit data to 7-bit address register of NAU8822 */
+    struct rt_i2c_msg msg;
+    uint8_t au8TxData[2];
+
+    RT_ASSERT(g_I2cBusDev != NULL);
+
+    au8TxData[0] = (uint8_t)((u8addr << 1) | (u16data >> 8));  //u8addr [7:1] | u16data [8]
+    au8TxData[1] = (uint8_t)(u16data & 0x00FF);         //data [7:0]
+
+    msg.addr  = DEF_NAU8822_ADDR;                /* Slave address */
+    msg.flags = RT_I2C_WR;                       /* Write flag */
+    msg.buf   = (rt_uint8_t *)&au8TxData[0];     /* Slave register address */
+    msg.len   = sizeof(au8TxData);               /* Number of bytes sent */
+
+    if (g_I2cBusDev && rt_i2c_transfer(g_I2cBusDev, &msg, 1) != 1)
+    {
+        rt_kprintf("[Failed] addr=%x, data=%d\n", u8addr, u16data);
+        return -RT_ERROR;
+    }
+
+    {
+        /* Verify */
+        uint8_t au8RxData[2];
+        I2C_ReadNAU8822(u8addr, (uint16_t *)&au8RxData[0]);
+        rt_kprintf("Wrote addr %02x -> 0x%04x, read back -> 0x%02x%02x\n", u8addr, u16data, au8RxData[0], au8RxData[1]);
+    }
+
+    return RT_EOK;
+}
+
+
+static rt_err_t nau8822_probe(void)
+{
+    return RT_EOK;
+}
+
+static rt_err_t nau8822_reset(void)
+{
+    I2C_WriteNAU8822(0,  0x000);   /* Reset all registers */
+    nau8822_delay_ms(30);
+
+    LOG_I("Software Reset.\n");
+
+    return RT_EOK;
+}
+
+static rt_err_t nau8822_dsp_config(rt_uint32_t ui32SamplRate, rt_uint8_t u8ChNum, rt_uint8_t u8SamplBit)
+{
+    uint8_t   bClkDiv;
+    uint8_t   mClkDiv;
+    uint16_t  u16AudIf = 0x010; /* I2S, 16-bit */
+    uint16_t  u16ClkCtrl;
+    uint8_t   u8WLEN;
+
+    if (ui32SamplRate > 48000)
+        return -RT_ERROR;
+
+    if (u8ChNum == 2)
+    {
+        u16AudIf = (u16AudIf & 0x1FE) | 0x0;
+    }
+    else
+    {
+        u16AudIf = (u16AudIf & 0x1FE) | 0x1;
+    }
+
+    /* Force to set Channel number to 2 */
+    u8ChNum = 2;
+
+    switch (u8SamplBit)
+    {
+    case 16:
+        u8WLEN = 0x0;
+        break;
+
+    case 20:
+        u8WLEN = 0x1;
+        break;
+
+    case 24:
+        u8WLEN = 0x2;
+        break;
+
+    case 32:
+        u8WLEN = 0x3;
+        break;
+
+    default:
+        LOG_E("sample rate not match!\n");
+        return -RT_ERROR;
+    }
+    u16AudIf = (u16AudIf & 0x19F) | (u8WLEN << 5);
+
+    I2C_WriteNAU8822(4,  u16AudIf);
+
+    if (ui32SamplRate % 11025)
+    {
+        I2C_WriteNAU8822(36, 0x008);    //12.288Mhz
+        I2C_WriteNAU8822(37, 0x00C);
+        I2C_WriteNAU8822(38, 0x093);
+        I2C_WriteNAU8822(39, 0x0E9);
+
+        mClkDiv = (48000 * 256 * u8ChNum) / (ui32SamplRate * 256);
+        bClkDiv = (ui32SamplRate * 256) / (ui32SamplRate * u8ChNum * u8SamplBit);
+    }
+    else
+    {
+        I2C_WriteNAU8822(36, 0x007);    //11.2896Mhz
+        I2C_WriteNAU8822(37, 0x021);
+        I2C_WriteNAU8822(38, 0x161);
+        I2C_WriteNAU8822(39, 0x026);
+
+        mClkDiv = (44100 * 256 * u8ChNum) / (ui32SamplRate * 256);
+        bClkDiv = (ui32SamplRate * 256) / (ui32SamplRate * u8ChNum * u8SamplBit);
+    }
+
+    switch (mClkDiv)
+    {
+    case 1:
+        mClkDiv = 0;
+        break;
+    case 2:
+        mClkDiv = 2;
+        break;
+    case 3:
+        mClkDiv = 3;
+        break;
+    case 4:
+        mClkDiv = 4;
+        break;
+    case 6:
+        mClkDiv = 5;
+        break;
+    case 8:
+        mClkDiv = 6;
+        break;
+    case 12:
+        mClkDiv = 7;
+        break;
+    default:
+        LOG_E("mclk divider not match!\n");
+        mClkDiv = 0;
+        return -RT_ERROR;
+    }
+
+    switch (bClkDiv)
+    {
+    case 1:
+        bClkDiv = 0;
+        break;
+    case 2:
+        bClkDiv = 1;
+        break;
+    case 4:
+        bClkDiv = 2;
+        break;
+    case 8:
+        bClkDiv = 3;
+        break;
+    case 16:
+        bClkDiv = 4;
+        break;
+    case 32:
+        bClkDiv = 5;
+        break;
+    default:
+        LOG_E("bclk divider not match!\n");
+        bClkDiv = 0;
+        return -RT_ERROR;
+    }
+
+    u16ClkCtrl = (1 << 8) | (1 << 0);  //Use internal PLL, FS/BCLK
+
+    u16ClkCtrl = (u16ClkCtrl & 0x11F) | (mClkDiv << 5);
+    u16ClkCtrl = (u16ClkCtrl & 0x1E3) | (bClkDiv << 2);
+
+    I2C_WriteNAU8822(6,  u16ClkCtrl);
+
+    return RT_EOK;
+}
+
+static rt_err_t nau8822_init(void)
+{
+    //input source is MIC
+    I2C_WriteNAU8822(1,  0x03F);
+    I2C_WriteNAU8822(2,  0x1BF);   /* Enable L/R Headphone, ADC Mix/Boost, ADC */
+    I2C_WriteNAU8822(3,  0x07F);   /* Enable L/R main mixer, DAC */
+    I2C_WriteNAU8822(4,  0x010);   /* 16-bit word length, I2S format, Stereo */
+    I2C_WriteNAU8822(5,  0x000);   /* Companding control and loop back mode (all disable) */
+    nau8822_delay_ms(30);
+
+    if (nu_acodec_ops_nau8822.role == NU_ACODEC_ROLE_SLAVE)
+    {
+        I2C_WriteNAU8822(6,  0x1AD);   /* Divide by 6, 16K */
+        I2C_WriteNAU8822(7,  0x006);   /* 16K for internal filter coefficients */
+    }
+
+    I2C_WriteNAU8822(10, 0x008);   /* DAC soft mute is disabled, DAC oversampling rate is 128x */
+    I2C_WriteNAU8822(14, 0x108);   /* ADC HP filter is disabled, ADC oversampling rate is 128x */
+    I2C_WriteNAU8822(15, 0x1EF);   /* ADC left digital volume control */
+    I2C_WriteNAU8822(16, 0x1EF);   /* ADC right digital volume control */
+    I2C_WriteNAU8822(44, 0x033);   /* LMICN/LMICP is connected to PGA */
+    I2C_WriteNAU8822(49, 0x042);
+    I2C_WriteNAU8822(50, 0x001);   /* Left DAC connected to LMIX */
+    I2C_WriteNAU8822(51, 0x001);   /* Right DAC connected to RMIX */
+
+    nu_acodec_ops_nau8822.config.samplerate = 16000;
+    nu_acodec_ops_nau8822.config.channels = 2;
+    nu_acodec_ops_nau8822.config.samplebits = 16;
+
+    LOG_I("Initialized done.\n");
+
+    return RT_EOK;
+}
+
+static rt_err_t nau8822_dsp_control(struct rt_audio_configure *config)
+{
+    rt_err_t result = RT_EOK;
+    RT_ASSERT(config != RT_NULL);
+
+    if (rt_memcmp((void *)config, (void *)&nu_acodec_ops_nau8822.config, sizeof(struct rt_audio_configure)) != 0)
+    {
+        if ((result = nau8822_dsp_config(config->samplerate, config->channels, config->samplebits)) == RT_EOK)
+            rt_memcpy((void *)&nu_acodec_ops_nau8822.config, (void *)config, sizeof(struct rt_audio_configure)) ;
+    }
+    return result;
+}
+
+static rt_err_t nau8822_mixer_control(rt_uint32_t ui32Units, rt_uint32_t ui32Value)
+{
+    switch (ui32Units)
+    {
+    case AUDIO_MIXER_MUTE:
+    {
+        uint16_t u16Data;
+        I2C_ReadNAU8822(10, &u16Data);
+        if (ui32Value)
+        {
+            I2C_WriteNAU8822(10,  u16Data | (1 << 6));
+        }
+        else
+        {
+            I2C_WriteNAU8822(10,  u16Data & ~(1 << 6));
+        }
+    }
+    break;
+    case AUDIO_MIXER_VOLUME:
+    {
+        uint8_t u8DACGAIN = 256 * ui32Value / 100;
+        I2C_WriteNAU8822(11,  u8DACGAIN);
+        I2C_WriteNAU8822(12,  u8DACGAIN);
+    }
+    break;
+    case AUDIO_MIXER_QUERY:
+    case AUDIO_MIXER_BASS:
+    case AUDIO_MIXER_MID:
+    case AUDIO_MIXER_TREBLE:
+    case AUDIO_MIXER_EQUALIZER:
+    case AUDIO_MIXER_LINE:
+    case AUDIO_MIXER_DIGITAL:
+    case AUDIO_MIXER_MIC:
+    case AUDIO_MIXER_VITURAL:
+    case AUDIO_MIXER_EXTEND:
+    default:
+        return -RT_ERROR;
+    }
+
+    return RT_EOK;
+}
+
+static rt_err_t nau8822_mixer_query(rt_uint32_t ui32Units, rt_uint32_t *pui32Value)
+{
+    RT_ASSERT(pui32Value != RT_NULL);
+    rt_uint16_t u16RV = 0;
+
+    switch (ui32Units)
+    {
+    case AUDIO_MIXER_QUERY:
+        *pui32Value = AUDIO_MIXER_VOLUME | AUDIO_MIXER_MUTE;
+        break;
+
+    case AUDIO_MIXER_MUTE:
+        I2C_ReadNAU8822(10, (uint16_t *)&u16RV);
+        if (u16RV & (1 << 6))
+            *pui32Value = 1;
+        else
+            *pui32Value = 0;
+        break;
+
+    case AUDIO_MIXER_VOLUME:
+        I2C_ReadNAU8822(11, (uint16_t *)&u16RV);
+        *pui32Value = u16RV * 100 / 256;
+        break;
+
+    case AUDIO_MIXER_BASS:
+    case AUDIO_MIXER_MID:
+    case AUDIO_MIXER_TREBLE:
+    case AUDIO_MIXER_EQUALIZER:
+    case AUDIO_MIXER_LINE:
+    case AUDIO_MIXER_DIGITAL:
+    case AUDIO_MIXER_MIC:
+    case AUDIO_MIXER_VITURAL:
+    case AUDIO_MIXER_EXTEND:
+    default:
+        return -RT_ERROR;
+    }
+    return RT_EOK;
+}
+
+int nu_hw_nau8822_init(S_NU_NAU8822_CONFIG *psCodecConfig)
+{
+    RT_ASSERT(psCodecConfig != RT_NULL);
+    struct rt_i2c_bus_device *psI2cBusDev;
+    struct rt_audio_device *psAudioDev;
+    nu_i2s_t psNuI2s;
+
+    /* Find I2C bus */
+    psI2cBusDev = (struct rt_i2c_bus_device *)rt_device_find(psCodecConfig->i2c_bus_name);
+    if (psI2cBusDev == RT_NULL)
+    {
+        LOG_E("Can't found I2C bus - %s..!\n", psCodecConfig->i2c_bus_name);
+        goto exit_rt_hw_nau8822_init;
+    }
+
+    /* Find I2S bus */
+    psAudioDev = (struct rt_audio_device *)rt_device_find(psCodecConfig->i2s_bus_name);
+    if (psAudioDev == RT_NULL)
+    {
+        LOG_E("Can't found I2S bus - %s ..!\n", psCodecConfig->i2s_bus_name);
+        goto exit_rt_hw_nau8822_init;
+    }
+
+    if (nau8822_probe() != RT_EOK)
+    {
+        LOG_E("Can't found audio codec..!\n");
+        goto exit_rt_hw_nau8822_init;
+    }
+
+    /* Store this board setting. */
+    g_psCodecConfig = psCodecConfig;
+    g_I2cBusDev = psI2cBusDev;
+
+    /* Get NuI2S device instance. */
+    psNuI2s = (nu_i2s_t)psAudioDev;
+
+    /* Register Acodec Ops */
+    psNuI2s->AcodecOps = &nu_acodec_ops_nau8822;
+
+    /* Use Acodec default settings. */
+    rt_memcpy(&psNuI2s->config, &nu_acodec_ops_nau8822.config, sizeof(struct rt_audio_configure));
+
+    return RT_EOK;
+
+exit_rt_hw_nau8822_init:
+
+    return -RT_ERROR;
+}
+
+#endif //#if defined(NU_PKG_USING_NAU8822)

+ 32 - 0
bsp/nuvoton/libraries/nu_packages/AudioCodec/acodec_nau8822.h

@@ -0,0 +1,32 @@
+/**************************************************************************//**
+*
+* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
+*
+* SPDX-License-Identifier: Apache-2.0
+*
+* Change Logs:
+* Date            Author       Notes
+* 2020-12-12      Wayne        First version
+*
+******************************************************************************/
+
+#ifndef __ACODEC_NAU8822_H__
+#define __ACODEC_NAU8822_H__
+
+#include <rtdevice.h>
+
+typedef struct
+{
+    char      *i2c_bus_name;
+
+    char      *i2s_bus_name;
+
+    rt_int32_t pin_phonejack_en;
+
+    rt_int32_t pin_phonejack_det;
+
+} S_NU_NAU8822_CONFIG;
+
+int nu_hw_nau8822_init(S_NU_NAU8822_CONFIG *psCodecConfig);
+
+#endif /* __ACODEC_NAU8822_H__ */

+ 2 - 0
bsp/nuvoton/libraries/nu_packages/Demo/SConscript

@@ -5,6 +5,8 @@ group = []
 if GetDepend('NU_PKG_USING_DEMO'):
     src = Split("""
     usbd_hid_dance_mouse.c
+    slcd_show_tick.c
+    usbd_cdc_vcom_echo.c
     """)
     CPPPATH = [cwd]
     group = DefineGroup('nu_pkgs_demo', src, depend = [''], CPPPATH = CPPPATH)

+ 113 - 0
bsp/nuvoton/libraries/nu_packages/Demo/slcd_show_tick.c

@@ -0,0 +1,113 @@
+/**************************************************************************//**
+*
+* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
+*
+* SPDX-License-Identifier: Apache-2.0
+*
+* Change Logs:
+* Date            Author       Notes
+* 2020-11-11      Wayne        First version
+*
+******************************************************************************/
+
+#include <rtconfig.h>
+
+#if defined(BSP_USING_SLCD)
+
+#include <rtthread.h>
+#include <rtdevice.h>
+
+#include "slcd_rhe6616tp01.h"
+
+const uint32_t au32SLCDSymbols [] =
+{
+    SYMBOL_NVT,
+    SYMBOL_WIFI,
+    SYMBOL_SOUND,
+    SYMBOL_NUMICRO,
+    SYMBOL_BAT_FRAME,
+    SYMBOL_BAT_1,
+    SYMBOL_BAT_2,
+    SYMBOL_BAT_3,
+    SYMBOL_PLUS,
+    SYMBOL_MINUS,
+    SYMBOL_V,
+    SYMBOL_A,
+    SYMBOL_W,
+    SYMBOL_ARROW_UP,
+    SYMBOL_ARROW_LEFT,
+    SYMBOL_ARROW_DOWN,
+    SYMBOL_ARROW_RIGHT,
+    SYMBOL_CIRCLE_UP,
+    SYMBOL_CIRCLE_LEFT,
+    SYMBOL_CIRCLE_RIGHT,
+    SYMBOL_PERCENTAGE,
+    SYMBOL_PPM,
+    SYMBOL_TEMP_C,
+    SYMBOL_TEMP_F,
+    SYMBOL_VERSION,
+    SYMBOL_MAIN_DIG_COL1,
+    SYMBOL_MAIN_DIG_COL2,
+    SYMBOL_MAIN_DIG_COL3,
+    SYMBOL_MAIN_DIG_COL4,
+    SYMBOL_MAIN_DIG_COL5,
+    SYMBOL_MAIN_DIG_COL6,
+    SYMBOL_MAIN_DIG_P1,
+    SYMBOL_MAIN_DIG_P2,
+    SYMBOL_MAIN_DIG_P3,
+    SYMBOL_MAIN_DIG_P4,
+    SYMBOL_MAIN_DIG_P5,
+    SYMBOL_MAIN_DIG_P6,
+    SYMBOL_VER_DIG_P1,
+    SYMBOL_VER_DIG_P2,
+    SYMBOL_TIME_DIG_COL1,
+    SYMBOL_TIME_DIG_P1,
+    SYMBOL_TIME_DIG_P2,
+    SYMBOL_TIME_DIG_P3
+};
+const int i32SLCDSymbolsSize  = sizeof(au32SLCDSymbols) / sizeof(au32SLCDSymbols[0]);
+
+void slcd_demo_hook(void)
+{
+    uint32_t u32CurTickCount = rt_tick_get();
+
+    /* ZONE_MAIN_DIGIT */
+    LCDLIB_PrintNumber(ZONE_MAIN_DIGIT, u32CurTickCount);
+
+    /* ZONE_PPM_DIGIT */
+    LCDLIB_PrintNumber(ZONE_PPM_DIGIT, u32CurTickCount);
+
+    /* ZONE_TEMP_DIGIT */
+    LCDLIB_PrintNumber(ZONE_TEMP_DIGIT, u32CurTickCount);
+
+    /* ZONE_VER_DIGIT */
+    LCDLIB_PrintNumber(ZONE_VER_DIGIT, u32CurTickCount);
+
+    /* ZONE_TIME_DIGIT */
+    LCDLIB_PrintNumber(ZONE_TIME_DIGIT, u32CurTickCount);
+
+    /* ZONE_NUMICRO_DIGIT */
+    LCDLIB_PrintNumber(ZONE_NUMICRO_DIGIT, u32CurTickCount);
+
+    /* Travel all symbols */
+    LCDLIB_SetSymbol(au32SLCDSymbols[u32CurTickCount % i32SLCDSymbolsSize], (u32CurTickCount / i32SLCDSymbolsSize) % 2);
+
+    /* Travel all dots */
+    LCDLIB_SetSymbol(SYMBOL_S(u32CurTickCount % 40 + 1), (u32CurTickCount / 40) % 2);
+}
+
+static int slcd_demo_init(void)
+{
+    rt_err_t err = rt_thread_idle_sethook(slcd_demo_hook);
+
+    if (err != RT_EOK)
+    {
+        rt_kprintf("set idle hook failed!\n");
+        return -1;
+    }
+
+    return 0;
+}
+INIT_APP_EXPORT(slcd_demo_init);
+
+#endif /* #if defined(BSP_USING_SLCD) */

+ 70 - 0
bsp/nuvoton/libraries/nu_packages/Demo/usbd_cdc_vcom_echo.c

@@ -0,0 +1,70 @@
+#include <rtthread.h>
+
+#if defined(RT_USB_DEVICE_CDC) && (defined(BSP_USING_USBD) || defined(BSP_USING_HSUSBD))
+
+static struct rt_semaphore rx_sem;
+
+static rt_err_t uart_input(rt_device_t dev, rt_size_t size)
+{
+    rt_sem_release(&rx_sem);
+    return RT_EOK;
+}
+
+static void serial_thread_entry(void *parameter)
+{
+    rt_device_t serial = (rt_device_t)parameter;
+    char ch;
+    char szStr[64];
+    while (1)
+    {
+        while (rt_device_read(serial, -1, &ch, 1) != 1)
+        {
+            if (rt_sem_take(&rx_sem, 3 * RT_TICK_PER_SECOND) == -RT_ETIMEOUT)
+            {
+                time_t now;
+                /* output current time */
+                now = time(RT_NULL);
+                rt_snprintf(szStr, sizeof(szStr), "%.*s\n", 25, ctime(&now));
+                rt_device_write(serial, 0, &szStr[0], rt_strlen(szStr));
+                continue;
+            }
+        }
+        rt_device_write(serial, 0, &ch, 1);
+    }
+}
+
+static int vcom_echo_init(void)
+{
+    int err = 0;
+    rt_thread_t thread;
+    rt_device_t serial;
+
+    serial = rt_device_find("vcom");
+    if (!serial)
+    {
+        rt_kprintf("find failed!\n");
+        return RT_ERROR;
+    }
+    err = rt_device_init(serial);
+    if (err)
+    {
+        rt_kprintf("find failed!\n");
+        return -RT_ERROR;
+    }
+    err = rt_device_open(serial, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX/* | RT_DEVICE_FLAG_DMA_TX */);
+
+    rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
+
+    rt_device_set_rx_indicate(serial, uart_input);
+
+    thread = rt_thread_create("serial", serial_thread_entry, (void *)serial, 1024, 25, 10);
+    if (thread != RT_NULL)
+    {
+        rt_thread_startup(thread);
+    }
+
+    return RT_EOK;
+}
+INIT_APP_EXPORT(vcom_echo_init);
+
+#endif

+ 13 - 14
bsp/nuvoton/libraries/nu_packages/Demo/usbd_hid_dance_mouse.c

@@ -23,13 +23,12 @@
 
 static struct rt_thread usb_thread;
 ALIGN(RT_ALIGN_SIZE)
-static char usb_thread_stack[512];
+static char usb_thread_stack[1024];
 static struct rt_semaphore tx_sem_complete;
 
 static rt_err_t event_hid_in(rt_device_t dev, void *buffer)
 {
-    rt_sem_release(&tx_sem_complete);
-    return RT_EOK;
+    return rt_sem_release(&tx_sem_complete);
 }
 
 static void usb_thread_entry(void *parameter)
@@ -38,6 +37,7 @@ static void usb_thread_entry(void *parameter)
     uint8_t u8MouseIdx = 0;
     uint8_t u8MoveLen=0, u8MouseMode = 1;
     uint8_t pu8Buf[4];
+    rt_err_t result = RT_EOK;
 
     rt_device_t device = (rt_device_t)parameter;
 
@@ -78,7 +78,8 @@ static void usb_thread_entry(void *parameter)
         else
         {
             /* Wait it done. */
-            rt_sem_take(&tx_sem_complete, RT_WAITING_FOREVER);
+            result = rt_sem_take(&tx_sem_complete, RT_WAITING_FOREVER);
+            RT_ASSERT( result== RT_EOK );
         }
 
     } // while(1)
@@ -86,29 +87,27 @@ static void usb_thread_entry(void *parameter)
 
 static int dance_mouse_init(void)
 {
-    int err = 0;
+    rt_err_t ret = RT_EOK;
     rt_device_t device = rt_device_find("hidd");
 
     RT_ASSERT(device != RT_NULL);
 
-    err = rt_device_open(device, RT_DEVICE_FLAG_WRONLY);
+    ret = rt_device_open(device, RT_DEVICE_FLAG_WRONLY);
+    RT_ASSERT(ret == RT_EOK);
 
-    if (err != RT_EOK)
-    {
-        LOG_E("open dev failed!\n");
-        return -1;
-    }
-
-    rt_thread_init(&usb_thread,
+    ret = rt_thread_init(&usb_thread,
                    "hidd",
                    usb_thread_entry, device,
                    usb_thread_stack, sizeof(usb_thread_stack),
                    10, 20);
+    RT_ASSERT(ret == RT_EOK);
 
-    rt_thread_startup(&usb_thread);
+    ret = rt_thread_startup(&usb_thread);
+    RT_ASSERT(ret == RT_EOK);
 
     return 0;
 }
 INIT_APP_EXPORT(dance_mouse_init);
 
 #endif /* #if defined(RT_USB_DEVICE_HID) && (defined(BSP_USING_USBD) || defined(BSP_USING_HSUSBD)) */
+

+ 9 - 0
bsp/nuvoton/libraries/nu_packages/ILI9341/ili9341_ebi.c

@@ -42,6 +42,15 @@ void ili9341_send_pixel_data(rt_uint16_t color)
     ili9341_write_data(color);
 }
 
+void ili9341_send_pixels(rt_uint16_t *pixels, int len)
+{
+    int i = 0;
+    int size = len / sizeof(rt_uint16_t);
+
+    while (i < size)
+        ili9341_write_data(pixels[i]);
+}
+
 void ili9341_set_column(uint16_t StartCol, uint16_t EndCol)
 {
     ili9341_send_cmd(0x2A);

+ 8 - 2
bsp/nuvoton/libraries/nu_packages/ILI9341/ili9341_spi.c

@@ -54,9 +54,15 @@ static void ili9341_write_data_16bit(uint16_t data)
     rt_spi_transfer(&ili9341_spi_device, (const void *)&data, NULL, 2);
 }
 
-void ili9341_send_pixel_data(rt_uint16_t color)
+void ili9341_send_pixel_data(rt_uint16_t pixel)
 {
-    ili9341_write_data_16bit(color);
+    ili9341_write_data_16bit(pixel);
+}
+
+void ili9341_send_pixels(rt_uint16_t *pixels, int len)
+{
+    ili9341_change_datawidth(16);
+    rt_spi_transfer(&ili9341_spi_device, (const void *)pixels, NULL, len);
 }
 
 static rt_err_t ili9341_spi_send_then_recv(struct rt_spi_device *device,

+ 52 - 10
bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.c

@@ -17,6 +17,15 @@
 #include <rtdevice.h>
 #include <lcd_ili9341.h>
 
+static struct rt_device_graphic_info g_Ili9341Info =
+{
+    .bits_per_pixel = 16,
+    .pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565,
+    .framebuffer = RT_NULL,
+    .width = XSIZE_PHYS,
+    .height = YSIZE_PHYS
+};
+
 static void ili9341_delay_ms(rt_uint32_t nms)
 {
     rt_thread_mdelay(nms);
@@ -92,7 +101,11 @@ static rt_err_t ili9341_lcd_init(rt_device_t dev)
     ili9341_send_cmd_parameter(0x86);
 
     ili9341_send_cmd(0x36);
-    ili9341_send_cmd_parameter(0x48); // for 240x320
+
+    if (g_Ili9341Info.width == 240)
+        ili9341_send_cmd_parameter(0x48); // for 240x320
+    else
+        ili9341_send_cmd_parameter(0xE8); // for 320x240
 
     ili9341_send_cmd(0x3A);
     ili9341_send_cmd_parameter(0x55);
@@ -157,14 +170,37 @@ static rt_err_t ili9341_lcd_init(rt_device_t dev)
     return RT_EOK;
 }
 
-static void  ili9341_fillscreen(uint16_t color)
+#if defined(NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER)
+static void ili9341_fillrect(uint16_t *pixels, struct rt_device_rect_info *pRectInfo)
+{
+    ili9341_set_column(pRectInfo->x, pRectInfo->x + pRectInfo->width);
+    ili9341_set_page(pRectInfo->y, pRectInfo->y + pRectInfo->height);
+    ili9341_send_cmd(0x2c);
+
+    ili9341_send_pixels(pixels, pRectInfo->height * pRectInfo->width * 2);
+}
+#endif
+
+static void ili9341_fillscreen(rt_uint16_t color)
 {
+#if defined(NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER)
+    struct rt_device_rect_info rectinfo = { 0, 0, XSIZE_PHYS,  YSIZE_PHYS };
+    int pixel_count = XSIZE_PHYS * YSIZE_PHYS;
+    rt_uint16_t *pu16ShadowBuf = (rt_uint16_t *)g_Ili9341Info.framebuffer;
+
+    while (pixel_count--)
+    {
+        *pu16ShadowBuf++ = color;
+    }
+    ili9341_fillrect((uint16_t *)g_Ili9341Info.framebuffer, &rectinfo);
+#else
     ili9341_set_column(0, (XSIZE_PHYS - 1));
     ili9341_set_page(0, (YSIZE_PHYS - 1));
     ili9341_send_cmd(0x2c);
 
     for (int i = 0; i < (XSIZE_PHYS * YSIZE_PHYS); i++)
         ili9341_send_pixel_data(color);
+#endif
 }
 
 static void ili9341_lcd_set_pixel(const char *color, int x, int y)
@@ -227,19 +263,20 @@ static rt_err_t ili9341_lcd_control(rt_device_t dev, int cmd, void *args)
 
         info = (struct rt_device_graphic_info *) args;
         RT_ASSERT(info != RT_NULL);
-
-        info->bits_per_pixel = 16;
-        info->pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565;
-        info->framebuffer = RT_NULL;
-        info->width = XSIZE_PHYS;
-        info->height = YSIZE_PHYS;
+        rt_memcpy(args, (void *)&g_Ili9341Info, sizeof(struct rt_device_graphic_info));
     }
     break;
 
     case RTGRAPHIC_CTRL_RECT_UPDATE:
+    {
+#if defined(NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER)
+        RT_ASSERT(args != RT_NULL);
+        ili9341_fillrect((uint16_t *)g_Ili9341Info.framebuffer, (struct rt_device_rect_info *) args);
+#else
         /* nothong to be done */
-        break;
-
+#endif
+    }
+    break;
     default:
         break;
     }
@@ -272,6 +309,11 @@ int rt_hw_lcd_ili9341_init(void)
 
     lcd_device.user_data = &ili9341_ops;
 
+#if defined(NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER)
+    g_Ili9341Info.framebuffer = rt_malloc_align(g_Ili9341Info.bits_per_pixel / 2 * g_Ili9341Info.height * g_Ili9341Info.width, 32);
+    RT_ASSERT(g_Ili9341Info.framebuffer != RT_NULL);
+#endif
+
     /* register graphic device driver */
     rt_device_register(&lcd_device, "lcd", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);
 

+ 8 - 2
bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.h

@@ -28,8 +28,13 @@
 //
 // Physical display size
 //
-#define XSIZE_PHYS 240
-#define YSIZE_PHYS 320
+#if defined(NU_PKG_ILI9341_HORIZONTAL)
+    #define XSIZE_PHYS 320
+    #define YSIZE_PHYS 240
+#else
+    #define XSIZE_PHYS 240
+    #define YSIZE_PHYS 320
+#endif
 
 int rt_hw_lcd_ili9341_init(void);
 void ili9341_send_cmd(rt_uint8_t cmd);
@@ -38,6 +43,7 @@ void ili9341_set_column(rt_uint16_t StartCol, rt_uint16_t EndCol);
 void ili9341_set_page(rt_uint16_t StartPage, rt_uint16_t EndPage);
 void ili9341_send_pixel_data(rt_uint16_t color);
 void ili9341_lcd_get_pixel(char *color, int x, int y);
+void ili9341_send_pixels(rt_uint16_t *pixels, int len);
 
 #if defined(NU_PKG_USING_ILI9341_SPI)
     rt_err_t rt_hw_lcd_ili9341_spi_init(const char *spibusname);

+ 13 - 0
bsp/nuvoton/libraries/nu_packages/Kconfig

@@ -24,6 +24,11 @@ menu "Nuvoton Packages Config"
         select BSP_USING_I2C
         default n
 
+    config NU_PKG_USING_NAU8822
+        bool "NAU8822 Audio Codec."
+        select BSP_USING_I2C
+        default n
+
     config NU_PKG_USING_ILI9341
         bool "ILI9341 LCD Panel"
         select BSP_USING_GPIO
@@ -47,6 +52,14 @@ menu "Nuvoton Packages Config"
                     Choose this option if you the ili9341 device is with EBI interface.
             endchoice
 
+            config NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
+                bool "Create an offscreen framebuffer."
+                default n
+
+            config NU_PKG_ILI9341_HORIZONTAL
+                bool "Set horizontal view. (320x240)"
+                default n
+
         endif
 
 endmenu

+ 4 - 2
bsp/nuvoton/libraries/nu_packages/NuUtils/inc/nu_bitutil.h

@@ -43,7 +43,7 @@ extern "C" {
 */
 __STATIC_INLINE int nu_clz(uint32_t x)
 {
-    return __CLZ(x);
+    return x ? __CLZ(x):32;
 }
 
 /* Count Leading Ones in word - Find Highest Zero
@@ -65,7 +65,9 @@ __STATIC_INLINE int nu_clo(uint32_t x)
 */
 __STATIC_INLINE int nu_ctz(uint32_t x)
 {
-    int c = __CLZ(x & -x);
+    int c = 32;
+    if (x)
+        c = __CLZ(x & -x);
     return x ? 31 - c : c;
 }
 

+ 12 - 0
bsp/nuvoton/libraries/nu_packages/SLCD/SConscript

@@ -0,0 +1,12 @@
+# RT-Thread building script for component
+
+from building import *
+
+cwd = GetCurrentDir()
+group = []
+if GetDepend('BSP_USING_SLCD'):
+	src = Glob('*.c') + Glob('*.cpp')
+	CPPPATH = [cwd]
+	group = DefineGroup('nu_pkgs_slcd', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')

+ 780 - 0
bsp/nuvoton/libraries/nu_packages/SLCD/slcd_rhe6616tp01.c

@@ -0,0 +1,780 @@
+/**************************************************************************//**
+ * @file     LCDLIB.c
+ * @version  V3.00
+ * @brief    RHE6616TP01(8-COM, 40-SEG, 1/4 Bias) LCD library source file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2019-2020 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+
+#include <rtthread.h>
+#include <rtdevice.h>
+
+#include "drv_slcd.h"
+#include "slcd_rhe6616tp01.h"
+
+#define DBG_SECTION_NAME "slcd_demo"
+#define DBG_LEVEL DBG_LOG
+#include <rtdbg.h>
+
+static rt_device_t g_psDev = RT_NULL;
+
+/**************************************************************************//**
+ *
+ * Defines each text's segment (alphabet+numeric) in terms of COM and SEG numbers,
+ * Using this way that text segment can be consisted of each bit in the
+ * following bit pattern:
+ * @illustration
+ *              A
+ *         -----------
+ *         |\   |   /|
+ *         F G  H  I B
+ *         |  \ | /  |
+ *         --J-- --K--
+ *         |   /| \  |
+ *         E  L M  N C
+ *         | /  |   \|
+ *         -----------
+ *              D
+ *
+ *              0
+ *         -----------
+ *         |\   |   /|
+ *        5| 6  7  8 |1
+ *         |  \ | /  |
+ *         --9-- -10--
+ *         |   /| \  |
+ *        4| 11 12 13|2
+ *         | /  |   \|
+ *         -----------
+ *              3
+ *
+ *****************************************************************************/
+static const char acMainDigitRawData[ZONE_MAIN_DIG_CNT][ZONE_MAIN_SEG_NUM][2] =
+{
+    {
+        // digit 1, {com, seg}
+        // A     // B     // C     // D
+        {0,  1}, {0,  0}, {3,  0}, {3,  1},
+        // E     // F     // G     // H
+        {2,  3}, {0,  3}, {0,  2}, {1,  1},
+        // I     // J     // K     // L
+        {1,  0}, {1,  2}, {2,  0}, {3,  2},
+        // M     // N
+        {2,  2}, {2,  1},
+    },
+    {
+        // digit 2, {com, seg}
+        // A     // B     // C     // D
+        {0, 18}, {0, 19}, {3, 19}, {3, 18},
+        // E     // F     // G     // H
+        {2, 16}, {0, 16}, {0, 17}, {1, 18},
+        // I     // J     // K     // L
+        {1, 19}, {1, 17}, {2, 19}, {3, 17},
+        // M     // N
+        {2, 17}, {2, 18},
+    },
+    {
+        // digit 3, {com, seg}
+        // A     // B     // C     // D
+        {0, 22}, {0, 23}, {3, 23}, {3, 22},
+        // E     // F     // G     // H
+        {2, 20}, {0, 20}, {0, 21}, {1, 22},
+        // I     // J     // K     // L
+        {1, 23}, {1, 21}, {2, 23}, {3, 21},
+        // M     // N
+        {2, 21}, {2, 22},
+    },
+    {
+        // digit 4, {com, seg}
+        // A     // B     // C     // D
+        {0, 26}, {0, 27}, {3, 27}, {3, 26},
+        // E     // F     // G     // H
+        {2, 24}, {0, 24}, {0, 25}, {1, 26},
+        // I     // J     // K     // L
+        {1, 27}, {1, 25}, {2, 27}, {3, 25},
+        // M     // N
+        {2, 25}, {2, 26},
+    },
+    {
+        // digit 5, {com, seg}
+        // A     // B     // C     // D
+        {0, 30}, {0, 31}, {3, 31}, {3, 30},
+        // E     // F     // G     // H
+        {2, 28}, {0, 28}, {0, 29}, {1, 30},
+        // I     // J     // K     // L
+        {1, 31}, {1, 29}, {2, 31}, {3, 29},
+        // M     // N
+        {2, 29}, {2, 30},
+    },
+    {
+        // digit 6, {com, seg}
+        // A     // B     // C     // D
+        {0, 34}, {0, 35}, {3, 35}, {3, 34},
+        // E     // F     // G     // H
+        {2, 32}, {0, 32}, {0, 33}, {1, 34},
+        // I     // J     // K     // L
+        {1, 35}, {1, 33}, {2, 35}, {3, 33},
+        // M     // N
+        {2, 33}, {2, 34},
+    },
+    {
+        // digit 7, {com, seg}
+        // A     // B     // C     // D
+        {0, 38}, {0, 39}, {3, 39}, {3, 38},
+        // E     // F     // G     // H
+        {2, 36}, {0, 36}, {0, 37}, {1, 38},
+        // I     // J     // K     // L
+        {1, 39}, {1, 37}, {2, 39}, {3, 37},
+        // M     // N
+        {2, 37}, {2, 38},
+    },
+};
+
+
+/**************************************************************************//**
+ *
+ * Defines each text's segment (numeric) in terms of COM and BIT numbers,
+ * Using this way that text segment can be consisted of each bit in the
+ * following bit pattern:
+ * @illustration
+ *
+ *         ---A---
+ *         |     |
+ *         F     B
+ *         |     |
+ *         ---G---
+ *         |     |
+ *         E     C
+ *         |     |
+ *         ---D---
+ *
+ *         ---0---
+ *         |     |
+ *         5     1
+ *         |     |
+ *         ---6---
+ *         |     |
+ *         4     2
+ *         |     |
+ *         ---3---
+ *
+ *****************************************************************************/
+static const char acPPMDigitRawData[ZONE_PPM_DIG_CNT][ZONE_PPM_SEG_NUM][2] =
+{
+    {
+        // digit 1, {com, seg}
+        // A     // B     // C     // D
+        {4, 16}, {5, 17}, {7, 17}, {7, 16},
+        // E     // F     // G
+        {6, 16}, {5, 16}, {6, 17},
+    },
+    {
+        // digit 2, {com, seg}
+        // A     // B     // C     // D
+        {4, 18}, {5, 19}, {7, 19}, {7, 18},
+        // E     // F     // G
+        {6, 18}, {5, 18}, {6, 19},
+    },
+    {
+        // digit 3, {com, seg}
+        // A     // B     // C     // D
+        {4, 20}, {5, 21}, {7, 21}, {7, 20},
+        // E     // F     // G
+        {6, 20}, {5, 20}, {6, 21},
+    },
+};
+
+static const char acTEMPDigitRawData[ZONE_TEMP_DIG_CNT][ZONE_TEMP_SEG_NUM][2] =
+{
+    {
+        // digit 1, {com, seg}
+        // A     // B     // C     // D
+        {4, 22}, {5, 23}, {7, 23}, {7, 22},
+        // E     // F     // G
+        {6, 22}, {5, 22}, {6, 23},
+    },
+    {
+        // digit 2, {com, seg}
+        // A     // B     // C     // D
+        {4, 24}, {5, 25}, {7, 25}, {7, 24},
+        // E     // F     // G
+        {6, 24}, {5, 24}, {6, 25},
+    },
+    {
+        // digit 3, {com, seg}
+        // A     // B     // C     // D
+        {4, 26}, {5, 27}, {7, 27}, {7, 26},
+        // E     // F     // G
+        {6, 26}, {5, 26}, {6, 27},
+    },
+};
+
+static const char acVERDigitRawData[ZONE_VER_DIG_CNT][ZONE_VER_SEG_NUM][2] =
+{
+    {
+        // digit 1, {com, seg}
+        // A     // B     // C     // D
+        {4, 28}, {5, 29}, {7, 29}, {7, 28},
+        // E     // F     // G
+        {6, 28}, {5, 28}, {6, 29},
+    },
+    {
+        // digit 2, {com, seg}
+        // A     // B     // C     // D
+        {4, 30}, {5, 31}, {7, 31}, {7, 30},
+        // E     // F     // G
+        {6, 30}, {5, 30}, {6, 31},
+    },
+    {
+        // digit 3, {com, seg}
+        // A     // B     // C     // D
+        {4, 32}, {5, 33}, {7, 33}, {7, 32},
+        // E     // F     // G
+        {6, 32}, {5, 32}, {6, 33},
+    },
+    {
+        // digit 4, {com, seg}
+        // A     // B     // C     // D
+        {4, 34}, {5, 35}, {7, 35}, {7, 34},
+        // E     // F     // G
+        {6, 34}, {5, 34}, {6, 35},
+    },
+    {
+        // digit 5, {com, seg}
+        // A     // B     // C     // D
+        {4, 36}, {5, 37}, {7, 37}, {7, 36},
+        // E     // F     // G
+        {6, 36}, {5, 36}, {6, 37},
+    },
+    {
+        // digit 6, {com, seg}
+        // A     // B     // C     // D
+        {4, 38}, {5, 39}, {7, 39}, {7, 38},
+        // E     // F     // G
+        {6, 38}, {5, 38}, {6, 39},
+    },
+};
+
+static const char acTimeDigitRawData[ZONE_TIME_DIG_CNT][ZONE_TIME_SEG_NUM][2] =
+{
+    {
+        // digit 1, {com, seg}
+        // A     // B     // C     // D
+        {7,  2}, {6,  3}, {4,  3}, {4,  2},
+        // E     // F     // G
+        {5,  2}, {6,  2}, {5, 3},
+    },
+    {
+        // digit 2, {com, seg}
+        // A     // B     // C     // D
+        {7,  4}, {6,  5}, {4,  5}, {4,  4},
+        // E     // F     // G
+        {5,  4}, {6,  4}, {5, 5},
+    },
+    {
+        // digit 3, {com, seg}
+        // A     // B     // C     // D
+        {7,  6}, {6,  7}, {4,  7}, {4,  6},
+        // E     // F     // G
+        {5,  6}, {6,  6}, {5, 7},
+    },
+    {
+        // digit 4, {com, seg}
+        // A     // B     // C     // D
+        {7,  8}, {6,  9}, {4,  9}, {4,  8},
+        // E     // F     // G
+        {5,  8}, {6,  8}, {5, 9},
+    },
+};
+
+static const char acNuMicroDigitRawData[ZONE_NUMICRO_DIG_CNT][ZONE_NUMICRO_SEG_NUM][2] =
+{
+    {
+        // digit 1, {com, seg}
+        // A     // B     // C     // D
+        {3,  4}, {2,  5}, {0,  5}, {0,  4},
+        // E     // F     // G
+        {1,  4}, {2,  4}, {1,  5},
+    },
+    {
+        // digit 2, {com, seg}
+        // A     // B     // C     // D
+        {3,  6}, {2,  7}, {0,  7}, {0,  6},
+        // E     // F     // G
+        {1,  6}, {2,  6}, {1,  7},
+    },
+    {
+        // digit 3, {com, seg}
+        // A     // B     // C     // D
+        {3,  8}, {2,  9}, {0,  9}, {0,  8},
+        // E     // F     // G
+        {1,  8}, {2,  8}, {1,  9},
+    },
+};
+
+/**************************************************************************//**
+ *
+ * Defines segments for the alphabet - ASCII table 0x20 to 0x7A
+ * Bit pattern below defined for alphabet (text segments)
+ *
+ *****************************************************************************/
+static const uint16_t auMainDigitMap[] =
+{
+    0x0000, /* space */
+    0x1100, /* ! */
+    0x0280, /* " */
+    0x0000, /* # */
+    0x0000, /* $ */
+    0x0000, /* % */
+    0x0000, /* & */
+    0x0000, /* ? */
+    0x0039, /* ( */
+    0x000f, /* ) */
+    0x3fc0, /* * */
+    0x1540, /* + */
+    0x0000, /* , */
+    0x0440, /* - */
+    0x8000, /* . */
+    0x2200, /* / */
+
+    0x003F, /* 0 */
+    0x0006, /* 1 */
+    0x061B, /* 2 */
+    0x060F, /* 3 */
+    0x0626, /* 4 */
+    0x062D, /* 5 */
+    0x063D, /* 6 */
+    0x0007, /* 7 */
+    0x063F, /* 8 */
+    0x062F, /* 9 */
+
+    0x0000, /* : */
+    0x0000, /* ; */
+    0x2100, /* < */
+    0x0000, /* = */
+    0x0840, /* > */
+    0x1403, /* ? */
+    0x3FFF, /* @ */
+
+    0x0637, /* A */
+    0x2339, /* B */
+    0x0039, /* C */
+    0x2139, /* D */
+    0x0639, /* E */
+    0x0631, /* F */
+    0x043D, /* G */
+    0x0636, /* H */
+    0x1080, /* I */
+    0x000E, /* J */
+    0x2330, /* K */
+    0x0038, /* L */
+    0x0176, /* M */
+    0x2076, /* N */
+    0x003F, /* O */
+    0x0633, /* P */
+    0x203F, /* Q */
+    0x2331, /* R */
+    0x062D, /* S */
+    0x1081, /* T */
+    0x003E, /* U */
+    0x0930, /* V */
+    0x2836, /* W */
+    0x2940, /* X */
+    0x1140, /* Y */
+    0x0909, /* Z */
+
+    0x0039, /* [ */
+    0x0900, /* backslash */
+    0x000F, /* ] */
+    0x2800, /* ^ */
+    0x0008, /* _ */
+    0x0040, /* ` */
+
+    0x1218, /* a */
+    0x063C, /* b */
+    0x0618, /* c */
+    0x061E, /* d */
+    0x0A18, /* e */
+    0x0231, /* f */
+    0x048F, /* g */
+    0x1230, /* h */
+    0x1000, /* i */
+    0x000E, /* j */
+    0x2330, /* k */
+    0x0038, /* l */
+    0x1614, /* m */
+    0x1404, /* n */
+    0x061C, /* o */
+    0x0331, /* p */
+    0x0447, /* q */
+    0x1400, /* r */
+    0x2408, /* s */
+    0x0238, /* t */
+    0x1018, /* u */
+    0x0810, /* v */
+    0x2814, /* w */
+    0x2940, /* x */
+    0x0446, /* y */
+    0x0A08, /* z */
+
+    0x0000,
+};
+
+/**************************************************************************//**
+ * Defines segments for the numeric display
+ *****************************************************************************/
+static const uint16_t auPPMDigitMap[] =
+{
+    0x3F, /* 0 */
+    0x06, /* 1 */
+    0x5B, /* 2 */
+    0x4F, /* 3 */
+    0x66, /* 4 */
+    0x6D, /* 5 */
+    0x7D, /* 6 */
+    0x07, /* 7 */
+    0x7F, /* 8 */
+    0x6F, /* 9 */
+};
+
+static const uint16_t auTEMPDigitMap[] =
+{
+    0x3F, /* 0 */
+    0x06, /* 1 */
+    0x5B, /* 2 */
+    0x4F, /* 3 */
+    0x66, /* 4 */
+    0x6D, /* 5 */
+    0x7D, /* 6 */
+    0x07, /* 7 */
+    0x7F, /* 8 */
+    0x6F, /* 9 */
+};
+
+static const uint16_t auVERDigitMap[] =
+{
+    0x3F, /* 0 */
+    0x06, /* 1 */
+    0x5B, /* 2 */
+    0x4F, /* 3 */
+    0x66, /* 4 */
+    0x6D, /* 5 */
+    0x7D, /* 6 */
+    0x07, /* 7 */
+    0x7F, /* 8 */
+    0x6F, /* 9 */
+};
+
+static const uint16_t auTimeDigitMap[] =
+{
+    0x3F, /* 0 */
+    0x06, /* 1 */
+    0x5B, /* 2 */
+    0x4F, /* 3 */
+    0x66, /* 4 */
+    0x6D, /* 5 */
+    0x7D, /* 6 */
+    0x07, /* 7 */
+    0x7F, /* 8 */
+    0x6F, /* 9 */
+};
+
+static const uint16_t auNuMicroDigitMap[] =
+{
+    0x3F, /* 0 */
+    0x06, /* 1 */
+    0x5B, /* 2 */
+    0x4F, /* 3 */
+    0x66, /* 4 */
+    0x6D, /* 5 */
+    0x7D, /* 6 */
+    0x07, /* 7 */
+    0x7F, /* 8 */
+    0x6F, /* 9 */
+};
+
+/* Zone information */
+static const LCD_ZONE_INFO_T g_LCDZoneInfo[] =
+{
+    {ZONE_MAIN_DIG_CNT,     ZONE_MAIN_SEG_NUM},
+    {ZONE_PPM_DIG_CNT,      ZONE_PPM_SEG_NUM},
+    {ZONE_TEMP_DIG_CNT,     ZONE_TEMP_SEG_NUM},
+    {ZONE_VER_DIG_CNT,      ZONE_VER_SEG_NUM},
+    {ZONE_TIME_DIG_CNT,     ZONE_TIME_SEG_NUM},
+    {ZONE_NUMICRO_DIG_CNT,  ZONE_NUMICRO_SEG_NUM},
+};
+
+/* Raw data table for each zone */
+static const char *g_GetLCDComSeg[] =
+{
+    (const char *)(acMainDigitRawData),
+    (const char *)(acPPMDigitRawData),
+    (const char *)(acTEMPDigitRawData),
+    (const char *)(acVERDigitRawData),
+    (const char *)(acTimeDigitRawData),
+    (const char *)(acNuMicroDigitRawData),
+};
+
+/* Display mapping table for each zone */
+static const uint16_t *g_LCDDispTable[] =
+{
+    (const uint16_t *)(auMainDigitMap),
+    (const uint16_t *)(auPPMDigitMap),
+    (const uint16_t *)(auTEMPDigitMap),
+    (const uint16_t *)(auVERDigitMap),
+    (const uint16_t *)(auTimeDigitMap),
+    (const uint16_t *)(auNuMicroDigitMap),
+};
+
+
+void SLCD_SetPixel(uint32_t u32Com, uint32_t u32Seg, uint32_t u32OnFlag)
+{
+    if (g_psDev)
+    {
+        struct nu_slcd_pixel sNuSLCDPxl;
+
+        sNuSLCDPxl.m_u32Com = u32Com;
+        sNuSLCDPxl.m_u32Seg = u32Seg;
+        sNuSLCDPxl.m_u32OnFlag = u32OnFlag;
+        rt_device_write(g_psDev, 0, (void *)&sNuSLCDPxl, sizeof(struct nu_slcd_pixel));
+    }
+}
+
+/**
+ *  @brief Display text on LCD
+ *
+ *  @param[in]  u32Zone     the assigned number of display area
+ *  @param[in]  InputStr    Text string to show on display
+ *
+ *  @return None
+ */
+void LCDLIB_Printf(uint32_t u32Zone, char *InputStr)
+{
+    uint32_t    i, index, ch, len;
+    uint16_t    DispData;
+    uint32_t    com, seg;
+
+    len = rt_strlen(InputStr);
+
+    /* Fill out all characters on display */
+    for (index = 0; index < g_LCDZoneInfo[u32Zone].u32DigitCnt; index++)
+    {
+        if (index < len)
+        {
+            ch = *InputStr;
+        }
+        else
+        {
+            /* Padding with SPACE */
+            ch = 0x20;
+        }
+
+        /* The Main Digit Table is an ASCII table beginning with "SPACE" (hex is 0x20) */
+        ch       = ch - 0x20;
+        DispData = *(g_LCDDispTable[u32Zone] + ch);
+
+        for (i = 0; i < g_LCDZoneInfo[u32Zone].u32MaxSegNum; i++)
+        {
+            com = *(g_GetLCDComSeg[u32Zone]
+                    + (index * g_LCDZoneInfo[u32Zone].u32MaxSegNum * 2)
+                    + (i * 2) + 0);
+            seg = *(g_GetLCDComSeg[u32Zone]
+                    + (index * g_LCDZoneInfo[u32Zone].u32MaxSegNum * 2)
+                    + (i * 2) + 1);
+
+            /* Turn off display */
+            SLCD_SetPixel(com, seg, 0);
+
+            if (DispData & (1 << i))
+            {
+                /* Turn on display */
+                SLCD_SetPixel(com, seg, 1);
+            }
+        }
+
+        InputStr++;
+    }
+}
+
+/**
+ *  @brief Display number on LCD
+ *
+ *  @param[in]  u32Zone     the assigned number of display area
+ *  @param[in]  InputNum    number to show on display
+ *
+ *  @return None
+ */
+void LCDLIB_PrintNumber(uint32_t u32Zone, uint32_t InputNum)
+{
+    uint32_t    i, index, val, div;
+    uint16_t    DispData;
+    uint32_t    com, seg;
+
+    /* Extract useful digits */
+    div = 1;
+
+    /* Fill out all characters on display */
+    index = g_LCDZoneInfo[u32Zone].u32DigitCnt;
+    while (index != 0)
+    {
+        index--;
+
+        val = (InputNum / div) % 10;
+        if (u32Zone == ZONE_MAIN_DIGIT)
+            val += 16; /* The Main Digit Table is an ASCII table beginning with "SPACE" */
+
+        DispData = *(g_LCDDispTable[u32Zone] + val);
+
+        for (i = 0; i < g_LCDZoneInfo[u32Zone].u32MaxSegNum; i++)
+        {
+            com = *(g_GetLCDComSeg[u32Zone]
+                    + (index * g_LCDZoneInfo[u32Zone].u32MaxSegNum * 2)
+                    + (i * 2) + 0);
+            seg = *(g_GetLCDComSeg[u32Zone]
+                    + (index * g_LCDZoneInfo[u32Zone].u32MaxSegNum * 2)
+                    + (i * 2) + 1);
+
+            /* Turn off display */
+            SLCD_SetPixel(com, seg, 0);
+
+            if (DispData & (1 << i))
+            {
+                /* Turn on display */
+                SLCD_SetPixel(com, seg, 1);
+            }
+        }
+
+        div = div * 10;
+    }
+}
+
+/**
+ *  @brief Display character on LCD
+ *
+ *  @param[in]  u32Zone     the assigned number of display area
+ *  @param[in]  u32Index    the requested display position in zone
+ *  @param[in]  u8Ch        Character to show on display
+ *
+ *  @return None
+ */
+void LCDLIB_PutChar(uint32_t u32Zone, uint32_t u32Index, uint8_t u8Ch)
+{
+    uint32_t    i, ch;
+    uint16_t    DispData;
+    uint32_t    com, seg;
+
+    if (u32Index <= g_LCDZoneInfo[u32Zone].u32DigitCnt)
+    {
+        /* Defined letters currently starts at "SPACE" - 0x20; */
+        ch       = u8Ch - 0x20;
+        DispData = *(g_LCDDispTable[u32Zone] + ch);
+
+        for (i = 0; i < g_LCDZoneInfo[u32Zone].u32MaxSegNum; i++)
+        {
+            com = *(g_GetLCDComSeg[u32Zone]
+                    + (u32Index * g_LCDZoneInfo[u32Zone].u32MaxSegNum * 2)
+                    + (i * 2) + 0);
+
+            seg = *(g_GetLCDComSeg[u32Zone]
+                    + (u32Index * g_LCDZoneInfo[u32Zone].u32MaxSegNum * 2)
+                    + (i * 2) + 1);
+
+            /* Turn off display */
+            SLCD_SetPixel(com, seg, 0);
+
+            if (DispData & (1 << i))
+            {
+                /* Turn on display */
+                SLCD_SetPixel(com, seg, 1);
+            }
+        }
+    }
+}
+
+/**
+ *  @brief Display symbol on LCD
+ *
+ *  @param[in]  u32Symbol   the combination of com, seg position
+ *  @param[in]  u32OnOff    1: display symbol
+ *                          0: not display symbol
+ *
+ *  @return     None
+ */
+void LCDLIB_SetSymbol(uint32_t u32Symbol, uint32_t u32OnOff)
+{
+    uint32_t com, seg;
+
+    com = (u32Symbol & 0xF);
+    seg = ((u32Symbol & 0xFF0) >> 4);
+
+    if (u32OnOff)
+        SLCD_SetPixel(com, seg, 1); /* Turn on display */
+    else
+        SLCD_SetPixel(com, seg, 0); /* Turn off display */
+
+}
+
+static S_LCD_CFG_T g_LCDCfg_RHE6616TP01 =
+{
+    __LXT,                      /*!< LCD clock source frequency */
+    LCD_COM_DUTY_1_8,           /*!< COM duty */
+    LCD_BIAS_LV_1_4,            /*!< Bias level */
+    64,                         /*!< Operation frame rate */
+    LCD_WAVEFORM_TYPE_A_NORMAL, /*!< Waveform type */
+    LCD_DISABLE_ALL_INT,        /*!< Interrupt source */
+    LCD_LOW_DRIVING_AND_BUF_ON, /*!< Driving mode */
+    LCD_VOLTAGE_SOURCE_CP,      /*!< Voltage source */
+};
+
+static int nu_slcd_panel_init(void)
+{
+    uint32_t u32CPVol;
+    rt_err_t ret = RT_EOK;
+
+    g_psDev = rt_device_find("slcd");
+    if (g_psDev == RT_NULL)
+    {
+        LOG_E("can't find slcd failed!\n");
+        goto fail_nu_slcd_panel_init;
+    }
+
+    /* Give owned SLCD configuration before openning. */
+    ret = rt_device_control(g_psDev, NU_SLCD_CMD_SET_LCD_CFG, (void *)&g_LCDCfg_RHE6616TP01);
+    if (ret != RT_EOK)
+    {
+        LOG_E("configure SLCD failed!\n");
+        goto fail_nu_slcd_panel_init;
+    }
+
+    /* Open SLCD. */
+    ret = rt_device_open(g_psDev, RT_DEVICE_FLAG_WRONLY);
+    if (ret != RT_EOK)
+    {
+        LOG_E("open dev failed!\n");
+        goto fail_nu_slcd_panel_init;
+    }
+
+    /* Note: This panel need inject 4.8v, but m2354 charge pump max voltage is 3.6v. */
+    u32CPVol = LCD_CP_VOLTAGE_LV_5;
+    ret = rt_device_control(g_psDev, NU_SLCD_CMD_SET_CP_VOLTAGE, (void *)&u32CPVol);
+    if (ret != RT_EOK)
+    {
+        LOG_E("faile to control cp voltage!\n");
+        goto fail_nu_slcd_panel_init;
+    }
+
+    return (int)ret;
+
+fail_nu_slcd_panel_init:
+
+    if (g_psDev)
+    {
+        rt_device_close(g_psDev);
+        g_psDev = RT_NULL;
+    }
+    return (int)ret;
+}
+INIT_COMPONENT_EXPORT(nu_slcd_panel_init);
+
+/*** (C) COPYRIGHT 2019-2020 Nuvoton Technology Corp. ***/

+ 139 - 0
bsp/nuvoton/libraries/nu_packages/SLCD/slcd_rhe6616tp01.h

@@ -0,0 +1,139 @@
+/**************************************************************************//**
+ * @file     LCDLIB.h
+ * @version  V3.00
+ * @brief    RHE6616TP01(8-COM, 40-SEG, 1/4 Bias) LCD library header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2019-2020 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __M2354_LCDLIB_H
+#define __M2354_LCDLIB_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @addtogroup LIBRARY Library
+  @{
+*/
+
+/** @addtogroup M2354_LCDLIB_Driver LCD Library
+  @{
+*/
+
+/** @addtogroup M2354_LCDLIB_EXPORTED_CONSTANTS LCDLIB Exported Constants
+  @{
+*/
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Digit Zone Constant Definitions                                                                        */
+/*---------------------------------------------------------------------------------------------------------*/
+#define ZONE_MAIN_DIGIT         0   /*!< Main digit display zone index */
+#define ZONE_MAIN_DIG_CNT       7   /*!< Number of digits/texts, for number and alphabet display */
+#define ZONE_MAIN_SEG_NUM       14  /*!< Number of segments on each digit number */
+
+#define ZONE_PPM_DIGIT          1   /*!< PPM or percentage digit display zone index */
+#define ZONE_PPM_DIG_CNT        3   /*!< Number of digits, for ppm display */
+#define ZONE_PPM_SEG_NUM        7   /*!< Number of segments on each digit number */
+
+#define ZONE_TEMP_DIGIT         2   /*!< Temperature digit display zone index */
+#define ZONE_TEMP_DIG_CNT       3   /*!< Number of digits, for c/f display */
+#define ZONE_TEMP_SEG_NUM       7   /*!< Number of segments on each digit number */
+
+#define ZONE_VER_DIGIT          3   /*!< Version number digit display zone index */
+#define ZONE_VER_DIG_CNT        6   /*!< Number of digits, for version display */
+#define ZONE_VER_SEG_NUM        7   /*!< Number of segments on each digit number */
+
+#define ZONE_TIME_DIGIT         4   /*!< Time digit display zone index */
+#define ZONE_TIME_DIG_CNT       4   /*!< Number of digits */
+#define ZONE_TIME_SEG_NUM       7   /*!< Number of segments on each digit number */
+
+#define ZONE_NUMICRO_DIGIT      5   /*!< NuMicro digit display zone index */
+#define ZONE_NUMICRO_DIG_CNT    3   /*!< Number of digits */
+#define ZONE_NUMICRO_SEG_NUM    7   /*!< Number of segments on each digit number */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  COM and SEG Position of Symbol Constant Definitions                                                    */
+/*---------------------------------------------------------------------------------------------------------*/
+#define SYMBOL_NVT              ((10)<<4 | (4)<<0)  /*!< T1 display on COM 4, SEG 10 */
+#define SYMBOL_WIFI             ((10)<<4 | (5)<<0)  /*!< T2 display on COM 5, SEG 10 */
+#define SYMBOL_SOUND            ((10)<<4 | (6)<<0)  /*!< T3 display on COM 6, SEG 10 */
+#define SYMBOL_NUMICRO          ((9)<<4  | (3)<<0)  /*!< Y3 display on COM 3, SEG 9 */
+#define SYMBOL_BAT_FRAME        ((10)<<4 | (0)<<0)  /*!< T7 display on COM 0, SEG 10 */
+#define SYMBOL_BAT_1            ((10)<<4 | (2)<<0)  /*!< T4 display on COM 2, SEG 10 */
+#define SYMBOL_BAT_2            ((10)<<4 | (3)<<0)  /*!< T5 display on COM 3, SEG 10 */
+#define SYMBOL_BAT_3            ((10)<<4 | (1)<<0)  /*!< T6 display on COM 1, SEG 10 */
+#define SYMBOL_PLUS             ((3)<<4  | (1)<<0)  /*!< T12 display on COM 1, SEG 3 */
+#define SYMBOL_MINUS            ((3)<<4  | (3)<<0)  /*!< T13 display on COM 3, SEG 3 */
+#define SYMBOL_V                ((39)<<4 | (4)<<0)  /*!< T26 display on COM 4, SEG 39 */
+#define SYMBOL_A                ((37)<<4 | (4)<<0)  /*!< T27 display on COM 4, SEG 37 */
+#define SYMBOL_W                ((35)<<4 | (4)<<0)  /*!< T28 display on COM 4, SEG 35 */
+#define SYMBOL_ARROW_UP         ((1)<<4  | (4)<<0)  /*!< T29 display on COM 4, SEG 1 */
+#define SYMBOL_ARROW_LEFT       ((1)<<4  | (6)<<0)  /*!< T30 display on COM 6, SEG 1 */
+#define SYMBOL_ARROW_DOWN       ((0)<<4  | (7)<<0)  /*!< T31 display on COM 7, SEG 0 */
+#define SYMBOL_ARROW_RIGHT      ((0)<<4  | (4)<<0)  /*!< T32 display on COM 4, SEG 0 */
+#define SYMBOL_CIRCLE_UP        ((1)<<4  | (5)<<0)  /*!< T33 display on COM 5, SEG 1 */
+#define SYMBOL_CIRCLE_LEFT      ((0)<<4  | (6)<<0)  /*!< T34 display on COM 6, SEG 0 */
+#define SYMBOL_CIRCLE_RIGHT     ((0)<<4  | (5)<<0)  /*!< T35 display on COM 5, SEG 0 */
+#define SYMBOL_PERCENTAGE       ((23)<<4 | (4)<<0)  /*!< Y2 display on COM 4, SEG 23 */
+#define SYMBOL_PPM              ((21)<<4 | (4)<<0)  /*!< Y1 display on COM 4, SEG 21 */
+#define SYMBOL_TEMP_C           ((25)<<4 | (4)<<0)  /*!< T37 display on COM 4, SEG 25 */
+#define SYMBOL_TEMP_F           ((27)<<4 | (4)<<0)  /*!< T38 display on COM 4, SEG 27 */
+#define SYMBOL_VERSION          ((31)<<4 | (4)<<0)  /*!< T41 display on COM 4, SEG 31 */
+#define SYMBOL_S(x)             (((((x)-1)%5)+11)<<4 | (((x)-1)/5)<<0)  /*!< S[x] display on COM x, SEG x. [x] range is 1 ~ 40. */
+#define SYMBOL_MAIN_DIG_COL1    ((16)<<4 | (1)<<0)  /*!< T14 display on COM 1, SEG 16 */
+#define SYMBOL_MAIN_DIG_COL2    ((20)<<4 | (1)<<0)  /*!< T16 display on COM 1, SEG 20 */
+#define SYMBOL_MAIN_DIG_COL3    ((24)<<4 | (1)<<0)  /*!< T18 display on COM 1, SEG 24 */
+#define SYMBOL_MAIN_DIG_COL4    ((28)<<4 | (1)<<0)  /*!< T20 display on COM 1, SEG 28 */
+#define SYMBOL_MAIN_DIG_COL5    ((32)<<4 | (1)<<0)  /*!< T22 display on COM 1, SEG 32 */
+#define SYMBOL_MAIN_DIG_COL6    ((36)<<4 | (1)<<0)  /*!< T24 display on COM 1, SEG 36 */
+#define SYMBOL_MAIN_DIG_P1      ((16)<<4 | (3)<<0)  /*!< T15 display on COM 3, SEG 16 */
+#define SYMBOL_MAIN_DIG_P2      ((20)<<4 | (3)<<0)  /*!< T17 display on COM 3, SEG 20 */
+#define SYMBOL_MAIN_DIG_P3      ((24)<<4 | (3)<<0)  /*!< T19 display on COM 3, SEG 24 */
+#define SYMBOL_MAIN_DIG_P4      ((28)<<4 | (3)<<0)  /*!< T21 display on COM 3, SEG 28 */
+#define SYMBOL_MAIN_DIG_P5      ((32)<<4 | (3)<<0)  /*!< T23 display on COM 3, SEG 32 */
+#define SYMBOL_MAIN_DIG_P6      ((36)<<4 | (3)<<0)  /*!< T25 display on COM 3, SEG 36 */
+#define SYMBOL_VER_DIG_P1       ((29)<<4 | (4)<<0)  /*!< T39 display on COM 4, SEG 29 */
+#define SYMBOL_VER_DIG_P2       ((33)<<4 | (4)<<0)  /*!< T40 display on COM 4, SEG 33 */
+#define SYMBOL_TIME_DIG_COL1    ((5)<<4  | (7)<<0)  /*!< T9 display on COM 7, SEG 5 */
+#define SYMBOL_TIME_DIG_P1      ((3)<<4  | (7)<<0)  /*!< T8 display on COM 7, SEG 3 */
+#define SYMBOL_TIME_DIG_P2      ((5)<<4  | (3)<<0)  /*!< T10 display on COM 3, SEG 5 */
+#define SYMBOL_TIME_DIG_P3      ((7)<<4  | (3)<<0)  /*!< T11 display on COM 3, SEG 7 */
+
+/**@}*/ /* end of group M2354_LCDLIB_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup M2354_LCDLIB_EXPORTED_STRUCTS LCDLIB Exported Structs
+  @{
+*/
+typedef struct
+{
+    uint32_t u32DigitCnt;   /*!< Digit counts */
+    uint32_t u32MaxSegNum;  /*!< Maximum segment number */
+} LCD_ZONE_INFO_T;
+
+/**@}*/ /* end of group M2354_LCDLIB_EXPORTED_STRUCTS */
+
+
+/** @addtogroup M2354_LCDLIB_EXPORTED_FUNCTIONS LCD Exported Functions
+  @{
+*/
+
+void LCDLIB_Printf(uint32_t u32Zone, char *InputStr);
+void LCDLIB_PutChar(uint32_t u32Zone, uint32_t u32Index, uint8_t u8Ch);
+void LCDLIB_PrintNumber(uint32_t u32Zone, uint32_t InputNum);
+void LCDLIB_SetSymbol(uint32_t u32Symbol, uint32_t u32OnOff);
+
+/**@}*/ /* end of group M2354_LCDLIB_EXPORTED_FUNCTIONS */
+
+/**@}*/ /* end of group M2354_LCDLIB_Driver */
+
+/**@}*/ /* end of group LIBRARY */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __M2354_LCDLIB_H */
+
+/*** (C) COPYRIGHT 2019-2020 Nuvoton Technology Corp. ***/

+ 49 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/NuMicro.h

@@ -0,0 +1,49 @@
+/**************************************************************************//**
+ * @file     NuMicro.h
+ * @version  V1.00
+ * @brief    NuMicro peripheral access layer header file.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NUMICRO_H__
+#define __NUMICRO_H__
+
+#include "nuc980.h"
+#include "nu_adc.h"
+#include "nu_uart.h"
+#include "nu_spi.h"
+#include "nu_qspi.h"
+#include "nu_i2c.h"
+#include "nu_pdma.h"
+#include "nu_etimer.h"
+#include "nu_emac.h"
+#include "nu_sdh.h"
+#include "nu_gpio.h"
+#include "nu_rtc.h"
+#include "nu_wdt.h"
+#include "nu_ebi.h"
+#include "nu_scuart.h"
+#include "nu_pwm.h"
+#include "nu_crypto.h"
+#include "nu_can.h"
+#include "nu_i2s.h"
+#include "nu_usbd.h"
+
+#include "nu_sys.h"
+
+#ifndef __STATIC_INLINE
+    #define __STATIC_INLINE  static __inline
+#endif
+
+#ifndef __CLZ
+    #if defined(__CC_ARM)
+        #define __CLZ  __clz
+    #else
+        #define __CLZ  __builtin_clz
+    #endif
+#endif
+
+#endif  /* __NUMICRO_H__ */
+
+

+ 2063 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/emac_reg.h

@@ -0,0 +1,2063 @@
+/**************************************************************************//**
+ * @file     emac_reg.h
+ * @version  V1.00
+ * @brief    EMAC register definition header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __EMAC_REG_H__
+#define __EMAC_REG_H__
+
+#if defined ( __CC_ARM   )
+    #pragma anon_unions
+#endif
+
+/**
+   @addtogroup REGISTER Control Register
+   @{
+*/
+
+/**
+    @addtogroup EMAC Ethernet MAC Controller(EMAC)
+    Memory Mapped Structure for EMAC Controller
+@{ */
+
+typedef struct
+{
+
+    /**
+     * @var EMAC_T::CAMCTL
+     * Offset: 0x00  CAM Comparison Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |AUP       |Accept Unicast Packet
+     * |        |          |The AUP controls the unicast packet reception
+     * |        |          |If AUP is enabled, EMAC receives all incoming packet its destination MAC address is a unicast address.
+     * |        |          |0 = EMAC receives packet depends on the CAM comparison result.
+     * |        |          |1 = EMAC receives all unicast packets.
+     * |[1]     |AMP       |Accept Multicast Packet
+     * |        |          |The AMP controls the multicast packet reception
+     * |        |          |If AMP is enabled, EMAC receives all incoming packet its destination MAC address is a multicast address.
+     * |        |          |0 = EMAC receives packet depends on the CAM comparison result.
+     * |        |          |1 = EMAC receives all multicast packets.
+     * |[2]     |ABP       |Accept Broadcast Packet
+     * |        |          |The ABP controls the broadcast packet reception
+     * |        |          |If ABP is enabled, EMAC receives all incoming packet its destination MAC address is a broadcast address.
+     * |        |          |0 = EMAC receives packet depends on the CAM comparison result.
+     * |        |          |1 = EMAC receives all broadcast packets.
+     * |[3]     |COMPEN    |Complement CAM Comparison Enable Bit
+     * |        |          |The COMPEN controls the complement of the CAM comparison result
+     * |        |          |If the CMPEN and COMPEN are both enabled, the incoming packet with specific destination MAC address
+     * |        |          |configured in CAM entry will be dropped
+     * |        |          |And the incoming packet with destination MAC address does not configured in any CAM entry will be received.
+     * |        |          |0 = Complement CAM comparison result Disabled.
+     * |        |          |1 = Complement CAM comparison result Enabled.
+     * |[4]     |CMPEN     |CAM Compare Enable Bit
+     * |        |          |The CMPEN controls the enable of CAM comparison function for destination MAC address recognition
+     * |        |          |If software wants to receive a packet with specific destination MAC address, configures the MAC address
+     * |        |          |into CAM 12~0, then enables that CAM entry and set CMPEN to 1.
+     * |        |          |0 = CAM comparison function for destination MAC address recognition Disabled.
+     * |        |          |1 = CAM comparison function for destination MAC address recognition Enabled.
+     * @var EMAC_T::CAMEN
+     * Offset: 0x04  CAM Enable Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |CAMxEN    |CAM Entry X Enable Bit
+     * |        |          |The CAMxEN controls the validation of CAM entry x.
+     * |        |          |The CAM entry 13, 14 and 15 are for PAUSE control frame transmission
+     * |        |          |If software wants to transmit a PAUSE control frame out to network, the enable bits of these three CAM
+     * |        |          |entries all must be enabled first.
+     * |        |          |0 = CAM entry x Disabled.
+     * |        |          |1 = CAM entry x Enabled.
+     * @var EMAC_T::CAM0M
+     * Offset: 0x08  CAM0 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM0L
+     * Offset: 0x0C  CAM0 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM1M
+     * Offset: 0x10  CAM1 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM1L
+     * Offset: 0x14  CAM1 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM2M
+     * Offset: 0x18  CAM2 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM2L
+     * Offset: 0x1C  CAM2 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM3M
+     * Offset: 0x20  CAM3 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM3L
+     * Offset: 0x24  CAM3 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM4M
+     * Offset: 0x28  CAM4 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM4L
+     * Offset: 0x2C  CAM4 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM5M
+     * Offset: 0x30  CAM5 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM5L
+     * Offset: 0x34  CAM5 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM6M
+     * Offset: 0x38  CAM6 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM6L
+     * Offset: 0x3C  CAM6 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM7M
+     * Offset: 0x40  CAM7 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM7L
+     * Offset: 0x44  CAM7 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM8M
+     * Offset: 0x48  CAM8 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM8L
+     * Offset: 0x4C  CAM8 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM9M
+     * Offset: 0x50  CAM9 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM9L
+     * Offset: 0x54  CAM9 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM10M
+     * Offset: 0x58  CAM10 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM10L
+     * Offset: 0x5C  CAM10 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM11M
+     * Offset: 0x60  CAM11 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM11L
+     * Offset: 0x64  CAM11 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM12M
+     * Offset: 0x68  CAM12 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM12L
+     * Offset: 0x6C  CAM12 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM13M
+     * Offset: 0x70  CAM13 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM13L
+     * Offset: 0x74  CAM13 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM14M
+     * Offset: 0x78  CAM14 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |MACADDR2  |MAC Address Byte 2
+     * |[15:8]  |MACADDR3  |MAC Address Byte 3
+     * |[23:16] |MACADDR4  |MAC Address Byte 4
+     * |[31:24] |MACADDR5  |MAC Address Byte 5
+     * |        |          |The CAMxM keeps the bit 47~16 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM14L
+     * Offset: 0x7C  CAM14 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:16] |MACADDR0  |MAC Address Byte 0
+     * |[31:24] |MACADDR1  |MAC Address Byte 1
+     * |        |          |The CAMxL keeps the bit 15~0 of MAC address
+     * |        |          |The x can be the 0~14
+     * |        |          |The register pair {EMAC_CAMxM, EMAC_CAMxL} represents a CAM entry and keeps a MAC address.
+     * |        |          |For example, if the MAC address 00-50-BA-33-BA-44 kept in CAM entry 1, the register EMAC_CAM1M is
+     * |        |          |0x0050_BA33 and EMAC_CAM1L is 0xBA44_0000.
+     * @var EMAC_T::CAM15MSB
+     * Offset: 0x80  CAM15 Most Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |OPCODE    |OP Code Field of PAUSE Control Frame
+     * |        |          |In the PAUSE control frame, an op code field defined and is 0x0001.
+     * |[31:16] |LENGTH    |LENGTH Field of PAUSE Control Frame
+     * |        |          |In the PAUSE control frame, a LENGTH field defined and is 0x8808.
+     * @var EMAC_T::CAM15LSB
+     * Offset: 0x84  CAM15 Least Significant Word Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:24] |OPERAND   |Pause Parameter
+     * |        |          |In the PAUSE control frame, an OPERAND field defined and controls how much time the destination
+     * |        |          |Ethernet MAC Controller paused
+     * |        |          |The unit of the OPERAND is a slot time, the 512-bit time.
+     * @var EMAC_T::TXDSA
+     * Offset: 0x88  Transmit Descriptor Link List Start Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |TXDSA     |Transmit Descriptor Link-list Start Address
+     * |        |          |The TXDSA keeps the start address of transmit descriptor link-list
+     * |        |          |If the software enables the bit TXON (EMAC_CTL[8]), the content of TXDSA will be loaded into the
+     * |        |          |current transmit descriptor start address register (EMAC_CTXDSA)
+     * |        |          |The TXDSA does not be updated by EMAC
+     * |        |          |During the operation, EMAC will ignore the bits [1:0] of TXDSA
+     * |        |          |This means that TX descriptors must locate at word boundary memory address.
+     * @var EMAC_T::RXDSA
+     * Offset: 0x8C  Receive Descriptor Link List Start Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |RXDSA     |Receive Descriptor Link-list Start Address
+     * |        |          |The RXDSA keeps the start address of receive descriptor link-list
+     * |        |          |If the S/W enables the bit RXON (EMAC_CTL[0]), the content of RXDSA will be loaded into the current
+     * |        |          |receive descriptor start address register (EMAC_CRXDSA)
+     * |        |          |The RXDSA does not be updated by EMAC
+     * |        |          |During the operation, EMAC will ignore the bits [1:0] of RXDSA
+     * |        |          |This means that RX descriptors must locate at word boundary memory address.
+     * @var EMAC_T::CTL
+     * Offset: 0x90  MAC Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |RXON      |Frame Reception ON
+     * |        |          |The RXON controls the normal packet reception of EMAC
+     * |        |          |If the RXON is set to high, the EMAC starts the packet reception process, including the RX
+     * |        |          |descriptor fetching, packet reception and RX descriptor modification.
+     * |        |          |It is necessary to finish EMAC initial sequence before enable RXON
+     * |        |          |Otherwise, the EMAC operation is undefined.
+     * |        |          |If the RXON is disabled during EMAC is receiving an incoming packet, the EMAC stops the packet
+     * |        |          |reception process after the current packet reception finished.
+     * |        |          |0 = Packet reception process stopped.
+     * |        |          |1 = Packet reception process started.
+     * |[1]     |ALP       |Accept Long Packet
+     * |        |          |The ALP controls the long packet, which packet length is greater than 1518 bytes, reception
+     * |        |          |If the ALP is set to high, the EMAC will accept the long packet.
+     * |        |          |Otherwise, the long packet will be dropped.
+     * |        |          |0 = Ethernet MAC controller dropped the long packet.
+     * |        |          |1 = Ethernet MAC controller received the long packet.
+     * |[2]     |ARP       |Accept Runt Packet
+     * |        |          |The ARP controls the runt packet, which length is less than 64 bytes, reception
+     * |        |          |If the ARP is set to high, the EMAC will accept the runt packet.
+     * |        |          |Otherwise, the runt packet will be dropped.
+     * |        |          |0 = Ethernet MAC controller dropped the runt packet.
+     * |        |          |1 = Ethernet MAC controller received the runt packet.
+     * |[3]     |ACP       |Accept Control Packet
+     * |        |          |The ACP controls the control frame reception
+     * |        |          |If the ACP is set to high, the EMAC will accept the control frame
+     * |        |          |Otherwise, the control frame will be dropped
+     * |        |          |It is recommended that S/W only enable ACP while EMAC is operating on full duplex mode.
+     * |        |          |0 = Ethernet MAC controller dropped the control frame.
+     * |        |          |1 = Ethernet MAC controller received the control frame.
+     * |[4]     |AEP       |Accept CRC Error Packet
+     * |        |          |The AEP controls the EMAC accepts or drops the CRC error packet
+     * |        |          |If the AEP is set to high, the incoming packet with CRC error will be received by EMAC as a good packet.
+     * |        |          |0 = Ethernet MAC controller dropped the CRC error packet.
+     * |        |          |1 = Ethernet MAC controller received the CRC error packet.
+     * |[5]     |STRIPCRC  |Strip CRC Checksum
+     * |        |          |The STRIPCRC controls if the length of incoming packet is calculated with 4 bytes CRC checksum
+     * |        |          |If the STRIPCRC is set to high, 4 bytes CRC checksum is excluded from length calculation of incoming packet.
+     * |        |          |0 = The 4 bytes CRC checksum is included in packet length calculation.
+     * |        |          |1 = The 4 bytes CRC checksum is excluded in packet length calculation.
+     * |[6]     |WOLEN     |Wake on LAN Enable Bit
+     * |        |          |The WOLEN high enables the functionality that Ethernet MAC controller checked if the incoming packet
+     * |        |          |is Magic Packet and wakeup system from Power-down mode.
+     * |        |          |If incoming packet was a Magic Packet and the system was in Power-down, the Ethernet MAC controller
+     * |        |          |would generate a wakeup event to wake system up from Power-down mode.
+     * |        |          |0 = Wake-up by Magic Packet function Disabled.
+     * |        |          |1 = Wake-up by Magic Packet function Enabled.
+     * |[8]     |TXON      |Frame Transmission ON
+     * |        |          |The TXON controls the normal packet transmission of EMAC
+     * |        |          |If the TXON is set to high, the EMAC starts the packet transmission process, including the TX
+     * |        |          |descriptor fetching, packet transmission and TX descriptor modification.
+     * |        |          |It is must to finish EMAC initial sequence before enable TXON
+     * |        |          |Otherwise, the EMAC operation is undefined.
+     * |        |          |If the TXON is disabled during EMAC is transmitting a packet out, the EMAC stops the packet
+     * |        |          |transmission process after the current packet transmission finished.
+     * |        |          |0 = Packet transmission process stopped.
+     * |        |          |1 = Packet transmission process started.
+     * |[9]     |NODEF     |No Deferral
+     * |        |          |The NODEF controls the enable of deferral exceed counter
+     * |        |          |If NODEF is set to high, the deferral exceed counter is disabled
+     * |        |          |The NODEF is only useful while EMAC is operating on half duplex mode.
+     * |        |          |0 = The deferral exceed counter Enabled.
+     * |        |          |1 = The deferral exceed counter Disabled.
+     * |[16]    |SDPZ      |Send PAUSE Frame
+     * |        |          |The SDPZ controls the PAUSE control frame transmission.
+     * |        |          |If S/W wants to send a PAUSE control frame out, the CAM entry 13, 14 and 15 must be configured
+     * |        |          |first and the corresponding CAM enable bit of CAMEN register also must be set.
+     * |        |          |Then, set SDPZ to 1 enables the PAUSE control frame transmission.
+     * |        |          |The SDPZ is a self-clear bit
+     * |        |          |This means after the PAUSE control frame transmission has completed, the SDPZ will be cleared automatically.
+     * |        |          |It is recommended that only enabling SNDPAUSE while EMAC is operating in Full Duplex mode.
+     * |        |          |0 = PAUSE control frame transmission completed.
+     * |        |          |1 = PAUSE control frame transmission Enabled.
+     * |[17]    |SQECHKEN  |SQE Checking Enable Bit
+     * |        |          |The SQECHKEN controls the enable of SQE checking
+     * |        |          |The SQE checking is only available while EMAC is operating on 10M bps and half duplex mode
+     * |        |          |In other words, the SQECHKEN cannot affect EMAC operation, if the EMAC is operating on 100Mbps
+     * |        |          |or full duplex mode.
+     * |        |          |0 = SQE checking Disabled while EMAC is operating in 10Mbps and Half Duplex mode.
+     * |        |          |1 = SQE checking Enabled while EMAC is operating in 10Mbps and Half Duplex mode.
+     * |[18]    |FUDUP     |Full Duplex Mode Selection
+     * |        |          |The FUDUP controls that if EMAC is operating on full or half duplex mode.
+     * |        |          |0 = EMAC operates in half duplex mode.
+     * |        |          |1 = EMAC operates in full duplex mode.
+     * |[19]    |RMIIRXCTL |RMII RX Control
+     * |        |          |The RMIIRXCTL control the receive data sample in RMII mode
+     * |        |          |It's necessary to set this bit high when RMIIEN (EMAC_CTL[ [22]) is high.
+     * |        |          |0 = RMII RX control disabled.
+     * |        |          |1 = RMII RX control enabled.
+     * |[20]    |OPMODE    |Operation Mode Selection
+     * |        |          |The OPMODE defines that if the EMAC is operating on 10M or 100M bps mode
+     * |        |          |The RST (EMAC_CTL[24]) would not affect OPMODE value.
+     * |        |          |0 = EMAC operates in 10Mbps mode.
+     * |        |          |1 = EMAC operates in 100Mbps mode.
+     * |[22]    |RMIIEN    |RMII Mode Enable Bit
+     * |        |          |This bit controls if Ethernet MAC controller connected with off-chip Ethernet PHY by MII
+     * |        |          |interface or RMII interface
+     * |        |          |The RST (EMAC_CTL[24]) would not affect RMIIEN value.
+     * |        |          |0 = Ethernet MAC controller RMII mode Disabled.
+     * |        |          |1 = Ethernet MAC controller RMII mode Enabled.
+     * |        |          |NOTE: This field must keep 1.
+     * |[24]    |RST       |Software Reset
+     * |        |          |The RST implements a reset function to make the EMAC return default state
+     * |        |          |The RST is a self-clear bit
+     * |        |          |This means after the software reset finished, the RST will be cleared automatically
+     * |        |          |Enable RST can also reset all control and status registers, exclusive of the control bits
+     * |        |          |RMIIEN (EMAC_CTL[22]), and OPMODE (EMAC_CTL[20]).
+     * |        |          |The EMAC re-initial is necessary after the software reset completed.
+     * |        |          |0 = Software reset completed.
+     * |        |          |1 = Software reset Enabled.
+     * @var EMAC_T::MIIMDAT
+     * Offset: 0x94  MII Management Data Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |DATA      |MII Management Data
+     * |        |          |The DATA is the 16 bits data that will be written into the registers of external PHY for MII
+     * |        |          |Management write command or the data from the registers of external PHY for MII Management read command.
+     * @var EMAC_T::MIIMCTL
+     * Offset: 0x98  MII Management Control and Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[4:0]   |PHYREG    |PHY Register Address
+     * |        |          |The PHYREG keeps the address to indicate which register of external PHY is the target of the
+     * |        |          |MII management command.
+     * |[12:8]  |PHYADDR   |PHY Address
+     * |        |          |The PHYADDR keeps the address to differentiate which external PHY is the target of the MII management command.
+     * |[16]    |WRITE     |Write Command
+     * |        |          |The Write defines the MII management command is a read or write.
+     * |        |          |0 = MII management command is a read command.
+     * |        |          |1 = MII management command is a write command.
+     * |[17]    |BUSY      |Busy Bit
+     * |        |          |The BUSY controls the enable of the MII management frame generation
+     * |        |          |If S/W wants to access registers of external PHY, it set BUSY to high and EMAC generates
+     * |        |          |the MII management frame to external PHY through MII Management I/F
+     * |        |          |The BUSY is a self-clear bit
+     * |        |          |This means the BUSY will be cleared automatically after the MII management command finished.
+     * |        |          |0 = MII management command generation finished.
+     * |        |          |1 = MII management command generation Enabled.
+     * |[18]    |PREAMSP   |Preamble Suppress
+     * |        |          |The PREAMSP controls the preamble field generation of MII management frame
+     * |        |          |If the PREAMSP is set to high, the preamble field generation of MII management frame is skipped.
+     * |        |          |0 = Preamble field generation of MII management frame not skipped.
+     * |        |          |1 = Preamble field generation of MII management frame skipped.
+     * |[19]    |MDCON     |MDC Clock ON
+     * |        |          |The MDC controls the MDC clock generation. If the MDCON is set to high, the MDC clock is turned on.
+     * |        |          |0 = MDC clock off.
+     * |        |          |1 = MDC clock on.
+     * @var EMAC_T::FIFOCTL
+     * Offset: 0x9C  FIFO Threshold Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[1:0]   |RXFIFOTH  |RXFIFO Low Threshold
+     * |        |          |The RXFIFOTH controls when RXDMA requests internal arbiter for data transfer between RXFIFO
+     * |        |          |and system memory
+     * |        |          |The RXFIFOTH defines not only the high threshold of RXFIFO, but also the low threshold
+     * |        |          |The low threshold is the half of high threshold always
+     * |        |          |During the packet reception, if the RXFIFO reaches the high threshold, the RXDMA starts to
+     * |        |          |transfer frame data from RXFIFO to system memory
+     * |        |          |If the frame data in RXFIFO is less than low threshold, RXDMA stops to transfer the frame
+     * |        |          |data to system memory.
+     * |        |          |00 = Depend on the burst length setting
+     * |        |          |If the burst length is 8 words, high threshold is 8 words, too.
+     * |        |          |01 = RXFIFO high threshold is 64B and low threshold is 32B.
+     * |        |          |10 = RXFIFO high threshold is 128B and low threshold is 64B.
+     * |        |          |11 = RXFIFO high threshold is 192B and low threshold is 96B.
+     * |[9:8]   |TXFIFOTH  |TXFIFO Low Threshold
+     * |        |          |The TXFIFOTH controls when TXDMA requests internal arbiter for data transfer between system
+     * |        |          |memory and TXFIFO
+     * |        |          |The TXFIFOTH defines not only the low threshold of TXFIFO, but also the high threshold
+     * |        |          |The high threshold is the twice of low threshold always
+     * |        |          |During the packet transmission, if the TXFIFO reaches the high threshold, the TXDMA stops
+     * |        |          |generate request to transfer frame data from system memory to TXFIFO
+     * |        |          |If the frame data in TXFIFO is less than low threshold, TXDMA starts to transfer frame data
+     * |        |          |from system memory to TXFIFO.
+     * |        |          |The TXFIFOTH also defines when the TXMAC starts to transmit frame out to network
+     * |        |          |The TXMAC starts to transmit the frame out while the TXFIFO first time reaches the high threshold
+     * |        |          |during the transmission of the frame
+     * |        |          |If the frame data length is less than TXFIFO high threshold, the TXMAC starts to transmit the frame
+     * |        |          |out after the frame data are all inside the TXFIFO.
+     * |        |          |00 = Undefined.
+     * |        |          |01 = TXFIFO low threshold is 64B and high threshold is 128B.
+     * |        |          |10 = TXFIFO low threshold is 80B and high threshold is 160B.
+     * |        |          |11 = TXFIFO low threshold is 96B and high threshold is 192B.
+     * |[21:20] |BURSTLEN  |DMA Burst Length
+     * |        |          |This defines the burst length of AHB bus cycle while EMAC accesses system memory.
+     * |        |          |00 = 4 words.
+     * |        |          |01 = 8 words.
+     * |        |          |10 = 16 words.
+     * |        |          |11 = 16 words.
+     * @var EMAC_T::TXST
+     * Offset: 0xA0  Transmit Start Demand Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |TXST      |Transmit Start Demand
+     * |        |          |If the TX descriptor is not available for use of TXDMA after the TXON (EMAC_CTL[8]) is enabled,
+     * |        |          |the FSM (Finite State Machine) of TXDMA enters the Halt state and the frame transmission is halted
+     * |        |          |After the S/W has prepared the new TX descriptor for frame transmission, it must issue a write
+     * |        |          |command to EMAC_TXST register to make TXDMA to leave Halt state and continue the frame transmission.
+     * |        |          |The EMAC_TXST is a write only register and read from this register is undefined.
+     * |        |          |The write to EMAC_TXST register takes effect only when TXDMA stayed at Halt state.
+     * @var EMAC_T::RXST
+     * Offset: 0xA4  Receive Start Demand Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |RXST      |Receive Start Demand
+     * |        |          |If the RX descriptor is not available for use of RXDMA after the RXON (EMAC_CTL[0]) is enabled,
+     * |        |          |the FSM (Finite State Machine) of RXDMA enters the Halt state and the frame reception is halted
+     * |        |          |After the S/W has prepared the new RX descriptor for frame reception, it must issue a write
+     * |        |          |command to EMAC_RXST register to make RXDMA to leave Halt state and continue the frame reception.
+     * |        |          |The EMAC_RXST is a write only register and read from this register is undefined.
+     * |        |          |The write to EMAC_RXST register take effect only when RXDMA stayed at Halt state.
+     * @var EMAC_T::MRFL
+     * Offset: 0xA8  Maximum Receive Frame Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |MRFL      |Maximum Receive Frame Length
+     * |        |          |The MRFL defines the maximum frame length for received frame
+     * |        |          |If the frame length of received frame is greater than MRFL, and bit MFLEIEN (EMAC_INTEN[8])
+     * |        |          |is also enabled, the bit MFLEIF (EMAC_INTSTS[8]) is set and the RX interrupt is triggered.
+     * |        |          |It is recommended that only use MRFL to qualify the length of received frame while S/W wants to
+     * |        |          |receive a frame which length is greater than 1518 bytes.
+     * @var EMAC_T::INTEN
+     * Offset: 0xAC  MAC Interrupt Enable Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |RXIEN     |Receive Interrupt Enable Bit
+     * |        |          |The RXIEN controls the RX interrupt generation.
+     * |        |          |If RXIEN is enabled and RXIF (EMAC_INTSTS[0]) is high, EMAC generates the RX interrupt to CPU
+     * |        |          |If RXIEN is disabled, no RX interrupt is generated to CPU even any status bit EMAC_INTSTS[15:1]
+     * |        |          |is set and the corresponding bit of EMAC_INTEN is enabled
+     * |        |          |In other words, if S/W wants to receive RX interrupt from EMAC, this bit must be enabled
+     * |        |          |And, if S/W doesn't want to receive any RX interrupt from EMAC, disables this bit.
+     * |        |          |0 = RXIF (EMAC_INTSTS[0]) is masked and RX interrupt generation Disabled.
+     * |        |          |1 = RXIF (EMAC_INTSTS[0]) is not masked and RX interrupt generation Enabled.
+     * |[1]     |CRCEIEN   |CRC Error Interrupt Enable Bit
+     * |        |          |The CRCEIEN controls the CRCEIF (EMAC_INTSTS[1]) interrupt generation
+     * |        |          |If CRCEIF (EMAC_INTSTS[1]) is set, and both CRCEIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If CRCEIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |CRCEIF (EMAC_INTSTS[1]) is set.
+     * |        |          |0 = CRCEIF (EMAC_INTSTS[1]) trigger RX interrupt Disabled.
+     * |        |          |1 = CRCEIF (EMAC_INTSTS[1]) trigger RX interrupt Enabled.
+     * |[2]     |RXOVIEN   |Receive FIFO Overflow Interrupt Enable Bit
+     * |        |          |The RXOVIEN controls the RXOVIF (EMAC_INTSTS[2]) interrupt generation
+     * |        |          |If RXOVIF (EMAC_INTSTS[2]) is set, and both RXOVIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If RXOVIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |RXOVIF (EMAC_INTSTS[2]) is set.
+     * |        |          |0 = RXOVIF (EMAC_INTSTS[2]) trigger RX interrupt Disabled.
+     * |        |          |1 = RXOVIF (EMAC_INTSTS[2]) trigger RX interrupt Enabled.
+     * |[3]     |LPIEN     |Long Packet Interrupt Enable Bit
+     * |        |          |The LPIEN controls the LPIF (EMAC_INTSTS[3]) interrupt generation
+     * |        |          |If LPIF (EMAC_INTSTS[3]) is set, and both LPIEN and RXIEN (EMAC_INTEN[0]) are enabled, the EMAC
+     * |        |          |generates the RX interrupt to CPU
+     * |        |          |If LPIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the LPIF
+     * |        |          |(EMAC_INTSTS[3]) is set.
+     * |        |          |0 = LPIF (EMAC_INTSTS[3]) trigger RX interrupt Disabled.
+     * |        |          |1 = LPIF (EMAC_INTSTS[3]) trigger RX interrupt Enabled.
+     * |[4]     |RXGDIEN   |Receive Good Interrupt Enable Bit
+     * |        |          |The RXGDIEN controls the RXGDIF (EMAC_INTSTS[4]) interrupt generation
+     * |        |          |If RXGDIF (EMAC_INTSTS[4]) is set, and both RXGDIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If RXGDIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |RXGDIF (EMAC_INTSTS[4]) is set.
+     * |        |          |0 = RXGDIF (EMAC_INTSTS[4]) trigger RX interrupt Disabled.
+     * |        |          |1 = RXGDIF (EMAC_INTSTS[4]) trigger RX interrupt Enabled.
+     * |[5]     |ALIEIEN   |Alignment Error Interrupt Enable Bit
+     * |        |          |The ALIEIEN controls the ALIEIF (EMAC_INTSTS[5]) interrupt generation
+     * |        |          |If ALIEIF (EMAC_INTSTS[5]) is set, and both ALIEIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If ALIEIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |ALIEIF (EMAC_INTSTS[5]) is set.
+     * |        |          |0 = ALIEIF (EMAC_INTSTS[5]) trigger RX interrupt Disabled.
+     * |        |          |1 = ALIEIF (EMAC_INTSTS[5]) trigger RX interrupt Enabled.
+     * |[6]     |RPIEN     |Runt Packet Interrupt Enable Bit
+     * |        |          |The RPIEN controls the RPIF (EMAC_INTSTS[6]) interrupt generation
+     * |        |          |If RPIF (EMAC_INTSTS[6]) is set, and both RPIEN and RXIEN (EMAC_INTEN[0]) are enabled, the EMAC
+     * |        |          |generates the RX interrupt to CPU
+     * |        |          |If RPIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |RPIF (EMAC_INTSTS[6]) is set.
+     * |        |          |0 = RPIF (EMAC_INTSTS[6]) trigger RX interrupt Disabled.
+     * |        |          |1 = RPIF (EMAC_INTSTS[6]) trigger RX interrupt Enabled.
+     * |[7]     |MPCOVIEN  |Miss Packet Counter Overrun Interrupt Enable Bit
+     * |        |          |The MPCOVIEN controls the MPCOVIF (EMAC_INTSTS[7]) interrupt generation
+     * |        |          |If MPCOVIF (EMAC_INTSTS[7]) is set, and both MPCOVIEN and RXIEN (EMAC_INTEN[0]) are enabled,
+     * |        |          |the EMAC generates the RX interrupt to CPU
+     * |        |          |If MPCOVIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |MPCOVIF (EMAC_INTSTS[7]) is set.
+     * |        |          |0 = MPCOVIF (EMAC_INTSTS[7]) trigger RX interrupt Disabled.
+     * |        |          |1 = MPCOVIF (EMAC_INTSTS[7]) trigger RX interrupt Enabled.
+     * |[8]     |MFLEIEN   |Maximum Frame Length Exceed Interrupt Enable Bit
+     * |        |          |The MFLEIEN controls the MFLEIF (EMAC_INTSTS[8]) interrupt generation
+     * |        |          |If MFLEIF (EMAC_INTSTS[8]) is set, and both MFLEIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If MFLEIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |MFLEIF (EMAC_INTSTS[8]) is set.
+     * |        |          |0 = MFLEIF (EMAC_INTSTS[8]) trigger RX interrupt Disabled.
+     * |        |          |1 = MFLEIF (EMAC_INTSTS[8]) trigger RX interrupt Enabled.
+     * |[9]     |DENIEN    |DMA Early Notification Interrupt Enable Bit
+     * |        |          |The DENIEN controls the DENIF (EMAC_INTSTS[9]) interrupt generation
+     * |        |          |If DENIF (EMAC_INTSTS[9]) is set, and both DENIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If DENIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |DENIF (EMAC_INTSTS[9]) is set.
+     * |        |          |0 = TDENIF (EMAC_INTSTS[9]) trigger RX interrupt Disabled.
+     * |        |          |1 = TDENIF (EMAC_INTSTS[9]) trigger RX interrupt Enabled.
+     * |[10]    |RDUIEN    |Receive Descriptor Unavailable Interrupt Enable Bit
+     * |        |          |The RDUIEN controls the RDUIF (EMAC_INTSTS[10]) interrupt generation
+     * |        |          |If RDUIF (EMAC_INTSTS[10]) is set, and both RDUIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If RDUIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |RDUIF (EMAC_MIOSTA[10]) register is set.
+     * |        |          |0 = RDUIF (EMAC_INTSTS[10]) trigger RX interrupt Disabled.
+     * |        |          |1 = RDUIF (EMAC_INTSTS[10]) trigger RX interrupt Enabled.
+     * |[11]    |RXBEIEN   |Receive Bus Error Interrupt Enable Bit
+     * |        |          |The RXBEIEN controls the RXBEIF (EMAC_INTSTS[11]) interrupt generation
+     * |        |          |If RXBEIF (EMAC_INTSTS[11]) is set, and both RXBEIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If RXBEIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |RXBEIF (EMAC_INTSTS[11]) is set.
+     * |        |          |0 = RXBEIF (EMAC_INTSTS[11]) trigger RX interrupt Disabled.
+     * |        |          |1 = RXBEIF (EMAC_INTSTS[11]) trigger RX interrupt Enabled.
+     * |[14]    |CFRIEN    |Control Frame Receive Interrupt Enable Bit
+     * |        |          |The CFRIEN controls the CFRIF (EMAC_INTSTS[14]) interrupt generation
+     * |        |          |If CFRIF (EMAC_INTSTS[14]) is set, and both CFRIEN and RXIEN (EMAC_INTEN[0]) are enabled, the
+     * |        |          |EMAC generates the RX interrupt to CPU
+     * |        |          |If CFRIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |CFRIF (EMAC_INTSTS[14]) register is set.
+     * |        |          |0 = CFRIF (EMAC_INTSTS[14]) trigger RX interrupt Disabled.
+     * |        |          |1 = CFRIF (EMAC_INTSTS[14]) trigger RX interrupt Enabled.
+     * |[15]    |WOLIEN    |Wake on LAN Interrupt Enable Bit
+     * |        |          |The WOLIEN controls the WOLIF (EMAC_INTSTS[15]) interrupt generation
+     * |        |          |If WOLIF (EMAC_INTSTS[15]) is set, and both WOLIEN and RXIEN (EMAC_INTEN[0]) are enabled,
+     * |        |          |the EMAC generates the RX interrupt to CPU
+     * |        |          |If WOLIEN or RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated to CPU even the
+     * |        |          |WOLIF (EMAC_INTSTS[15]) is set.
+     * |        |          |0 = WOLIF (EMAC_INTSTS[15]) trigger RX interrupt Disabled.
+     * |        |          |1 = WOLIF (EMAC_INTSTS[15]) trigger RX interrupt Enabled.
+     * |[16]    |TXIEN     |Transmit Interrupt Enable Bit
+     * |        |          |The TXIEN controls the TX interrupt generation.
+     * |        |          |If TXIEN is enabled and TXIF (EMAC_INTSTS[16]) is high, EMAC generates the TX interrupt to CPU
+     * |        |          |If TXIEN is disabled, no TX interrupt is generated to CPU even any status bit of
+     * |        |          |EMAC_INTSTS[24:17] set and the corresponding bit of EMAC_INTEN is enabled
+     * |        |          |In other words, if S/W wants to receive TX interrupt from EMAC, this bit must be enabled
+     * |        |          |And, if S/W doesn't want to receive any TX interrupt from EMAC, disables this bit.
+     * |        |          |0 = TXIF (EMAC_INTSTS[16]) is masked and TX interrupt generation Disabled.
+     * |        |          |1 = TXIF (EMAC_INTSTS[16]) is not masked and TX interrupt generation Enabled.
+     * |[17]    |TXUDIEN   |Transmit FIFO Underflow Interrupt Enable Bit
+     * |        |          |The TXUDIEN controls the TXUDIF (EMAC_INTSTS[17]) interrupt generation
+     * |        |          |If TXUDIF (EMAC_INTSTS[17]) is set, and both TXUDIEN and TXIEN (EMAC_INTEN[16]) are enabled,
+     * |        |          |the EMAC generates the TX interrupt to CPU
+     * |        |          |If TXUDIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even
+     * |        |          |the TXUDIF (EMAC_INTSTS[17]) is set.
+     * |        |          |0 = TXUDIF (EMAC_INTSTS[17]) TX interrupt Disabled.
+     * |        |          |1 = TXUDIF (EMAC_INTSTS[17]) TX interrupt Enabled.
+     * |[18]    |TXCPIEN   |Transmit Completion Interrupt Enable Bit
+     * |        |          |The TXCPIEN controls the TXCPIF (EMAC_INTSTS[18]) interrupt generation
+     * |        |          |If TXCPIF (EMAC_INTSTS[18]) is set, and both TXCPIEN and TXIEN (EMAC_INTEN[16]) are enabled,
+     * |        |          |the EMAC generates the TX interrupt to CPU
+     * |        |          |If TXCPIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even the
+     * |        |          |TXCPIF (EMAC_INTSTS[18]) is set.
+     * |        |          |0 = TXCPIF (EMAC_INTSTS[18]) trigger TX interrupt Disabled.
+     * |        |          |1 = TXCPIF (EMAC_INTSTS[18]) trigger TX interrupt Enabled.
+     * |[19]    |EXDEFIEN  |Defer Exceed Interrupt Enable Bit
+     * |        |          |The EXDEFIEN controls the EXDEFIF (EMAC_INTSTS[19]) interrupt generation
+     * |        |          |If EXDEFIF (EMAC_INTSTS[19]) is set, and both EXDEFIEN and TXIEN (EMAC_INTEN[16]) are enabled,
+     * |        |          |the EMAC generates the TX interrupt to CPU
+     * |        |          |If EXDEFIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even the
+     * |        |          |EXDEFIF (EMAC_INTSTS[19]) is set.
+     * |        |          |0 = EXDEFIF (EMAC_INTSTS[19]) trigger TX interrupt Disabled.
+     * |        |          |1 = EXDEFIF (EMAC_INTSTS[19]) trigger TX interrupt Enabled.
+     * |[20]    |NCSIEN    |No Carrier Sense Interrupt Enable Bit
+     * |        |          |The NCSIEN controls the NCSIF (EMAC_INTSTS[20]) interrupt generation
+     * |        |          |If NCSIF (EMAC_INTSTS[20]) is set, and both NCSIEN and TXIEN (EMAC_INTEN[16]) are enabled, the
+     * |        |          |EMAC generates the TX interrupt to CPU
+     * |        |          |If NCSIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even the
+     * |        |          |NCSIF (EMAC_INTSTS[20]) is set.
+     * |        |          |0 = NCSIF (EMAC_INTSTS[20]) trigger TX interrupt Disabled.
+     * |        |          |1 = NCSIF (EMAC_INTSTS[20]) trigger TX interrupt Enabled.
+     * |[21]    |TXABTIEN  |Transmit Abort Interrupt Enable Bit
+     * |        |          |The TXABTIEN controls the TXABTIF (EMAC_INTSTS[21]) interrupt generation
+     * |        |          |If TXABTIF (EMAC_INTSTS[21]) is set, and both TXABTIEN and TXIEN (EMAC_INTEN[16]) are enabled,
+     * |        |          |the EMAC generates the TX interrupt to CPU
+     * |        |          |If TXABTIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even the
+     * |        |          |TXABTIF (EMAC_INTSTS[21]) is set.
+     * |        |          |0 = TXABTIF (EMAC_INTSTS[21]) trigger TX interrupt Disabled.
+     * |        |          |1 = TXABTIF (EMAC_INTSTS[21]) trigger TX interrupt Enabled.
+     * |[22]    |LCIEN     |Late Collision Interrupt Enable Bit
+     * |        |          |The LCIEN controls the LCIF (EMAC_INTSTS[22]) interrupt generation
+     * |        |          |If LCIF (EMAC_INTSTS[22]) is set, and both LCIEN and TXIEN (EMAC_INTEN[16]) are enabled, the
+     * |        |          |EMAC generates the TX interrupt to CPU
+     * |        |          |If LCIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even the
+     * |        |          |LCIF (EMAC_INTSTS[22]) is set.
+     * |        |          |0 = LCIF (EMAC_INTSTS[22]) trigger TX interrupt Disabled.
+     * |        |          |1 = LCIF (EMAC_INTSTS[22]) trigger TX interrupt Enabled.
+     * |[23]    |TDUIEN    |Transmit Descriptor Unavailable Interrupt Enable Bit
+     * |        |          |The TDUIEN controls the TDUIF (EMAC_INTSTS[23]) interrupt generation
+     * |        |          |If TDUIF (EMAC_INTSTS[23]) is set, and both TDUIEN and TXIEN (EMAC_INTEN[16]) are enabled, the
+     * |        |          |EMAC generates the TX interrupt to CPU
+     * |        |          |If TDUIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even the
+     * |        |          |TDUIF (EMAC_INTSTS[23]) is set.
+     * |        |          |0 = TDUIF (EMAC_INTSTS[23]) trigger TX interrupt Disabled.
+     * |        |          |1 = TDUIF (EMAC_INTSTS[23]) trigger TX interrupt Enabled.
+     * |[24]    |TXBEIEN   |Transmit Bus Error Interrupt Enable Bit
+     * |        |          |The TXBEIEN controls the TXBEIF (EMAC_INTSTS[24]) interrupt generation
+     * |        |          |If TXBEIF (EMAC_INTSTS[24]) is set, and both TXBEIEN and TXIEN (EMAC_INTEN[16]) are enabled, the
+     * |        |          |EMAC generates the TX interrupt to CPU
+     * |        |          |If TXBEIEN or TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated to CPU even the
+     * |        |          |TXBEIF (EMAC_INTSTS[24]) is set.
+     * |        |          |0 = TXBEIF (EMAC_INTSTS[24]) trigger TX interrupt Disabled.
+     * |        |          |1 = TXBEIF (EMAC_INTSTS[24]) trigger TX interrupt Enabled.
+     * |[28]    |TSALMIEN  |Time Stamp Alarm Interrupt Enable Bit
+     * |        |          |The TSALMIEN controls the TSALMIF (EMAC_INTSTS[28]) interrupt generation
+     * |        |          |If TSALMIF (EMAC_INTSTS[28]) is set, and both TSALMIEN and TXIEN (EMAC_INTEN[16]) enabled, the
+     * |        |          |EMAC generates the TX interrupt to CPU
+     * |        |          |If TSALMIEN or TXIEN (EMAC_INTEN[16]) disabled, no TX interrupt generated to CPU even the
+     * |        |          |TXTSALMIF (EMAC_INTEN[28]) is set.
+     * |        |          |0 = TXTSALMIF (EMAC_INTSTS[28]) trigger TX interrupt Disabled.
+     * |        |          |1 = TXTSALMIF (EMAC_INTSTS[28]) trigger TX interrupt Enabled.
+     * @var EMAC_T::INTSTS
+     * Offset: 0xB0  MAC Interrupt Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |RXIF      |Receive Interrupt
+     * |        |          |The RXIF indicates the RX interrupt status.
+     * |        |          |If RXIF high and its corresponding enable bit, RXIEN (EMAC_INTEN[0]), is also high indicates
+     * |        |          |the EMAC generates RX interrupt to CPU
+     * |        |          |If RXIF is high but RXIEN (EMAC_INTEN[0]) is disabled, no RX interrupt is generated.
+     * |        |          |The RXIF is logic OR result of bit logic AND result of EMAC_INTSTS[15:1] and EMAC_INTEN[15:1]
+     * |        |          |In other words, if any bit of EMAC_INTSTS[15:1] is high and its corresponding enable bit in
+     * |        |          |EMAC_INTEN[15:1] is also enabled, the RXIF will be high.
+     * |        |          |Because the RXIF is a logic OR result, clears EMAC_INTSTS[15:1] makes RXIF be cleared, too.
+     * |        |          |0 = No status bit in EMAC_INTSTS[15:1] is set or no enable bit in EMAC_INTEN[15:1] is enabled.
+     * |        |          |1 = At least one status in EMAC_INTSTS[15:1] is set and its corresponding enable bit in
+     * |        |          |EMAC_INTEN[15:1] is enabled, too.
+     * |[1]     |CRCEIF    |CRC Error Interrupt
+     * |        |          |The CRCEIF high indicates the incoming packet incurred the CRC error and the packet is dropped
+     * |        |          |If the AEP (EMAC_CTL[4]) is set, the CRC error packet will be regarded as a good packet and
+     * |        |          |CRCEIF will not be set.
+     * |        |          |If the CRCEIF is high and CRCEIEN (EMAC_INTEN[1]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the CRCEIF status.
+     * |        |          |0 = The frame does not incur CRC error.
+     * |        |          |1 = The frame incurred CRC error.
+     * |[2]     |RXOVIF    |Receive FIFO Overflow Interrupt
+     * |        |          |The RXOVIF high indicates the RXFIFO overflow occurred during packet reception
+     * |        |          |While the RXFIFO overflow occurred, the EMAC drops the current receiving packer
+     * |        |          |If the RXFIFO overflow occurred often, it is recommended that modify RXFIFO threshold control,
+     * |        |          |the RXFIFOTH of FFTCR register, to higher level.
+     * |        |          |If the RXOVIF is high and RXOVIEN (EMAC_INTEN[2]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the RXOVIF status.
+     * |        |          |0 = No RXFIFO overflow occurred during packet reception.
+     * |        |          |1 = RXFIFO overflow occurred during packet reception.
+     * |[3]     |LPIF      |Long Packet Interrupt Flag
+     * |        |          |The LPIF high indicates the length of the incoming packet is greater than 1518 bytes and the
+     * |        |          |incoming packet is dropped
+     * |        |          |If the ALP (EMAC_CTL[1]) is set, the long packet will be regarded as a good packet and LPIF will not be set.
+     * |        |          |If the LPIF is high and LPIEN (EMAC_INTEN[3]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the LPIF status.
+     * |        |          |0 = The incoming frame is not a long frame or S/W wants to receive a long frame.
+     * |        |          |1 = The incoming frame is a long frame and dropped.
+     * |[4]     |RXGDIF    |Receive Good Interrupt
+     * |        |          |The RXGDIF high indicates the frame reception has completed.
+     * |        |          |If the RXGDIF is high and RXGDIEN (EAMC_MIEN[4]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the RXGDIF status.
+     * |        |          |0 = The frame reception has not complete yet.
+     * |        |          |1 = The frame reception has completed.
+     * |[5]     |ALIEIF    |Alignment Error Interrupt
+     * |        |          |The ALIEIF high indicates the length of the incoming frame is not a multiple of byte
+     * |        |          |If the ALIEIF is high and ALIEIEN (EMAC_INTEN[5]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the ALIEIF status.
+     * |        |          |0 = The frame length is a multiple of byte.
+     * |        |          |1 = The frame length is not a multiple of byte.
+     * |[6]     |RPIF      |Runt Packet Interrupt
+     * |        |          |The RPIF high indicates the length of the incoming packet is less than 64 bytes and the packet is dropped
+     * |        |          |If the ARP (EMAC_CTL[2]) is set, the short packet is regarded as a good packet and RPIF will not be set.
+     * |        |          |If the RPIF is high and RPIEN (EMAC_INTEN[6]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the RPIF status.
+     * |        |          |0 = The incoming frame is not a short frame or S/W wants to receive a short frame.
+     * |        |          |1 = The incoming frame is a short frame and dropped.
+     * |[7]     |MPCOVIF   |Missed Packet Counter Overrun Interrupt Flag
+     * |        |          |The MPCOVIF high indicates the MPCNT, Missed Packet Count, has overflow
+     * |        |          |If the MPCOVIF is high and MPCOVIEN (EMAC_INTEN[7]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the MPCOVIF status.
+     * |        |          |0 = The MPCNT has not rolled over yet.
+     * |        |          |1 = The MPCNT has rolled over yet.
+     * |[8]     |MFLEIF    |Maximum Frame Length Exceed Interrupt Flag
+     * |        |          |The MFLEIF high indicates the length of the incoming packet has exceeded the length limitation
+     * |        |          |configured in DMARFC register and the incoming packet is dropped
+     * |        |          |If the MFLEIF is high and MFLEIEN (EMAC_INTEN[8]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the MFLEIF status.
+     * |        |          |0 = The length of the incoming packet does not exceed the length limitation configured in DMARFC.
+     * |        |          |1 = The length of the incoming packet has exceeded the length limitation configured in DMARFC.
+     * |[9]     |DENIF     |DMA Early Notification Interrupt
+     * |        |          |The DENIF high indicates the EMAC has received the LENGTH field of the incoming packet.
+     * |        |          |If the DENIF is high and DENIENI (EMAC_INTEN[9]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the DENIF status.
+     * |        |          |0 = The LENGTH field of incoming packet has not received yet.
+     * |        |          |1 = The LENGTH field of incoming packet has received.
+     * |[10]    |RDUIF     |Receive Descriptor Unavailable Interrupt
+     * |        |          |The RDUIF high indicates that there is no available RX descriptor for packet reception and
+     * |        |          |RXDMA will stay at Halt state
+     * |        |          |Once, the RXDMA enters the Halt state, S/W must issues a write command to RSDR register to
+     * |        |          |make RXDMA leave Halt state while new RX descriptor is available.
+     * |        |          |If the RDUIF is high and RDUIEN (EMAC_INTEN[10]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the RDUIF status.
+     * |        |          |0 = RX descriptor is available.
+     * |        |          |1 = RX descriptor is unavailable.
+     * |[11]    |RXBEIF    |Receive Bus Error Interrupt
+     * |        |          |The RXBEIF high indicates the memory controller replies ERROR response while EMAC access
+     * |        |          |system memory through RXDMA during packet reception process
+     * |        |          |Reset EMAC is recommended while RXBEIF status is high.
+     * |        |          |If the RXBEIF is high and RXBEIEN (EMAC_INTEN[11]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the RXBEIF status.
+     * |        |          |0 = No ERROR response is received.
+     * |        |          |1 = ERROR response is received.
+     * |[14]    |CFRIF     |Control Frame Receive Interrupt
+     * |        |          |The CFRIF high indicates EMAC receives a flow control frame
+     * |        |          |The CFRIF only available while EMAC is operating on full duplex mode.
+     * |        |          |If the CFRIF is high and CFRIEN (EMAC_INTEN[14]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the CFRIF status.
+     * |        |          |0 = The EMAC does not receive the flow control frame.
+     * |        |          |1 = The EMAC receives a flow control frame.
+     * |[15]    |WOLIF     |Wake on LAN Interrupt Flag
+     * |        |          |The WOLIF high indicates EMAC receives a Magic Packet
+     * |        |          |The CFRIF only available while system is in power down mode and WOLEN is set high.
+     * |        |          |If the WOLIF is high and WOLIEN (EMAC_INTEN[15]) is enabled, the RXIF will be high
+     * |        |          |Write 1 to this bit clears the WOLIF status.
+     * |        |          |0 = The EMAC does not receive the Magic Packet.
+     * |        |          |1 = The EMAC receives a Magic Packet.
+     * |[16]    |TXIF      |Transmit Interrupt
+     * |        |          |The TXIF indicates the TX interrupt status.
+     * |        |          |If TXIF high and its corresponding enable bit, TXIEN (EMAC_INTEN[16]), is also high indicates
+     * |        |          |the EMAC generates TX interrupt to CPU
+     * |        |          |If TXIF is high but TXIEN (EMAC_INTEN[16]) is disabled, no TX interrupt is generated.
+     * |        |          |The TXIF is logic OR result of bit logic AND result of EMAC_INTSTS[28:17] and EMAC_INTEN[28:17]
+     * |        |          |In other words, if any bit of EMAC_INTSTS[28:17] is high and its corresponding enable bit
+     * |        |          |in EMAC_INTEN[28:17] is also enabled, the TXIF will be high
+     * |        |          |Because the TXIF is a logic OR result, clears EMAC_INTSTS[28:17] makes TXIF be cleared, too.
+     * |        |          |0 = No status bit in EMAC_INTSTS[28:17] is set or no enable bit in EMAC_INTEN[28:17] is enabled.
+     * |        |          |1 = At least one status in EMAC_INTSTS[28:17] is set and its corresponding enable bit
+     * |        |          |in EMAC_INTEN[28:17] is enabled, too.
+     * |[17]    |TXUDIF    |Transmit FIFO Underflow Interrupt
+     * |        |          |The TXUDIF high indicates the TXFIFO underflow occurred during packet transmission
+     * |        |          |While the TXFIFO underflow occurred, the EMAC will retransmit the packet automatically
+     * |        |          |without S/W intervention
+     * |        |          |If the TXFIFO underflow occurred often, it is recommended that modify TXFIFO threshold control,
+     * |        |          |the TXFIFOTH of FFTCR register, to higher level.
+     * |        |          |If the TXUDIF is high and TXUDIEN (EMAC_INTEN[17]) is enabled, the TXIF will be high
+     * |        |          |Write 1 to this bit clears the TXUDIF status.
+     * |        |          |0 = No TXFIFO underflow occurred during packet transmission.
+     * |        |          |1 = TXFIFO underflow occurred during packet transmission.
+     * |[18]    |TXCPIF    |Transmit Completion Interrupt
+     * |        |          |The TXCPIF indicates the packet transmission has completed correctly.
+     * |        |          |If the TXCPIF is high and TXCPIEN (EMAC_INTEN[18]) is enabled, the TXIF will be high
+     * |        |          |Write 1 to this bit clears the TXCPIF status.
+     * |        |          |0 = The packet transmission not completed.
+     * |        |          |1 = The packet transmission has completed.
+     * |[19]    |EXDEFIF   |Defer Exceed Interrupt
+     * |        |          |The EXDEFIF high indicates the frame waiting for transmission has deferred over 0.32768ms
+     * |        |          |on 100Mbps mode, or 3.2768ms on 10Mbps mode.
+     * |        |          |The deferral exceed check will only be done while bit NODEF of MCMDR is disabled, and EMAC
+     * |        |          |is operating on half-duplex mode.
+     * |        |          |If the EXDEFIF is high and EXDEFIEN (EMAC_INTEN[19]) is enabled, the TXIF will be high
+     * |        |          |Write 1 to this bit clears the EXDEFIF status.
+     * |        |          |0 = Frame waiting for transmission has not deferred over 0.32768ms (100Mbps) or 3.2768ms (10Mbps).
+     * |        |          |1 = Frame waiting for transmission has deferred over 0.32768ms (100Mbps) or 3.2768ms (10Mbps).
+     * |[20]    |NCSIF     |No Carrier Sense Interrupt
+     * |        |          |The NCSIF high indicates the MII I/F signal CRS does not active at the start of or during
+     * |        |          |the packet transmission
+     * |        |          |The NCSIF is only available while EMAC is operating on half-duplex mode
+     * |        |          |If the NCSIF is high and NCSIEN (EMAC_INTEN[20]) is enabled, the TXIF will be high.
+     * |        |          |Write 1 to this bit clears the NCSIF status.
+     * |        |          |0 = CRS signal actives correctly.
+     * |        |          |1 = CRS signal does not active at the start of or during the packet transmission.
+     * |[21]    |TXABTIF   |Transmit Abort Interrupt
+     * |        |          |The TXABTIF high indicates the packet incurred 16 consecutive collisions during transmission,
+     * |        |          |and then the transmission process for this packet is aborted
+     * |        |          |The transmission abort is only available while EMAC is operating on half-duplex mode.
+     * |        |          |If the TXABTIF is high and TXABTIEN (EMAC_INTEN[21]) is enabled, the TXIF will be high
+     * |        |          |Write 1 to this bit clears the TXABTIF status.
+     * |        |          |0 = Packet does not incur 16 consecutive collisions during transmission.
+     * |        |          |1 = Packet incurred 16 consecutive collisions during transmission.
+     * |[22]    |LCIF      |Late Collision Interrupt
+     * |        |          |The LCIF high indicates the collision occurred in the outside of 64 bytes collision window
+     * |        |          |This means after the 64 bytes of a frame has been transmitted out to the network, the collision
+     * |        |          |still occurred.
+     * |        |          |The late collision check will only be done while EMAC is operating on half-duplex mode
+     * |        |          |If the LCIF is high and LCIEN (EMAC_INTEN[22]) is enabled, the TXIF will be high.
+     * |        |          |Write 1 to this bit clears the LCIF status.
+     * |        |          |0 = No collision occurred in the outside of 64 bytes collision window.
+     * |        |          |1 = Collision occurred in the outside of 64 bytes collision window.
+     * |[23]    |TDUIF     |Transmit Descriptor Unavailable Interrupt
+     * |        |          |The TDUIF high indicates that there is no available TX descriptor for packet transmission and
+     * |        |          |TXDMA will stay at Halt state.
+     * |        |          |Once, the TXDMA enters the Halt state, S/W must issues a write command to TSDR register to make
+     * |        |          |TXDMA leave Halt state while new TX descriptor is available.
+     * |        |          |If the TDUIF is high and TDUIEN (EMAC_INTEN[23]) is enabled, the TXIF will be high.
+     * |        |          |Write 1 to this bit clears the TDUIF status.
+     * |        |          |0 = TX descriptor is available.
+     * |        |          |1 = TX descriptor is unavailable.
+     * |[24]    |TXBEIF    |Transmit Bus Error Interrupt
+     * |        |          |The TXBEIF high indicates the memory controller replies ERROR response while EMAC access system
+     * |        |          |memory through TXDMA during packet transmission process
+     * |        |          |Reset EMAC is recommended while TXBEIF status is high.
+     * |        |          |If the TXBEIF is high and TXBEIEN (EMAC_INTEN[24]) is enabled, the TXIF will be high.
+     * |        |          |Write 1 to this bit clears the TXBEIF status.
+     * |        |          |0 = No ERROR response is received.
+     * |        |          |1 = ERROR response is received.
+     * |[28]    |TSALMIF   |Time Stamp Alarm Interrupt
+     * |        |          |The TSALMIF high indicates the EMAC_TSSEC register value equals to EMAC_ALMSEC register and
+     * |        |          |EMAC_TSSUBSEC register value equals to register EMAC_ALMSUBLSR.
+     * |        |          |If TSALMIF is high and TSALMIEN (EMAC_INTEN[28]) enabled, the TXIF will be high.
+     * |        |          |Write 1 to this bit clears the TSALMIF status.
+     * |        |          |0 = EMAC_TSSEC did not equal EMAC_ALMSEC or EMAC_TSSUBSEC did not equal EMAC_ALMSUBSEC.
+     * |        |          |1 = EMAC_TSSEC equals EMAC_ALMSEC and EMAC_TSSUBSEC equals EMAC_ALMSUBSEC.
+     * @var EMAC_T::GENSTS
+     * Offset: 0xB4  MAC General Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |CFR       |Control Frame Received
+     * |        |          |The CFRIF high indicates EMAC receives a flow control frame
+     * |        |          |The CFRIF only available while EMAC is operating on full duplex mode.
+     * |        |          |0 = The EMAC does not receive the flow control frame.
+     * |        |          |1 = The EMAC receives a flow control frame.
+     * |[1]     |RXHALT    |Receive Halted
+     * |        |          |The RXHALT high indicates the next normal packet reception process will be halted because
+     * |        |          |the bit RXON of MCMDR is disabled be S/W.
+     * |        |          |0 = Next normal packet reception process will go on.
+     * |        |          |1 = Next normal packet reception process will be halted.
+     * |[2]     |RXFFULL   |RXFIFO Full
+     * |        |          |The RXFFULL indicates the RXFIFO is full due to four 64-byte packets are kept in RXFIFO
+     * |        |          |and the following incoming packet will be dropped.
+     * |        |          |0 = The RXFIFO is not full.
+     * |        |          |1 = The RXFIFO is full and the following incoming packet will be dropped.
+     * |[7:4]   |COLCNT    |Collision Count
+     * |        |          |The COLCNT indicates that how many collisions occurred consecutively during a packet transmission
+     * |        |          |If the packet incurred 16 consecutive collisions during transmission, the COLCNT will be
+     * |        |          |0 and bit TXABTIF will be set to 1.
+     * |[8]     |DEF       |Deferred Transmission
+     * |        |          |The DEF high indicates the packet transmission has deferred once
+     * |        |          |The DEF is only available while EMAC is operating on half-duplex mode.
+     * |        |          |0 = Packet transmission does not defer.
+     * |        |          |1 = Packet transmission has deferred once.
+     * |[9]     |TXPAUSED  |Transmission Paused
+     * |        |          |The TXPAUSED high indicates the next normal packet transmission process will be paused temporally
+     * |        |          |because EMAC received a PAUSE control frame.
+     * |        |          |0 = Next normal packet transmission process will go on.
+     * |        |          |1 = Next normal packet transmission process will be paused.
+     * |[10]    |SQE       |Signal Quality Error
+     * |        |          |The SQE high indicates the SQE error found at end of packet transmission on 10Mbps half-duplex mode
+     * |        |          |The SQE error check will only be done while both bit SQECHKEN (EMAC_CTL[17]) is enabled and EMAC
+     * |        |          |is operating on 10Mbps half-duplex mode.
+     * |        |          |0 = No SQE error found at end of packet transmission.
+     * |        |          |1 = SQE error found at end of packet transmission.
+     * |[11]    |TXHALT    |Transmission Halted
+     * |        |          |The TXHALT high indicates the next normal packet transmission process will be halted because
+     * |        |          |the bit TXON (EMAC_CTL[8]) is disabled be S/W.
+     * |        |          |0 = Next normal packet transmission process will go on.
+     * |        |          |1 = Next normal packet transmission process will be halted.
+     * |[12]    |RPSTS     |Remote Pause Status
+     * |        |          |The RPSTS indicates that remote pause counter down counting actives.
+     * |        |          |After Ethernet MAC controller sent PAUSE frame out successfully, it starts the remote pause
+     * |        |          |counter down counting
+     * |        |          |When this bit high, it's predictable that remote Ethernet MAC controller wouldn't start the packet
+     * |        |          |transmission until the down counting done.
+     * |        |          |0 = Remote pause counter down counting done.
+     * |        |          |1 = Remote pause counter down counting actives.
+     * @var EMAC_T::MPCNT
+     * Offset: 0xB8  Missed Packet Count Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |MPCNT     |Miss Packet Count
+     * |        |          |The MPCNT indicates the number of packets that were dropped due to various types of receive errors
+     * |        |          |The following type of receiving error makes missed packet counter increase:
+     * |        |          |1. Incoming packet is incurred RXFIFO overflow.
+     * |        |          |2. Incoming packet is dropped due to RXON is disabled.
+     * |        |          |3. Incoming packet is incurred CRC error.
+     * @var EMAC_T::RPCNT
+     * Offset: 0xBC  MAC Receive Pause Count Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |RPCNT     |MAC Receive Pause Count
+     * |        |          |The RPCNT keeps the OPERAND field of the PAUSE control frame
+     * |        |          |It indicates how many slot time (512 bit time) the TX of EMAC will be paused.
+     * @var EMAC_T::FRSTS
+     * Offset: 0xC8  DMA Receive Frame Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |RXFLT     |Receive Frame LENGTH
+     * |        |          |The RXFLT keeps the LENGTH field of each incoming Ethernet packet
+     * |        |          |If the bit DENIEN (EMAC_INTEN[9]) is enabled and the LENGTH field of incoming packet has
+     * |        |          |received, the bit DENIF (EMAC_INTSTS[9]) will be set and trigger interrupt.
+     * |        |          |And, the content of LENGTH field will be stored in RXFLT.
+     * @var EMAC_T::CTXDSA
+     * Offset: 0xCC  Current Transmit Descriptor Start Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CTXDSA    |Current Transmit Descriptor Start Address
+     * |        |          |The CTXDSA keeps the start address of TX descriptor that is used by TXDMA currently
+     * |        |          |The CTXDSA is read only and write to this register has no effect.
+     * @var EMAC_T::CTXBSA
+     * Offset: 0xD0  Current Transmit Buffer Start Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CTXBSA    |Current Transmit Buffer Start Address
+     * |        |          |The CTXDSA keeps the start address of TX frame buffer that is used by TXDMA currently
+     * |        |          |The CTXBSA is read only and write to this register has no effect.
+     * @var EMAC_T::CRXDSA
+     * Offset: 0xD4  Current Receive Descriptor Start Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CRXDSA    |Current Receive Descriptor Start Address
+     * |        |          |The CRXDSA keeps the start address of RX descriptor that is used by RXDMA currently
+     * |        |          |The CRXDSA is read only and write to this register has no effect.
+     * @var EMAC_T::CRXBSA
+     * Offset: 0xD8  Current Receive Buffer Start Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CRXBSA    |Current Receive Buffer Start Address
+     * |        |          |The CRXBSA keeps the start address of RX frame buffer that is used by RXDMA currently
+     * |        |          |The CRXBSA is read only and write to this register has no effect.
+     * @var EMAC_T::TSCTL
+     * Offset: 0x100  Time Stamp Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |TSEN      |Time Stamp Function Enable Bit
+     * |        |          |This bit controls if the IEEE 1588 PTP time stamp function is enabled or not.
+     * |        |          |Set this bit high to enable IEEE 1588 PTP time stamp function while set this bit low
+     * |        |          |to disable IEEE 1588 PTP time stamp function.
+     * |        |          |0 = I EEE 1588 PTP time stamp function Disabled.
+     * |        |          |1 = IEEE 1588 PTP time stamp function Enabled.
+     * |[1]     |TSIEN     |Time Stamp Counter Initialization Enable Bit
+     * |        |          |Set this bit high enables Ethernet MAC controller to load value of register EMAC_UPDSEC
+     * |        |          |and EMAC_UPDSUBSEC to PTP time stamp counter.
+     * |        |          |After the load operation finished, Ethernet MAC controller clear this bit to low automatically.
+     * |        |          |0 = Time stamp counter initialization done.
+     * |        |          |1 = Time stamp counter initialization Enabled.
+     * |[2]     |TSMODE    |Time Stamp Fine Update Enable Bit
+     * |        |          |This bit chooses the time stamp counter update mode.
+     * |        |          |0 = Time stamp counter is in coarse update mode.
+     * |        |          |1 = Time stamp counter is in fine update mode.
+     * |[3]     |TSUPDATE  |Time Stamp Counter Time Update Enable Bit
+     * |        |          |Set this bit high enables Ethernet MAC controller to add value of register EMAC_UPDSEC and
+     * |        |          |EMAC_UPDSUBSEC to PTP time stamp counter.
+     * |        |          |After the add operation finished, Ethernet MAC controller clear this bit to low automatically.
+     * |        |          |0 = No action.
+     * |        |          |1 = EMAC_UPDSEC updated to EMAC_TSSEC and EMAC_UPDSUBSEC updated to EMAC_TSSUBSEC.
+     * |[5]     |TSALMEN   |Time Stamp Alarm Enable Bit
+     * |        |          |Set this bit high enable Ethernet MAC controller to set TSALMIF (EMAC_INTSTS[28]) high when
+     * |        |          |EMAC_TSSEC equals to EMAC_ALMSEC and EMAC_TSSUBSEC equals to EMAC_ALMSUBSEC.
+     * |        |          |0 = Alarm disabled when EMAC_TSSEC equals to EMAC_ALMSEC and EMAC_TSSUBSEC equals to EMAC_ALMSUBSEC.
+     * |        |          |1 = Alarm enabled when EMAC_TSSEC equals to EMAC_ALMSEC and EMAC_TSSUBSEC equals to EMAC_ALMSUBSEC.
+     * @var EMAC_T::TSSEC
+     * Offset: 0x110  Time Stamp Counter Second Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SEC       |Time Stamp Counter Second
+     * |        |          |This register reflects the bit [63:32] value of 64-bit reference timing counter
+     * |        |          |This 32-bit value is used as the second part of time stamp when TSEN (EMAC_TSCTL[0]) is high.
+     * @var EMAC_T::TSSUBSEC
+     * Offset: 0x114  Time Stamp Counter Sub Second Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SUBSEC    |Time Stamp Counter Sub-second
+     * |        |          |This register reflects the bit [31:0] value of 64-bit reference timing counter
+     * |        |          |This 32-bit value is used as the sub-second part of time stamp when TSEN (EMAC_TSCTL[0]) is high.
+     * @var EMAC_T::TSINC
+     * Offset: 0x118  Time Stamp Increment Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |CNTINC    |Time Stamp Counter Increment
+     * |        |          |Time stamp counter increment value.
+     * |        |          |If TSEN (EMAC_TSCTL[0]) is high, EMAC adds EMAC_TSSUBSEC with this 8-bit value every
+     * |        |          |time when it wants to increase the EMAC_TSSUBSEC value.
+     * @var EMAC_T::TSADDEND
+     * Offset: 0x11C  Time Stamp Addend Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |ADDEND    |Time Stamp Counter Addend
+     * |        |          |This register keeps a 32-bit value for accumulator to enable increment of EMAC_TSSUBSEC.
+     * |        |          |If TSEN (EMAC_TSCTL[0]) and TSMODE (EMAC_TSCTL[2]) are both high, EMAC increases accumulator
+     * |        |          |with this 32-bit value in each HCLK
+     * |        |          |Once the accumulator is overflow, it generates a enable to increase EMAC_TSSUBSEC with an 8-bit
+     * |        |          |value kept in register EMAC_TSINC.
+     * @var EMAC_T::UPDSEC
+     * Offset: 0x120  Time Stamp Update Second Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SEC       |Time Stamp Counter Second Update
+     * |        |          |When TSIEN (EMAC_TSCTL[1]) is high
+     * |        |          |EMAC loads this 32-bit value to EMAC_TSSEC directly
+     * |        |          |When TSUPDATE (EMAC_TSCTL[3]) is high, EMAC increases EMAC_TSSEC with this 32-bit value.
+     * @var EMAC_T::UPDSUBSEC
+     * Offset: 0x124  Time Stamp Update Sub Second Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SUBSEC    |Time Stamp Counter Sub-second Update
+     * |        |          |When TSIEN (EMAC_TSCTL[1]) is high
+     * |        |          |EMAC loads this 32-bit value to EMAC_TSSUBSEC directly
+     * |        |          |When TSUPDATE (EMAC_TSCTL[3]) is high, EMAC increases EMAC_TSSUBSEC with this 32-bit value.
+     * @var EMAC_T::ALMSEC
+     * Offset: 0x128  Time Stamp Alarm Second Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SEC       |Time Stamp Counter Second Alarm
+     * |        |          |Time stamp counter second part alarm value.
+     * |        |          |This value is only useful when ALMEN (EMAC_TSCTL[5]) high
+     * |        |          |If ALMEN (EMAC_TSCTL[5]) is high, EMAC_TSSEC equals to EMAC_ALMSEC and EMAC_TSSUBSEC equals to
+     * |        |          |EMAC_ALMSUBSEC, Ethernet MAC controller set TSALMIF (EMAC_INTSTS[28]) high.
+     * @var EMAC_T::ALMSUBSEC
+     * Offset: 0x12C  Time Stamp Alarm Sub Second Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SUBSEC    |Time Stamp Counter Sub-second Alarm
+     * |        |          |Time stamp counter sub-second part alarm value.
+     * |        |          |This value is only useful when ALMEN (EMAC_TSCTL[5]) high
+     * |        |          |If ALMEN (EMAC_TSCTL[5]) is high, EMAC_TSSEC equals to EMAC_ALMSEC and EMAC_TSSUBSEC equals to
+     * |        |          |EMAC_ALMSUBSEC, Ethernet MAC controller set TSALMIF (EMAC_INTSTS[28]) high.
+     */
+    __IO uint32_t CAMCTL;                /*!< [0x0000] CAM Comparison Control Register                                  */
+    __IO uint32_t CAMEN;                 /*!< [0x0004] CAM Enable Register                                              */
+    __IO uint32_t CAM0M;                 /*!< [0x0008] CAM0 Most Significant Word Register                              */
+    __IO uint32_t CAM0L;                 /*!< [0x000c] CAM0 Least Significant Word Register                             */
+    __IO uint32_t CAM1M;                 /*!< [0x0010] CAM1 Most Significant Word Register                              */
+    __IO uint32_t CAM1L;                 /*!< [0x0014] CAM1 Least Significant Word Register                             */
+    __IO uint32_t CAM2M;                 /*!< [0x0018] CAM2 Most Significant Word Register                              */
+    __IO uint32_t CAM2L;                 /*!< [0x001c] CAM2 Least Significant Word Register                             */
+    __IO uint32_t CAM3M;                 /*!< [0x0020] CAM3 Most Significant Word Register                              */
+    __IO uint32_t CAM3L;                 /*!< [0x0024] CAM3 Least Significant Word Register                             */
+    __IO uint32_t CAM4M;                 /*!< [0x0028] CAM4 Most Significant Word Register                              */
+    __IO uint32_t CAM4L;                 /*!< [0x002c] CAM4 Least Significant Word Register                             */
+    __IO uint32_t CAM5M;                 /*!< [0x0030] CAM5 Most Significant Word Register                              */
+    __IO uint32_t CAM5L;                 /*!< [0x0034] CAM5 Least Significant Word Register                             */
+    __IO uint32_t CAM6M;                 /*!< [0x0038] CAM6 Most Significant Word Register                              */
+    __IO uint32_t CAM6L;                 /*!< [0x003c] CAM6 Least Significant Word Register                             */
+    __IO uint32_t CAM7M;                 /*!< [0x0040] CAM7 Most Significant Word Register                              */
+    __IO uint32_t CAM7L;                 /*!< [0x0044] CAM7 Least Significant Word Register                             */
+    __IO uint32_t CAM8M;                 /*!< [0x0048] CAM8 Most Significant Word Register                              */
+    __IO uint32_t CAM8L;                 /*!< [0x004c] CAM8 Least Significant Word Register                             */
+    __IO uint32_t CAM9M;                 /*!< [0x0050] CAM9 Most Significant Word Register                              */
+    __IO uint32_t CAM9L;                 /*!< [0x0054] CAM9 Least Significant Word Register                             */
+    __IO uint32_t CAM10M;                /*!< [0x0058] CAM10 Most Significant Word Register                             */
+    __IO uint32_t CAM10L;                /*!< [0x005c] CAM10 Least Significant Word Register                            */
+    __IO uint32_t CAM11M;                /*!< [0x0060] CAM11 Most Significant Word Register                             */
+    __IO uint32_t CAM11L;                /*!< [0x0064] CAM11 Least Significant Word Register                            */
+    __IO uint32_t CAM12M;                /*!< [0x0068] CAM12 Most Significant Word Register                             */
+    __IO uint32_t CAM12L;                /*!< [0x006c] CAM12 Least Significant Word Register                            */
+    __IO uint32_t CAM13M;                /*!< [0x0070] CAM13 Most Significant Word Register                             */
+    __IO uint32_t CAM13L;                /*!< [0x0074] CAM13 Least Significant Word Register                            */
+    __IO uint32_t CAM14M;                /*!< [0x0078] CAM14 Most Significant Word Register                             */
+    __IO uint32_t CAM14L;                /*!< [0x007c] CAM14 Least Significant Word Register                            */
+    __IO uint32_t CAM15MSB;              /*!< [0x0080] CAM15 Most Significant Word Register                             */
+    __IO uint32_t CAM15LSB;              /*!< [0x0084] CAM15 Least Significant Word Register                            */
+    __IO uint32_t TXDSA;                 /*!< [0x0088] Transmit Descriptor Link List Start Address Register             */
+    __IO uint32_t RXDSA;                 /*!< [0x008c] Receive Descriptor Link List Start Address Register              */
+    __IO uint32_t CTL;                   /*!< [0x0090] MAC Control Register                                             */
+    __IO uint32_t MIIMDAT;               /*!< [0x0094] MII Management Data Register                                     */
+    __IO uint32_t MIIMCTL;               /*!< [0x0098] MII Management Control and Address Register                      */
+    __IO uint32_t FIFOCTL;               /*!< [0x009c] FIFO Threshold Control Register                                  */
+    __O  uint32_t TXST;                  /*!< [0x00a0] Transmit Start Demand Register                                   */
+    __O  uint32_t RXST;                  /*!< [0x00a4] Receive Start Demand Register                                    */
+    __IO uint32_t MRFL;                  /*!< [0x00a8] Maximum Receive Frame Control Register                           */
+    __IO uint32_t INTEN;                 /*!< [0x00ac] MAC Interrupt Enable Register                                    */
+    __IO uint32_t INTSTS;                /*!< [0x00b0] MAC Interrupt Status Register                                    */
+    __IO uint32_t GENSTS;                /*!< [0x00b4] MAC General Status Register                                      */
+    __IO uint32_t MPCNT;                 /*!< [0x00b8] Missed Packet Count Register                                     */
+    __I  uint32_t RPCNT;                 /*!< [0x00bc] MAC Receive Pause Count Register                                 */
+    /** @cond HIDDEN_SYMBOLS */
+    __I  uint32_t RESERVE0[2];
+    /** @endcond */
+    __IO uint32_t FRSTS;                 /*!< [0x00c8] DMA Receive Frame Status Register                                */
+    __I  uint32_t CTXDSA;                /*!< [0x00cc] Current Transmit Descriptor Start Address Register               */
+    __I  uint32_t CTXBSA;                /*!< [0x00d0] Current Transmit Buffer Start Address Register                   */
+    __I  uint32_t CRXDSA;                /*!< [0x00d4] Current Receive Descriptor Start Address Register                */
+    __I  uint32_t CRXBSA;                /*!< [0x00d8] Current Receive Buffer Start Address Register                    */
+    /** @cond HIDDEN_SYMBOLS */
+    __I  uint32_t RESERVE1[9];
+    /** @endcond */
+    __IO uint32_t TSCTL;                 /*!< [0x0100] Time Stamp Control Register                                      */
+    /** @cond HIDDEN_SYMBOLS */
+    __I  uint32_t RESERVE2[3];
+    /** @endcond */
+    __I  uint32_t TSSEC;                 /*!< [0x0110] Time Stamp Counter Second Register                               */
+    __I  uint32_t TSSUBSEC;              /*!< [0x0114] Time Stamp Counter Sub Second Register                           */
+    __IO uint32_t TSINC;                 /*!< [0x0118] Time Stamp Increment Register                                    */
+    __IO uint32_t TSADDEND;              /*!< [0x011c] Time Stamp Addend Register                                       */
+    __IO uint32_t UPDSEC;                /*!< [0x0120] Time Stamp Update Second Register                                */
+    __IO uint32_t UPDSUBSEC;             /*!< [0x0124] Time Stamp Update Sub Second Register                            */
+    __IO uint32_t ALMSEC;                /*!< [0x0128] Time Stamp Alarm Second Register                                 */
+    __IO uint32_t ALMSUBSEC;             /*!< [0x012c] Time Stamp Alarm Sub Second Register                             */
+
+} EMAC_T;
+
+/**
+    @addtogroup EMAC_CONST EMAC Bit Field Definition
+    Constant Definitions for EMAC Controller
+@{ */
+
+#define EMAC_CAMCTL_AUP_Pos              (0)                                               /*!< EMAC_T::CAMCTL: AUP Position           */
+#define EMAC_CAMCTL_AUP_Msk              (0x1ul << EMAC_CAMCTL_AUP_Pos)                    /*!< EMAC_T::CAMCTL: AUP Mask               */
+
+#define EMAC_CAMCTL_AMP_Pos              (1)                                               /*!< EMAC_T::CAMCTL: AMP Position           */
+#define EMAC_CAMCTL_AMP_Msk              (0x1ul << EMAC_CAMCTL_AMP_Pos)                    /*!< EMAC_T::CAMCTL: AMP Mask               */
+
+#define EMAC_CAMCTL_ABP_Pos              (2)                                               /*!< EMAC_T::CAMCTL: ABP Position           */
+#define EMAC_CAMCTL_ABP_Msk              (0x1ul << EMAC_CAMCTL_ABP_Pos)                    /*!< EMAC_T::CAMCTL: ABP Mask               */
+
+#define EMAC_CAMCTL_COMPEN_Pos           (3)                                               /*!< EMAC_T::CAMCTL: COMPEN Position        */
+#define EMAC_CAMCTL_COMPEN_Msk           (0x1ul << EMAC_CAMCTL_COMPEN_Pos)                 /*!< EMAC_T::CAMCTL: COMPEN Mask            */
+
+#define EMAC_CAMCTL_CMPEN_Pos            (4)                                               /*!< EMAC_T::CAMCTL: CMPEN Position         */
+#define EMAC_CAMCTL_CMPEN_Msk            (0x1ul << EMAC_CAMCTL_CMPEN_Pos)                  /*!< EMAC_T::CAMCTL: CMPEN Mask             */
+
+#define EMAC_CAMEN_CAMxEN_Pos            (0)                                               /*!< EMAC_T::CAMEN: CAMxEN Position         */
+#define EMAC_CAMEN_CAMxEN_Msk            (0x1ul << EMAC_CAMEN_CAMxEN_Pos)                  /*!< EMAC_T::CAMEN: CAMxEN Mask             */
+
+#define EMAC_CAM0M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM0M: MACADDR2 Position       */
+#define EMAC_CAM0M_MACADDR2_Msk          (0xfful << EMAC_CAM0M_MACADDR2_Pos)               /*!< EMAC_T::CAM0M: MACADDR2 Mask           */
+
+#define EMAC_CAM0M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM0M: MACADDR3 Position       */
+#define EMAC_CAM0M_MACADDR3_Msk          (0xfful << EMAC_CAM0M_MACADDR3_Pos)               /*!< EMAC_T::CAM0M: MACADDR3 Mask           */
+
+#define EMAC_CAM0M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM0M: MACADDR4 Position       */
+#define EMAC_CAM0M_MACADDR4_Msk          (0xfful << EMAC_CAM0M_MACADDR4_Pos)               /*!< EMAC_T::CAM0M: MACADDR4 Mask           */
+
+#define EMAC_CAM0M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM0M: MACADDR5 Position       */
+#define EMAC_CAM0M_MACADDR5_Msk          (0xfful << EMAC_CAM0M_MACADDR5_Pos)               /*!< EMAC_T::CAM0M: MACADDR5 Mask           */
+
+#define EMAC_CAM0L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM0L: MACADDR0 Position       */
+#define EMAC_CAM0L_MACADDR0_Msk          (0xfful << EMAC_CAM0L_MACADDR0_Pos)               /*!< EMAC_T::CAM0L: MACADDR0 Mask           */
+
+#define EMAC_CAM0L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM0L: MACADDR1 Position       */
+#define EMAC_CAM0L_MACADDR1_Msk          (0xfful << EMAC_CAM0L_MACADDR1_Pos)               /*!< EMAC_T::CAM0L: MACADDR1 Mask           */
+
+#define EMAC_CAM1M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM1M: MACADDR2 Position       */
+#define EMAC_CAM1M_MACADDR2_Msk          (0xfful << EMAC_CAM1M_MACADDR2_Pos)               /*!< EMAC_T::CAM1M: MACADDR2 Mask           */
+
+#define EMAC_CAM1M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM1M: MACADDR3 Position       */
+#define EMAC_CAM1M_MACADDR3_Msk          (0xfful << EMAC_CAM1M_MACADDR3_Pos)               /*!< EMAC_T::CAM1M: MACADDR3 Mask           */
+
+#define EMAC_CAM1M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM1M: MACADDR4 Position       */
+#define EMAC_CAM1M_MACADDR4_Msk          (0xfful << EMAC_CAM1M_MACADDR4_Pos)               /*!< EMAC_T::CAM1M: MACADDR4 Mask           */
+
+#define EMAC_CAM1M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM1M: MACADDR5 Position       */
+#define EMAC_CAM1M_MACADDR5_Msk          (0xfful << EMAC_CAM1M_MACADDR5_Pos)               /*!< EMAC_T::CAM1M: MACADDR5 Mask           */
+
+#define EMAC_CAM1L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM1L: MACADDR0 Position       */
+#define EMAC_CAM1L_MACADDR0_Msk          (0xfful << EMAC_CAM1L_MACADDR0_Pos)               /*!< EMAC_T::CAM1L: MACADDR0 Mask           */
+
+#define EMAC_CAM1L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM1L: MACADDR1 Position       */
+#define EMAC_CAM1L_MACADDR1_Msk          (0xfful << EMAC_CAM1L_MACADDR1_Pos)               /*!< EMAC_T::CAM1L: MACADDR1 Mask           */
+
+#define EMAC_CAM2M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM2M: MACADDR2 Position       */
+#define EMAC_CAM2M_MACADDR2_Msk          (0xfful << EMAC_CAM2M_MACADDR2_Pos)               /*!< EMAC_T::CAM2M: MACADDR2 Mask           */
+
+#define EMAC_CAM2M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM2M: MACADDR3 Position       */
+#define EMAC_CAM2M_MACADDR3_Msk          (0xfful << EMAC_CAM2M_MACADDR3_Pos)               /*!< EMAC_T::CAM2M: MACADDR3 Mask           */
+
+#define EMAC_CAM2M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM2M: MACADDR4 Position       */
+#define EMAC_CAM2M_MACADDR4_Msk          (0xfful << EMAC_CAM2M_MACADDR4_Pos)               /*!< EMAC_T::CAM2M: MACADDR4 Mask           */
+
+#define EMAC_CAM2M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM2M: MACADDR5 Position       */
+#define EMAC_CAM2M_MACADDR5_Msk          (0xfful << EMAC_CAM2M_MACADDR5_Pos)               /*!< EMAC_T::CAM2M: MACADDR5 Mask           */
+
+#define EMAC_CAM2L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM2L: MACADDR0 Position       */
+#define EMAC_CAM2L_MACADDR0_Msk          (0xfful << EMAC_CAM2L_MACADDR0_Pos)               /*!< EMAC_T::CAM2L: MACADDR0 Mask           */
+
+#define EMAC_CAM2L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM2L: MACADDR1 Position       */
+#define EMAC_CAM2L_MACADDR1_Msk          (0xfful << EMAC_CAM2L_MACADDR1_Pos)               /*!< EMAC_T::CAM2L: MACADDR1 Mask           */
+
+#define EMAC_CAM3M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM3M: MACADDR2 Position       */
+#define EMAC_CAM3M_MACADDR2_Msk          (0xfful << EMAC_CAM3M_MACADDR2_Pos)               /*!< EMAC_T::CAM3M: MACADDR2 Mask           */
+
+#define EMAC_CAM3M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM3M: MACADDR3 Position       */
+#define EMAC_CAM3M_MACADDR3_Msk          (0xfful << EMAC_CAM3M_MACADDR3_Pos)               /*!< EMAC_T::CAM3M: MACADDR3 Mask           */
+
+#define EMAC_CAM3M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM3M: MACADDR4 Position       */
+#define EMAC_CAM3M_MACADDR4_Msk          (0xfful << EMAC_CAM3M_MACADDR4_Pos)               /*!< EMAC_T::CAM3M: MACADDR4 Mask           */
+
+#define EMAC_CAM3M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM3M: MACADDR5 Position       */
+#define EMAC_CAM3M_MACADDR5_Msk          (0xfful << EMAC_CAM3M_MACADDR5_Pos)               /*!< EMAC_T::CAM3M: MACADDR5 Mask           */
+
+#define EMAC_CAM3L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM3L: MACADDR0 Position       */
+#define EMAC_CAM3L_MACADDR0_Msk          (0xfful << EMAC_CAM3L_MACADDR0_Pos)               /*!< EMAC_T::CAM3L: MACADDR0 Mask           */
+
+#define EMAC_CAM3L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM3L: MACADDR1 Position       */
+#define EMAC_CAM3L_MACADDR1_Msk          (0xfful << EMAC_CAM3L_MACADDR1_Pos)               /*!< EMAC_T::CAM3L: MACADDR1 Mask           */
+
+#define EMAC_CAM4M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM4M: MACADDR2 Position       */
+#define EMAC_CAM4M_MACADDR2_Msk          (0xfful << EMAC_CAM4M_MACADDR2_Pos)               /*!< EMAC_T::CAM4M: MACADDR2 Mask           */
+
+#define EMAC_CAM4M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM4M: MACADDR3 Position       */
+#define EMAC_CAM4M_MACADDR3_Msk          (0xfful << EMAC_CAM4M_MACADDR3_Pos)               /*!< EMAC_T::CAM4M: MACADDR3 Mask           */
+
+#define EMAC_CAM4M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM4M: MACADDR4 Position       */
+#define EMAC_CAM4M_MACADDR4_Msk          (0xfful << EMAC_CAM4M_MACADDR4_Pos)               /*!< EMAC_T::CAM4M: MACADDR4 Mask           */
+
+#define EMAC_CAM4M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM4M: MACADDR5 Position       */
+#define EMAC_CAM4M_MACADDR5_Msk          (0xfful << EMAC_CAM4M_MACADDR5_Pos)               /*!< EMAC_T::CAM4M: MACADDR5 Mask           */
+
+#define EMAC_CAM4L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM4L: MACADDR0 Position       */
+#define EMAC_CAM4L_MACADDR0_Msk          (0xfful << EMAC_CAM4L_MACADDR0_Pos)               /*!< EMAC_T::CAM4L: MACADDR0 Mask           */
+
+#define EMAC_CAM4L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM4L: MACADDR1 Position       */
+#define EMAC_CAM4L_MACADDR1_Msk          (0xfful << EMAC_CAM4L_MACADDR1_Pos)               /*!< EMAC_T::CAM4L: MACADDR1 Mask           */
+
+#define EMAC_CAM5M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM5M: MACADDR2 Position       */
+#define EMAC_CAM5M_MACADDR2_Msk          (0xfful << EMAC_CAM5M_MACADDR2_Pos)               /*!< EMAC_T::CAM5M: MACADDR2 Mask           */
+
+#define EMAC_CAM5M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM5M: MACADDR3 Position       */
+#define EMAC_CAM5M_MACADDR3_Msk          (0xfful << EMAC_CAM5M_MACADDR3_Pos)               /*!< EMAC_T::CAM5M: MACADDR3 Mask           */
+
+#define EMAC_CAM5M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM5M: MACADDR4 Position       */
+#define EMAC_CAM5M_MACADDR4_Msk          (0xfful << EMAC_CAM5M_MACADDR4_Pos)               /*!< EMAC_T::CAM5M: MACADDR4 Mask           */
+
+#define EMAC_CAM5M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM5M: MACADDR5 Position       */
+#define EMAC_CAM5M_MACADDR5_Msk          (0xfful << EMAC_CAM5M_MACADDR5_Pos)               /*!< EMAC_T::CAM5M: MACADDR5 Mask           */
+
+#define EMAC_CAM5L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM5L: MACADDR0 Position       */
+#define EMAC_CAM5L_MACADDR0_Msk          (0xfful << EMAC_CAM5L_MACADDR0_Pos)               /*!< EMAC_T::CAM5L: MACADDR0 Mask           */
+
+#define EMAC_CAM5L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM5L: MACADDR1 Position       */
+#define EMAC_CAM5L_MACADDR1_Msk          (0xfful << EMAC_CAM5L_MACADDR1_Pos)               /*!< EMAC_T::CAM5L: MACADDR1 Mask           */
+
+#define EMAC_CAM6M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM6M: MACADDR2 Position       */
+#define EMAC_CAM6M_MACADDR2_Msk          (0xfful << EMAC_CAM6M_MACADDR2_Pos)               /*!< EMAC_T::CAM6M: MACADDR2 Mask           */
+
+#define EMAC_CAM6M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM6M: MACADDR3 Position       */
+#define EMAC_CAM6M_MACADDR3_Msk          (0xfful << EMAC_CAM6M_MACADDR3_Pos)               /*!< EMAC_T::CAM6M: MACADDR3 Mask           */
+
+#define EMAC_CAM6M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM6M: MACADDR4 Position       */
+#define EMAC_CAM6M_MACADDR4_Msk          (0xfful << EMAC_CAM6M_MACADDR4_Pos)               /*!< EMAC_T::CAM6M: MACADDR4 Mask           */
+
+#define EMAC_CAM6M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM6M: MACADDR5 Position       */
+#define EMAC_CAM6M_MACADDR5_Msk          (0xfful << EMAC_CAM6M_MACADDR5_Pos)               /*!< EMAC_T::CAM6M: MACADDR5 Mask           */
+
+#define EMAC_CAM6L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM6L: MACADDR0 Position       */
+#define EMAC_CAM6L_MACADDR0_Msk          (0xfful << EMAC_CAM6L_MACADDR0_Pos)               /*!< EMAC_T::CAM6L: MACADDR0 Mask           */
+
+#define EMAC_CAM6L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM6L: MACADDR1 Position       */
+#define EMAC_CAM6L_MACADDR1_Msk          (0xfful << EMAC_CAM6L_MACADDR1_Pos)               /*!< EMAC_T::CAM6L: MACADDR1 Mask           */
+
+#define EMAC_CAM7M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM7M: MACADDR2 Position       */
+#define EMAC_CAM7M_MACADDR2_Msk          (0xfful << EMAC_CAM7M_MACADDR2_Pos)               /*!< EMAC_T::CAM7M: MACADDR2 Mask           */
+
+#define EMAC_CAM7M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM7M: MACADDR3 Position       */
+#define EMAC_CAM7M_MACADDR3_Msk          (0xfful << EMAC_CAM7M_MACADDR3_Pos)               /*!< EMAC_T::CAM7M: MACADDR3 Mask           */
+
+#define EMAC_CAM7M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM7M: MACADDR4 Position       */
+#define EMAC_CAM7M_MACADDR4_Msk          (0xfful << EMAC_CAM7M_MACADDR4_Pos)               /*!< EMAC_T::CAM7M: MACADDR4 Mask           */
+
+#define EMAC_CAM7M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM7M: MACADDR5 Position       */
+#define EMAC_CAM7M_MACADDR5_Msk          (0xfful << EMAC_CAM7M_MACADDR5_Pos)               /*!< EMAC_T::CAM7M: MACADDR5 Mask           */
+
+#define EMAC_CAM7L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM7L: MACADDR0 Position       */
+#define EMAC_CAM7L_MACADDR0_Msk          (0xfful << EMAC_CAM7L_MACADDR0_Pos)               /*!< EMAC_T::CAM7L: MACADDR0 Mask           */
+
+#define EMAC_CAM7L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM7L: MACADDR1 Position       */
+#define EMAC_CAM7L_MACADDR1_Msk          (0xfful << EMAC_CAM7L_MACADDR1_Pos)               /*!< EMAC_T::CAM7L: MACADDR1 Mask           */
+
+#define EMAC_CAM8M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM8M: MACADDR2 Position       */
+#define EMAC_CAM8M_MACADDR2_Msk          (0xfful << EMAC_CAM8M_MACADDR2_Pos)               /*!< EMAC_T::CAM8M: MACADDR2 Mask           */
+
+#define EMAC_CAM8M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM8M: MACADDR3 Position       */
+#define EMAC_CAM8M_MACADDR3_Msk          (0xfful << EMAC_CAM8M_MACADDR3_Pos)               /*!< EMAC_T::CAM8M: MACADDR3 Mask           */
+
+#define EMAC_CAM8M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM8M: MACADDR4 Position       */
+#define EMAC_CAM8M_MACADDR4_Msk          (0xfful << EMAC_CAM8M_MACADDR4_Pos)               /*!< EMAC_T::CAM8M: MACADDR4 Mask           */
+
+#define EMAC_CAM8M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM8M: MACADDR5 Position       */
+#define EMAC_CAM8M_MACADDR5_Msk          (0xfful << EMAC_CAM8M_MACADDR5_Pos)               /*!< EMAC_T::CAM8M: MACADDR5 Mask           */
+
+#define EMAC_CAM8L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM8L: MACADDR0 Position       */
+#define EMAC_CAM8L_MACADDR0_Msk          (0xfful << EMAC_CAM8L_MACADDR0_Pos)               /*!< EMAC_T::CAM8L: MACADDR0 Mask           */
+
+#define EMAC_CAM8L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM8L: MACADDR1 Position       */
+#define EMAC_CAM8L_MACADDR1_Msk          (0xfful << EMAC_CAM8L_MACADDR1_Pos)               /*!< EMAC_T::CAM8L: MACADDR1 Mask           */
+
+#define EMAC_CAM9M_MACADDR2_Pos          (0)                                               /*!< EMAC_T::CAM9M: MACADDR2 Position       */
+#define EMAC_CAM9M_MACADDR2_Msk          (0xfful << EMAC_CAM9M_MACADDR2_Pos)               /*!< EMAC_T::CAM9M: MACADDR2 Mask           */
+
+#define EMAC_CAM9M_MACADDR3_Pos          (8)                                               /*!< EMAC_T::CAM9M: MACADDR3 Position       */
+#define EMAC_CAM9M_MACADDR3_Msk          (0xfful << EMAC_CAM9M_MACADDR3_Pos)               /*!< EMAC_T::CAM9M: MACADDR3 Mask           */
+
+#define EMAC_CAM9M_MACADDR4_Pos          (16)                                              /*!< EMAC_T::CAM9M: MACADDR4 Position       */
+#define EMAC_CAM9M_MACADDR4_Msk          (0xfful << EMAC_CAM9M_MACADDR4_Pos)               /*!< EMAC_T::CAM9M: MACADDR4 Mask           */
+
+#define EMAC_CAM9M_MACADDR5_Pos          (24)                                              /*!< EMAC_T::CAM9M: MACADDR5 Position       */
+#define EMAC_CAM9M_MACADDR5_Msk          (0xfful << EMAC_CAM9M_MACADDR5_Pos)               /*!< EMAC_T::CAM9M: MACADDR5 Mask           */
+
+#define EMAC_CAM9L_MACADDR0_Pos          (16)                                              /*!< EMAC_T::CAM9L: MACADDR0 Position       */
+#define EMAC_CAM9L_MACADDR0_Msk          (0xfful << EMAC_CAM9L_MACADDR0_Pos)               /*!< EMAC_T::CAM9L: MACADDR0 Mask           */
+
+#define EMAC_CAM9L_MACADDR1_Pos          (24)                                              /*!< EMAC_T::CAM9L: MACADDR1 Position       */
+#define EMAC_CAM9L_MACADDR1_Msk          (0xfful << EMAC_CAM9L_MACADDR1_Pos)               /*!< EMAC_T::CAM9L: MACADDR1 Mask           */
+
+#define EMAC_CAM10M_MACADDR2_Pos         (0)                                               /*!< EMAC_T::CAM10M: MACADDR2 Position      */
+#define EMAC_CAM10M_MACADDR2_Msk         (0xfful << EMAC_CAM10M_MACADDR2_Pos)              /*!< EMAC_T::CAM10M: MACADDR2 Mask          */
+
+#define EMAC_CAM10M_MACADDR3_Pos         (8)                                               /*!< EMAC_T::CAM10M: MACADDR3 Position      */
+#define EMAC_CAM10M_MACADDR3_Msk         (0xfful << EMAC_CAM10M_MACADDR3_Pos)              /*!< EMAC_T::CAM10M: MACADDR3 Mask          */
+
+#define EMAC_CAM10M_MACADDR4_Pos         (16)                                              /*!< EMAC_T::CAM10M: MACADDR4 Position      */
+#define EMAC_CAM10M_MACADDR4_Msk         (0xfful << EMAC_CAM10M_MACADDR4_Pos)              /*!< EMAC_T::CAM10M: MACADDR4 Mask          */
+
+#define EMAC_CAM10M_MACADDR5_Pos         (24)                                              /*!< EMAC_T::CAM10M: MACADDR5 Position      */
+#define EMAC_CAM10M_MACADDR5_Msk         (0xfful << EMAC_CAM10M_MACADDR5_Pos)              /*!< EMAC_T::CAM10M: MACADDR5 Mask          */
+
+#define EMAC_CAM10L_MACADDR0_Pos         (16)                                              /*!< EMAC_T::CAM10L: MACADDR0 Position      */
+#define EMAC_CAM10L_MACADDR0_Msk         (0xfful << EMAC_CAM10L_MACADDR0_Pos)              /*!< EMAC_T::CAM10L: MACADDR0 Mask          */
+
+#define EMAC_CAM10L_MACADDR1_Pos         (24)                                              /*!< EMAC_T::CAM10L: MACADDR1 Position      */
+#define EMAC_CAM10L_MACADDR1_Msk         (0xfful << EMAC_CAM10L_MACADDR1_Pos)              /*!< EMAC_T::CAM10L: MACADDR1 Mask          */
+
+#define EMAC_CAM11M_MACADDR2_Pos         (0)                                               /*!< EMAC_T::CAM11M: MACADDR2 Position      */
+#define EMAC_CAM11M_MACADDR2_Msk         (0xfful << EMAC_CAM11M_MACADDR2_Pos)              /*!< EMAC_T::CAM11M: MACADDR2 Mask          */
+
+#define EMAC_CAM11M_MACADDR3_Pos         (8)                                               /*!< EMAC_T::CAM11M: MACADDR3 Position      */
+#define EMAC_CAM11M_MACADDR3_Msk         (0xfful << EMAC_CAM11M_MACADDR3_Pos)              /*!< EMAC_T::CAM11M: MACADDR3 Mask          */
+
+#define EMAC_CAM11M_MACADDR4_Pos         (16)                                              /*!< EMAC_T::CAM11M: MACADDR4 Position      */
+#define EMAC_CAM11M_MACADDR4_Msk         (0xfful << EMAC_CAM11M_MACADDR4_Pos)              /*!< EMAC_T::CAM11M: MACADDR4 Mask          */
+
+#define EMAC_CAM11M_MACADDR5_Pos         (24)                                              /*!< EMAC_T::CAM11M: MACADDR5 Position      */
+#define EMAC_CAM11M_MACADDR5_Msk         (0xfful << EMAC_CAM11M_MACADDR5_Pos)              /*!< EMAC_T::CAM11M: MACADDR5 Mask          */
+
+#define EMAC_CAM11L_MACADDR0_Pos         (16)                                              /*!< EMAC_T::CAM11L: MACADDR0 Position      */
+#define EMAC_CAM11L_MACADDR0_Msk         (0xfful << EMAC_CAM11L_MACADDR0_Pos)              /*!< EMAC_T::CAM11L: MACADDR0 Mask          */
+
+#define EMAC_CAM11L_MACADDR1_Pos         (24)                                              /*!< EMAC_T::CAM11L: MACADDR1 Position      */
+#define EMAC_CAM11L_MACADDR1_Msk         (0xfful << EMAC_CAM11L_MACADDR1_Pos)              /*!< EMAC_T::CAM11L: MACADDR1 Mask          */
+
+#define EMAC_CAM12M_MACADDR2_Pos         (0)                                               /*!< EMAC_T::CAM12M: MACADDR2 Position      */
+#define EMAC_CAM12M_MACADDR2_Msk         (0xfful << EMAC_CAM12M_MACADDR2_Pos)              /*!< EMAC_T::CAM12M: MACADDR2 Mask          */
+
+#define EMAC_CAM12M_MACADDR3_Pos         (8)                                               /*!< EMAC_T::CAM12M: MACADDR3 Position      */
+#define EMAC_CAM12M_MACADDR3_Msk         (0xfful << EMAC_CAM12M_MACADDR3_Pos)              /*!< EMAC_T::CAM12M: MACADDR3 Mask          */
+
+#define EMAC_CAM12M_MACADDR4_Pos         (16)                                              /*!< EMAC_T::CAM12M: MACADDR4 Position      */
+#define EMAC_CAM12M_MACADDR4_Msk         (0xfful << EMAC_CAM12M_MACADDR4_Pos)              /*!< EMAC_T::CAM12M: MACADDR4 Mask          */
+
+#define EMAC_CAM12M_MACADDR5_Pos         (24)                                              /*!< EMAC_T::CAM12M: MACADDR5 Position      */
+#define EMAC_CAM12M_MACADDR5_Msk         (0xfful << EMAC_CAM12M_MACADDR5_Pos)              /*!< EMAC_T::CAM12M: MACADDR5 Mask          */
+
+#define EMAC_CAM12L_MACADDR0_Pos         (16)                                              /*!< EMAC_T::CAM12L: MACADDR0 Position      */
+#define EMAC_CAM12L_MACADDR0_Msk         (0xfful << EMAC_CAM12L_MACADDR0_Pos)              /*!< EMAC_T::CAM12L: MACADDR0 Mask          */
+
+#define EMAC_CAM12L_MACADDR1_Pos         (24)                                              /*!< EMAC_T::CAM12L: MACADDR1 Position      */
+#define EMAC_CAM12L_MACADDR1_Msk         (0xfful << EMAC_CAM12L_MACADDR1_Pos)              /*!< EMAC_T::CAM12L: MACADDR1 Mask          */
+
+#define EMAC_CAM13M_MACADDR2_Pos         (0)                                               /*!< EMAC_T::CAM13M: MACADDR2 Position      */
+#define EMAC_CAM13M_MACADDR2_Msk         (0xfful << EMAC_CAM13M_MACADDR2_Pos)              /*!< EMAC_T::CAM13M: MACADDR2 Mask          */
+
+#define EMAC_CAM13M_MACADDR3_Pos         (8)                                               /*!< EMAC_T::CAM13M: MACADDR3 Position      */
+#define EMAC_CAM13M_MACADDR3_Msk         (0xfful << EMAC_CAM13M_MACADDR3_Pos)              /*!< EMAC_T::CAM13M: MACADDR3 Mask          */
+
+#define EMAC_CAM13M_MACADDR4_Pos         (16)                                              /*!< EMAC_T::CAM13M: MACADDR4 Position      */
+#define EMAC_CAM13M_MACADDR4_Msk         (0xfful << EMAC_CAM13M_MACADDR4_Pos)              /*!< EMAC_T::CAM13M: MACADDR4 Mask          */
+
+#define EMAC_CAM13M_MACADDR5_Pos         (24)                                              /*!< EMAC_T::CAM13M: MACADDR5 Position      */
+#define EMAC_CAM13M_MACADDR5_Msk         (0xfful << EMAC_CAM13M_MACADDR5_Pos)              /*!< EMAC_T::CAM13M: MACADDR5 Mask          */
+
+#define EMAC_CAM13L_MACADDR0_Pos         (16)                                              /*!< EMAC_T::CAM13L: MACADDR0 Position      */
+#define EMAC_CAM13L_MACADDR0_Msk         (0xfful << EMAC_CAM13L_MACADDR0_Pos)              /*!< EMAC_T::CAM13L: MACADDR0 Mask          */
+
+#define EMAC_CAM13L_MACADDR1_Pos         (24)                                              /*!< EMAC_T::CAM13L: MACADDR1 Position      */
+#define EMAC_CAM13L_MACADDR1_Msk         (0xfful << EMAC_CAM13L_MACADDR1_Pos)              /*!< EMAC_T::CAM13L: MACADDR1 Mask          */
+
+#define EMAC_CAM14M_MACADDR2_Pos         (0)                                               /*!< EMAC_T::CAM14M: MACADDR2 Position      */
+#define EMAC_CAM14M_MACADDR2_Msk         (0xfful << EMAC_CAM14M_MACADDR2_Pos)              /*!< EMAC_T::CAM14M: MACADDR2 Mask          */
+
+#define EMAC_CAM14M_MACADDR3_Pos         (8)                                               /*!< EMAC_T::CAM14M: MACADDR3 Position      */
+#define EMAC_CAM14M_MACADDR3_Msk         (0xfful << EMAC_CAM14M_MACADDR3_Pos)              /*!< EMAC_T::CAM14M: MACADDR3 Mask          */
+
+#define EMAC_CAM14M_MACADDR4_Pos         (16)                                              /*!< EMAC_T::CAM14M: MACADDR4 Position      */
+#define EMAC_CAM14M_MACADDR4_Msk         (0xfful << EMAC_CAM14M_MACADDR4_Pos)              /*!< EMAC_T::CAM14M: MACADDR4 Mask          */
+
+#define EMAC_CAM14M_MACADDR5_Pos         (24)                                              /*!< EMAC_T::CAM14M: MACADDR5 Position      */
+#define EMAC_CAM14M_MACADDR5_Msk         (0xfful << EMAC_CAM14M_MACADDR5_Pos)              /*!< EMAC_T::CAM14M: MACADDR5 Mask          */
+
+#define EMAC_CAM14L_MACADDR0_Pos         (16)                                              /*!< EMAC_T::CAM14L: MACADDR0 Position      */
+#define EMAC_CAM14L_MACADDR0_Msk         (0xfful << EMAC_CAM14L_MACADDR0_Pos)              /*!< EMAC_T::CAM14L: MACADDR0 Mask          */
+
+#define EMAC_CAM14L_MACADDR1_Pos         (24)                                              /*!< EMAC_T::CAM14L: MACADDR1 Position      */
+#define EMAC_CAM14L_MACADDR1_Msk         (0xfful << EMAC_CAM14L_MACADDR1_Pos)              /*!< EMAC_T::CAM14L: MACADDR1 Mask          */
+
+#define EMAC_CAM15MSB_OPCODE_Pos         (0)                                               /*!< EMAC_T::CAM15MSB: OPCODE Position      */
+#define EMAC_CAM15MSB_OPCODE_Msk         (0xfffful << EMAC_CAM15MSB_OPCODE_Pos)            /*!< EMAC_T::CAM15MSB: OPCODE Mask          */
+
+#define EMAC_CAM15MSB_LENGTH_Pos         (16)                                              /*!< EMAC_T::CAM15MSB: LENGTH Position      */
+#define EMAC_CAM15MSB_LENGTH_Msk         (0xfffful << EMAC_CAM15MSB_LENGTH_Pos)            /*!< EMAC_T::CAM15MSB: LENGTH Mask          */
+
+#define EMAC_CAM15LSB_OPERAND_Pos        (24)                                              /*!< EMAC_T::CAM15LSB: OPERAND Position     */
+#define EMAC_CAM15LSB_OPERAND_Msk        (0xfful << EMAC_CAM15LSB_OPERAND_Pos)             /*!< EMAC_T::CAM15LSB: OPERAND Mask         */
+
+#define EMAC_TXDSA_TXDSA_Pos             (0)                                               /*!< EMAC_T::TXDSA: TXDSA Position          */
+#define EMAC_TXDSA_TXDSA_Msk             (0xfffffffful << EMAC_TXDSA_TXDSA_Pos)            /*!< EMAC_T::TXDSA: TXDSA Mask              */
+
+#define EMAC_RXDSA_RXDSA_Pos             (0)                                               /*!< EMAC_T::RXDSA: RXDSA Position          */
+#define EMAC_RXDSA_RXDSA_Msk             (0xfffffffful << EMAC_RXDSA_RXDSA_Pos)            /*!< EMAC_T::RXDSA: RXDSA Mask              */
+
+#define EMAC_CTL_RXON_Pos                (0)                                               /*!< EMAC_T::CTL: RXON Position             */
+#define EMAC_CTL_RXON_Msk                (0x1ul << EMAC_CTL_RXON_Pos)                      /*!< EMAC_T::CTL: RXON Mask                 */
+
+#define EMAC_CTL_ALP_Pos                 (1)                                               /*!< EMAC_T::CTL: ALP Position              */
+#define EMAC_CTL_ALP_Msk                 (0x1ul << EMAC_CTL_ALP_Pos)                       /*!< EMAC_T::CTL: ALP Mask                  */
+
+#define EMAC_CTL_ARP_Pos                 (2)                                               /*!< EMAC_T::CTL: ARP Position              */
+#define EMAC_CTL_ARP_Msk                 (0x1ul << EMAC_CTL_ARP_Pos)                       /*!< EMAC_T::CTL: ARP Mask                  */
+
+#define EMAC_CTL_ACP_Pos                 (3)                                               /*!< EMAC_T::CTL: ACP Position              */
+#define EMAC_CTL_ACP_Msk                 (0x1ul << EMAC_CTL_ACP_Pos)                       /*!< EMAC_T::CTL: ACP Mask                  */
+
+#define EMAC_CTL_AEP_Pos                 (4)                                               /*!< EMAC_T::CTL: AEP Position              */
+#define EMAC_CTL_AEP_Msk                 (0x1ul << EMAC_CTL_AEP_Pos)                       /*!< EMAC_T::CTL: AEP Mask                  */
+
+#define EMAC_CTL_STRIPCRC_Pos            (5)                                               /*!< EMAC_T::CTL: STRIPCRC Position         */
+#define EMAC_CTL_STRIPCRC_Msk            (0x1ul << EMAC_CTL_STRIPCRC_Pos)                  /*!< EMAC_T::CTL: STRIPCRC Mask             */
+
+#define EMAC_CTL_WOLEN_Pos               (6)                                               /*!< EMAC_T::CTL: WOLEN Position            */
+#define EMAC_CTL_WOLEN_Msk               (0x1ul << EMAC_CTL_WOLEN_Pos)                     /*!< EMAC_T::CTL: WOLEN Mask                */
+
+#define EMAC_CTL_TXON_Pos                (8)                                               /*!< EMAC_T::CTL: TXON Position             */
+#define EMAC_CTL_TXON_Msk                (0x1ul << EMAC_CTL_TXON_Pos)                      /*!< EMAC_T::CTL: TXON Mask                 */
+
+#define EMAC_CTL_NODEF_Pos               (9)                                               /*!< EMAC_T::CTL: NODEF Position            */
+#define EMAC_CTL_NODEF_Msk               (0x1ul << EMAC_CTL_NODEF_Pos)                     /*!< EMAC_T::CTL: NODEF Mask                */
+
+#define EMAC_CTL_SDPZ_Pos                (16)                                              /*!< EMAC_T::CTL: SDPZ Position             */
+#define EMAC_CTL_SDPZ_Msk                (0x1ul << EMAC_CTL_SDPZ_Pos)                      /*!< EMAC_T::CTL: SDPZ Mask                 */
+
+#define EMAC_CTL_SQECHKEN_Pos            (17)                                              /*!< EMAC_T::CTL: SQECHKEN Position         */
+#define EMAC_CTL_SQECHKEN_Msk            (0x1ul << EMAC_CTL_SQECHKEN_Pos)                  /*!< EMAC_T::CTL: SQECHKEN Mask             */
+
+#define EMAC_CTL_FUDUP_Pos               (18)                                              /*!< EMAC_T::CTL: FUDUP Position            */
+#define EMAC_CTL_FUDUP_Msk               (0x1ul << EMAC_CTL_FUDUP_Pos)                     /*!< EMAC_T::CTL: FUDUP Mask                */
+
+#define EMAC_CTL_RMIIRXCTL_Pos           (19)                                              /*!< EMAC_T::CTL: RMIIRXCTL Position        */
+#define EMAC_CTL_RMIIRXCTL_Msk           (0x1ul << EMAC_CTL_RMIIRXCTL_Pos)                 /*!< EMAC_T::CTL: RMIIRXCTL Mask            */
+
+#define EMAC_CTL_OPMODE_Pos              (20)                                              /*!< EMAC_T::CTL: OPMODE Position           */
+#define EMAC_CTL_OPMODE_Msk              (0x1ul << EMAC_CTL_OPMODE_Pos)                    /*!< EMAC_T::CTL: OPMODE Mask               */
+
+#define EMAC_CTL_RMIIEN_Pos              (22)                                              /*!< EMAC_T::CTL: RMIIEN Position           */
+#define EMAC_CTL_RMIIEN_Msk              (0x1ul << EMAC_CTL_RMIIEN_Pos)                    /*!< EMAC_T::CTL: RMIIEN Mask               */
+
+#define EMAC_CTL_RST_Pos                 (24)                                              /*!< EMAC_T::CTL: RST Position              */
+#define EMAC_CTL_RST_Msk                 (0x1ul << EMAC_CTL_RST_Pos)                       /*!< EMAC_T::CTL: RST Mask                  */
+
+#define EMAC_MIIMDAT_DATA_Pos            (0)                                               /*!< EMAC_T::MIIMDAT: DATA Position         */
+#define EMAC_MIIMDAT_DATA_Msk            (0xfffful << EMAC_MIIMDAT_DATA_Pos)               /*!< EMAC_T::MIIMDAT: DATA Mask             */
+
+#define EMAC_MIIMCTL_PHYREG_Pos          (0)                                               /*!< EMAC_T::MIIMCTL: PHYREG Position       */
+#define EMAC_MIIMCTL_PHYREG_Msk          (0x1ful << EMAC_MIIMCTL_PHYREG_Pos)               /*!< EMAC_T::MIIMCTL: PHYREG Mask           */
+
+#define EMAC_MIIMCTL_PHYADDR_Pos         (8)                                               /*!< EMAC_T::MIIMCTL: PHYADDR Position      */
+#define EMAC_MIIMCTL_PHYADDR_Msk         (0x1ful << EMAC_MIIMCTL_PHYADDR_Pos)              /*!< EMAC_T::MIIMCTL: PHYADDR Mask          */
+
+#define EMAC_MIIMCTL_WRITE_Pos           (16)                                              /*!< EMAC_T::MIIMCTL: WRITE Position        */
+#define EMAC_MIIMCTL_WRITE_Msk           (0x1ul << EMAC_MIIMCTL_WRITE_Pos)                 /*!< EMAC_T::MIIMCTL: WRITE Mask            */
+
+#define EMAC_MIIMCTL_BUSY_Pos            (17)                                              /*!< EMAC_T::MIIMCTL: BUSY Position         */
+#define EMAC_MIIMCTL_BUSY_Msk            (0x1ul << EMAC_MIIMCTL_BUSY_Pos)                  /*!< EMAC_T::MIIMCTL: BUSY Mask             */
+
+#define EMAC_MIIMCTL_PREAMSP_Pos         (18)                                              /*!< EMAC_T::MIIMCTL: PREAMSP Position      */
+#define EMAC_MIIMCTL_PREAMSP_Msk         (0x1ul << EMAC_MIIMCTL_PREAMSP_Pos)               /*!< EMAC_T::MIIMCTL: PREAMSP Mask          */
+
+#define EMAC_MIIMCTL_MDCON_Pos           (19)                                              /*!< EMAC_T::MIIMCTL: MDCON Position        */
+#define EMAC_MIIMCTL_MDCON_Msk           (0x1ul << EMAC_MIIMCTL_MDCON_Pos)                 /*!< EMAC_T::MIIMCTL: MDCON Mask            */
+
+#define EMAC_FIFOCTL_RXFIFOTH_Pos        (0)                                               /*!< EMAC_T::FIFOCTL: RXFIFOTH Position     */
+#define EMAC_FIFOCTL_RXFIFOTH_Msk        (0x3ul << EMAC_FIFOCTL_RXFIFOTH_Pos)              /*!< EMAC_T::FIFOCTL: RXFIFOTH Mask         */
+
+#define EMAC_FIFOCTL_TXFIFOTH_Pos        (8)                                               /*!< EMAC_T::FIFOCTL: TXFIFOTH Position     */
+#define EMAC_FIFOCTL_TXFIFOTH_Msk        (0x3ul << EMAC_FIFOCTL_TXFIFOTH_Pos)              /*!< EMAC_T::FIFOCTL: TXFIFOTH Mask         */
+
+#define EMAC_FIFOCTL_BURSTLEN_Pos        (20)                                              /*!< EMAC_T::FIFOCTL: BURSTLEN Position     */
+#define EMAC_FIFOCTL_BURSTLEN_Msk        (0x3ul << EMAC_FIFOCTL_BURSTLEN_Pos)              /*!< EMAC_T::FIFOCTL: BURSTLEN Mask         */
+
+#define EMAC_TXST_TXST_Pos               (0)                                               /*!< EMAC_T::TXST: TXST Position            */
+#define EMAC_TXST_TXST_Msk               (0xfffffffful << EMAC_TXST_TXST_Pos)              /*!< EMAC_T::TXST: TXST Mask                */
+
+#define EMAC_RXST_RXST_Pos               (0)                                               /*!< EMAC_T::RXST: RXST Position            */
+#define EMAC_RXST_RXST_Msk               (0xfffffffful << EMAC_RXST_RXST_Pos)              /*!< EMAC_T::RXST: RXST Mask                */
+
+#define EMAC_MRFL_MRFL_Pos               (0)                                               /*!< EMAC_T::MRFL: MRFL Position            */
+#define EMAC_MRFL_MRFL_Msk               (0xfffful << EMAC_MRFL_MRFL_Pos)                  /*!< EMAC_T::MRFL: MRFL Mask                */
+
+#define EMAC_INTEN_RXIEN_Pos             (0)                                               /*!< EMAC_T::INTEN: RXIEN Position          */
+#define EMAC_INTEN_RXIEN_Msk             (0x1ul << EMAC_INTEN_RXIEN_Pos)                   /*!< EMAC_T::INTEN: RXIEN Mask              */
+
+#define EMAC_INTEN_CRCEIEN_Pos           (1)                                               /*!< EMAC_T::INTEN: CRCEIEN Position        */
+#define EMAC_INTEN_CRCEIEN_Msk           (0x1ul << EMAC_INTEN_CRCEIEN_Pos)                 /*!< EMAC_T::INTEN: CRCEIEN Mask            */
+
+#define EMAC_INTEN_RXOVIEN_Pos           (2)                                               /*!< EMAC_T::INTEN: RXOVIEN Position        */
+#define EMAC_INTEN_RXOVIEN_Msk           (0x1ul << EMAC_INTEN_RXOVIEN_Pos)                 /*!< EMAC_T::INTEN: RXOVIEN Mask            */
+
+#define EMAC_INTEN_LPIEN_Pos             (3)                                               /*!< EMAC_T::INTEN: LPIEN Position          */
+#define EMAC_INTEN_LPIEN_Msk             (0x1ul << EMAC_INTEN_LPIEN_Pos)                   /*!< EMAC_T::INTEN: LPIEN Mask              */
+
+#define EMAC_INTEN_RXGDIEN_Pos           (4)                                               /*!< EMAC_T::INTEN: RXGDIEN Position        */
+#define EMAC_INTEN_RXGDIEN_Msk           (0x1ul << EMAC_INTEN_RXGDIEN_Pos)                 /*!< EMAC_T::INTEN: RXGDIEN Mask            */
+
+#define EMAC_INTEN_ALIEIEN_Pos           (5)                                               /*!< EMAC_T::INTEN: ALIEIEN Position        */
+#define EMAC_INTEN_ALIEIEN_Msk           (0x1ul << EMAC_INTEN_ALIEIEN_Pos)                 /*!< EMAC_T::INTEN: ALIEIEN Mask            */
+
+#define EMAC_INTEN_RPIEN_Pos             (6)                                               /*!< EMAC_T::INTEN: RPIEN Position          */
+#define EMAC_INTEN_RPIEN_Msk             (0x1ul << EMAC_INTEN_RPIEN_Pos)                   /*!< EMAC_T::INTEN: RPIEN Mask              */
+
+#define EMAC_INTEN_MPCOVIEN_Pos          (7)                                               /*!< EMAC_T::INTEN: MPCOVIEN Position       */
+#define EMAC_INTEN_MPCOVIEN_Msk          (0x1ul << EMAC_INTEN_MPCOVIEN_Pos)                /*!< EMAC_T::INTEN: MPCOVIEN Mask           */
+
+#define EMAC_INTEN_MFLEIEN_Pos           (8)                                               /*!< EMAC_T::INTEN: MFLEIEN Position        */
+#define EMAC_INTEN_MFLEIEN_Msk           (0x1ul << EMAC_INTEN_MFLEIEN_Pos)                 /*!< EMAC_T::INTEN: MFLEIEN Mask            */
+
+#define EMAC_INTEN_DENIEN_Pos            (9)                                               /*!< EMAC_T::INTEN: DENIEN Position         */
+#define EMAC_INTEN_DENIEN_Msk            (0x1ul << EMAC_INTEN_DENIEN_Pos)                  /*!< EMAC_T::INTEN: DENIEN Mask             */
+
+#define EMAC_INTEN_RDUIEN_Pos            (10)                                              /*!< EMAC_T::INTEN: RDUIEN Position         */
+#define EMAC_INTEN_RDUIEN_Msk            (0x1ul << EMAC_INTEN_RDUIEN_Pos)                  /*!< EMAC_T::INTEN: RDUIEN Mask             */
+
+#define EMAC_INTEN_RXBEIEN_Pos           (11)                                              /*!< EMAC_T::INTEN: RXBEIEN Position        */
+#define EMAC_INTEN_RXBEIEN_Msk           (0x1ul << EMAC_INTEN_RXBEIEN_Pos)                 /*!< EMAC_T::INTEN: RXBEIEN Mask            */
+
+#define EMAC_INTEN_CFRIEN_Pos            (14)                                              /*!< EMAC_T::INTEN: CFRIEN Position         */
+#define EMAC_INTEN_CFRIEN_Msk            (0x1ul << EMAC_INTEN_CFRIEN_Pos)                  /*!< EMAC_T::INTEN: CFRIEN Mask             */
+
+#define EMAC_INTEN_WOLIEN_Pos            (15)                                              /*!< EMAC_T::INTEN: WOLIEN Position         */
+#define EMAC_INTEN_WOLIEN_Msk            (0x1ul << EMAC_INTEN_WOLIEN_Pos)                  /*!< EMAC_T::INTEN: WOLIEN Mask             */
+
+#define EMAC_INTEN_TXIEN_Pos             (16)                                              /*!< EMAC_T::INTEN: TXIEN Position          */
+#define EMAC_INTEN_TXIEN_Msk             (0x1ul << EMAC_INTEN_TXIEN_Pos)                   /*!< EMAC_T::INTEN: TXIEN Mask              */
+
+#define EMAC_INTEN_TXUDIEN_Pos           (17)                                              /*!< EMAC_T::INTEN: TXUDIEN Position        */
+#define EMAC_INTEN_TXUDIEN_Msk           (0x1ul << EMAC_INTEN_TXUDIEN_Pos)                 /*!< EMAC_T::INTEN: TXUDIEN Mask            */
+
+#define EMAC_INTEN_TXCPIEN_Pos           (18)                                              /*!< EMAC_T::INTEN: TXCPIEN Position        */
+#define EMAC_INTEN_TXCPIEN_Msk           (0x1ul << EMAC_INTEN_TXCPIEN_Pos)                 /*!< EMAC_T::INTEN: TXCPIEN Mask            */
+
+#define EMAC_INTEN_EXDEFIEN_Pos          (19)                                              /*!< EMAC_T::INTEN: EXDEFIEN Position       */
+#define EMAC_INTEN_EXDEFIEN_Msk          (0x1ul << EMAC_INTEN_EXDEFIEN_Pos)                /*!< EMAC_T::INTEN: EXDEFIEN Mask           */
+
+#define EMAC_INTEN_NCSIEN_Pos            (20)                                              /*!< EMAC_T::INTEN: NCSIEN Position         */
+#define EMAC_INTEN_NCSIEN_Msk            (0x1ul << EMAC_INTEN_NCSIEN_Pos)                  /*!< EMAC_T::INTEN: NCSIEN Mask             */
+
+#define EMAC_INTEN_TXABTIEN_Pos          (21)                                              /*!< EMAC_T::INTEN: TXABTIEN Position       */
+#define EMAC_INTEN_TXABTIEN_Msk          (0x1ul << EMAC_INTEN_TXABTIEN_Pos)                /*!< EMAC_T::INTEN: TXABTIEN Mask           */
+
+#define EMAC_INTEN_LCIEN_Pos             (22)                                              /*!< EMAC_T::INTEN: LCIEN Position          */
+#define EMAC_INTEN_LCIEN_Msk             (0x1ul << EMAC_INTEN_LCIEN_Pos)                   /*!< EMAC_T::INTEN: LCIEN Mask              */
+
+#define EMAC_INTEN_TDUIEN_Pos            (23)                                              /*!< EMAC_T::INTEN: TDUIEN Position         */
+#define EMAC_INTEN_TDUIEN_Msk            (0x1ul << EMAC_INTEN_TDUIEN_Pos)                  /*!< EMAC_T::INTEN: TDUIEN Mask             */
+
+#define EMAC_INTEN_TXBEIEN_Pos           (24)                                              /*!< EMAC_T::INTEN: TXBEIEN Position        */
+#define EMAC_INTEN_TXBEIEN_Msk           (0x1ul << EMAC_INTEN_TXBEIEN_Pos)                 /*!< EMAC_T::INTEN: TXBEIEN Mask            */
+
+#define EMAC_INTEN_TSALMIEN_Pos          (28)                                              /*!< EMAC_T::INTEN: TSALMIEN Position       */
+#define EMAC_INTEN_TSALMIEN_Msk          (0x1ul << EMAC_INTEN_TSALMIEN_Pos)                /*!< EMAC_T::INTEN: TSALMIEN Mask           */
+
+#define EMAC_INTSTS_RXIF_Pos             (0)                                               /*!< EMAC_T::INTSTS: RXIF Position          */
+#define EMAC_INTSTS_RXIF_Msk             (0x1ul << EMAC_INTSTS_RXIF_Pos)                   /*!< EMAC_T::INTSTS: RXIF Mask              */
+
+#define EMAC_INTSTS_CRCEIF_Pos           (1)                                               /*!< EMAC_T::INTSTS: CRCEIF Position        */
+#define EMAC_INTSTS_CRCEIF_Msk           (0x1ul << EMAC_INTSTS_CRCEIF_Pos)                 /*!< EMAC_T::INTSTS: CRCEIF Mask            */
+
+#define EMAC_INTSTS_RXOVIF_Pos           (2)                                               /*!< EMAC_T::INTSTS: RXOVIF Position        */
+#define EMAC_INTSTS_RXOVIF_Msk           (0x1ul << EMAC_INTSTS_RXOVIF_Pos)                 /*!< EMAC_T::INTSTS: RXOVIF Mask            */
+
+#define EMAC_INTSTS_LPIF_Pos             (3)                                               /*!< EMAC_T::INTSTS: LPIF Position          */
+#define EMAC_INTSTS_LPIF_Msk             (0x1ul << EMAC_INTSTS_LPIF_Pos)                   /*!< EMAC_T::INTSTS: LPIF Mask              */
+
+#define EMAC_INTSTS_RXGDIF_Pos           (4)                                               /*!< EMAC_T::INTSTS: RXGDIF Position        */
+#define EMAC_INTSTS_RXGDIF_Msk           (0x1ul << EMAC_INTSTS_RXGDIF_Pos)                 /*!< EMAC_T::INTSTS: RXGDIF Mask            */
+
+#define EMAC_INTSTS_ALIEIF_Pos           (5)                                               /*!< EMAC_T::INTSTS: ALIEIF Position        */
+#define EMAC_INTSTS_ALIEIF_Msk           (0x1ul << EMAC_INTSTS_ALIEIF_Pos)                 /*!< EMAC_T::INTSTS: ALIEIF Mask            */
+
+#define EMAC_INTSTS_RPIF_Pos             (6)                                               /*!< EMAC_T::INTSTS: RPIF Position          */
+#define EMAC_INTSTS_RPIF_Msk             (0x1ul << EMAC_INTSTS_RPIF_Pos)                   /*!< EMAC_T::INTSTS: RPIF Mask              */
+
+#define EMAC_INTSTS_MPCOVIF_Pos          (7)                                               /*!< EMAC_T::INTSTS: MPCOVIF Position       */
+#define EMAC_INTSTS_MPCOVIF_Msk          (0x1ul << EMAC_INTSTS_MPCOVIF_Pos)                /*!< EMAC_T::INTSTS: MPCOVIF Mask           */
+
+#define EMAC_INTSTS_MFLEIF_Pos           (8)                                               /*!< EMAC_T::INTSTS: MFLEIF Position        */
+#define EMAC_INTSTS_MFLEIF_Msk           (0x1ul << EMAC_INTSTS_MFLEIF_Pos)                 /*!< EMAC_T::INTSTS: MFLEIF Mask            */
+
+#define EMAC_INTSTS_DENIF_Pos            (9)                                               /*!< EMAC_T::INTSTS: DENIF Position         */
+#define EMAC_INTSTS_DENIF_Msk            (0x1ul << EMAC_INTSTS_DENIF_Pos)                  /*!< EMAC_T::INTSTS: DENIF Mask             */
+
+#define EMAC_INTSTS_RDUIF_Pos            (10)                                              /*!< EMAC_T::INTSTS: RDUIF Position         */
+#define EMAC_INTSTS_RDUIF_Msk            (0x1ul << EMAC_INTSTS_RDUIF_Pos)                  /*!< EMAC_T::INTSTS: RDUIF Mask             */
+
+#define EMAC_INTSTS_RXBEIF_Pos           (11)                                              /*!< EMAC_T::INTSTS: RXBEIF Position        */
+#define EMAC_INTSTS_RXBEIF_Msk           (0x1ul << EMAC_INTSTS_RXBEIF_Pos)                 /*!< EMAC_T::INTSTS: RXBEIF Mask            */
+
+#define EMAC_INTSTS_CFRIF_Pos            (14)                                              /*!< EMAC_T::INTSTS: CFRIF Position         */
+#define EMAC_INTSTS_CFRIF_Msk            (0x1ul << EMAC_INTSTS_CFRIF_Pos)                  /*!< EMAC_T::INTSTS: CFRIF Mask             */
+
+#define EMAC_INTSTS_WOLIF_Pos            (15)                                              /*!< EMAC_T::INTSTS: WOLIF Position         */
+#define EMAC_INTSTS_WOLIF_Msk            (0x1ul << EMAC_INTSTS_WOLIF_Pos)                  /*!< EMAC_T::INTSTS: WOLIF Mask             */
+
+#define EMAC_INTSTS_TXIF_Pos             (16)                                              /*!< EMAC_T::INTSTS: TXIF Position          */
+#define EMAC_INTSTS_TXIF_Msk             (0x1ul << EMAC_INTSTS_TXIF_Pos)                   /*!< EMAC_T::INTSTS: TXIF Mask              */
+
+#define EMAC_INTSTS_TXUDIF_Pos           (17)                                              /*!< EMAC_T::INTSTS: TXUDIF Position        */
+#define EMAC_INTSTS_TXUDIF_Msk           (0x1ul << EMAC_INTSTS_TXUDIF_Pos)                 /*!< EMAC_T::INTSTS: TXUDIF Mask            */
+
+#define EMAC_INTSTS_TXCPIF_Pos           (18)                                              /*!< EMAC_T::INTSTS: TXCPIF Position        */
+#define EMAC_INTSTS_TXCPIF_Msk           (0x1ul << EMAC_INTSTS_TXCPIF_Pos)                 /*!< EMAC_T::INTSTS: TXCPIF Mask            */
+
+#define EMAC_INTSTS_EXDEFIF_Pos          (19)                                              /*!< EMAC_T::INTSTS: EXDEFIF Position       */
+#define EMAC_INTSTS_EXDEFIF_Msk          (0x1ul << EMAC_INTSTS_EXDEFIF_Pos)                /*!< EMAC_T::INTSTS: EXDEFIF Mask           */
+
+#define EMAC_INTSTS_NCSIF_Pos            (20)                                              /*!< EMAC_T::INTSTS: NCSIF Position         */
+#define EMAC_INTSTS_NCSIF_Msk            (0x1ul << EMAC_INTSTS_NCSIF_Pos)                  /*!< EMAC_T::INTSTS: NCSIF Mask             */
+
+#define EMAC_INTSTS_TXABTIF_Pos          (21)                                              /*!< EMAC_T::INTSTS: TXABTIF Position       */
+#define EMAC_INTSTS_TXABTIF_Msk          (0x1ul << EMAC_INTSTS_TXABTIF_Pos)                /*!< EMAC_T::INTSTS: TXABTIF Mask           */
+
+#define EMAC_INTSTS_LCIF_Pos             (22)                                              /*!< EMAC_T::INTSTS: LCIF Position          */
+#define EMAC_INTSTS_LCIF_Msk             (0x1ul << EMAC_INTSTS_LCIF_Pos)                   /*!< EMAC_T::INTSTS: LCIF Mask              */
+
+#define EMAC_INTSTS_TDUIF_Pos            (23)                                              /*!< EMAC_T::INTSTS: TDUIF Position         */
+#define EMAC_INTSTS_TDUIF_Msk            (0x1ul << EMAC_INTSTS_TDUIF_Pos)                  /*!< EMAC_T::INTSTS: TDUIF Mask             */
+
+#define EMAC_INTSTS_TXBEIF_Pos           (24)                                              /*!< EMAC_T::INTSTS: TXBEIF Position        */
+#define EMAC_INTSTS_TXBEIF_Msk           (0x1ul << EMAC_INTSTS_TXBEIF_Pos)                 /*!< EMAC_T::INTSTS: TXBEIF Mask            */
+
+#define EMAC_INTSTS_TSALMIF_Pos          (28)                                              /*!< EMAC_T::INTSTS: TSALMIF Position       */
+#define EMAC_INTSTS_TSALMIF_Msk          (0x1ul << EMAC_INTSTS_TSALMIF_Pos)                /*!< EMAC_T::INTSTS: TSALMIF Mask           */
+
+#define EMAC_GENSTS_CFR_Pos              (0)                                               /*!< EMAC_T::GENSTS: CFR Position           */
+#define EMAC_GENSTS_CFR_Msk              (0x1ul << EMAC_GENSTS_CFR_Pos)                    /*!< EMAC_T::GENSTS: CFR Mask               */
+
+#define EMAC_GENSTS_RXHALT_Pos           (1)                                               /*!< EMAC_T::GENSTS: RXHALT Position        */
+#define EMAC_GENSTS_RXHALT_Msk           (0x1ul << EMAC_GENSTS_RXHALT_Pos)                 /*!< EMAC_T::GENSTS: RXHALT Mask            */
+
+#define EMAC_GENSTS_RXFFULL_Pos          (2)                                               /*!< EMAC_T::GENSTS: RXFFULL Position       */
+#define EMAC_GENSTS_RXFFULL_Msk          (0x1ul << EMAC_GENSTS_RXFFULL_Pos)                /*!< EMAC_T::GENSTS: RXFFULL Mask           */
+
+#define EMAC_GENSTS_COLCNT_Pos           (4)                                               /*!< EMAC_T::GENSTS: COLCNT Position        */
+#define EMAC_GENSTS_COLCNT_Msk           (0xful << EMAC_GENSTS_COLCNT_Pos)                 /*!< EMAC_T::GENSTS: COLCNT Mask            */
+
+#define EMAC_GENSTS_DEF_Pos              (8)                                               /*!< EMAC_T::GENSTS: DEF Position           */
+#define EMAC_GENSTS_DEF_Msk              (0x1ul << EMAC_GENSTS_DEF_Pos)                    /*!< EMAC_T::GENSTS: DEF Mask               */
+
+#define EMAC_GENSTS_TXPAUSED_Pos         (9)                                               /*!< EMAC_T::GENSTS: TXPAUSED Position      */
+#define EMAC_GENSTS_TXPAUSED_Msk         (0x1ul << EMAC_GENSTS_TXPAUSED_Pos)               /*!< EMAC_T::GENSTS: TXPAUSED Mask          */
+
+#define EMAC_GENSTS_SQE_Pos              (10)                                              /*!< EMAC_T::GENSTS: SQE Position           */
+#define EMAC_GENSTS_SQE_Msk              (0x1ul << EMAC_GENSTS_SQE_Pos)                    /*!< EMAC_T::GENSTS: SQE Mask               */
+
+#define EMAC_GENSTS_TXHALT_Pos           (11)                                              /*!< EMAC_T::GENSTS: TXHALT Position        */
+#define EMAC_GENSTS_TXHALT_Msk           (0x1ul << EMAC_GENSTS_TXHALT_Pos)                 /*!< EMAC_T::GENSTS: TXHALT Mask            */
+
+#define EMAC_GENSTS_RPSTS_Pos            (12)                                              /*!< EMAC_T::GENSTS: RPSTS Position         */
+#define EMAC_GENSTS_RPSTS_Msk            (0x1ul << EMAC_GENSTS_RPSTS_Pos)                  /*!< EMAC_T::GENSTS: RPSTS Mask             */
+
+#define EMAC_MPCNT_MPCNT_Pos             (0)                                               /*!< EMAC_T::MPCNT: MPCNT Position          */
+#define EMAC_MPCNT_MPCNT_Msk             (0xfffful << EMAC_MPCNT_MPCNT_Pos)                /*!< EMAC_T::MPCNT: MPCNT Mask              */
+
+#define EMAC_RPCNT_RPCNT_Pos             (0)                                               /*!< EMAC_T::RPCNT: RPCNT Position          */
+#define EMAC_RPCNT_RPCNT_Msk             (0xfffful << EMAC_RPCNT_RPCNT_Pos)                /*!< EMAC_T::RPCNT: RPCNT Mask              */
+
+#define EMAC_FRSTS_RXFLT_Pos             (0)                                               /*!< EMAC_T::FRSTS: RXFLT Position          */
+#define EMAC_FRSTS_RXFLT_Msk             (0xfffful << EMAC_FRSTS_RXFLT_Pos)                /*!< EMAC_T::FRSTS: RXFLT Mask              */
+
+#define EMAC_CTXDSA_CTXDSA_Pos           (0)                                               /*!< EMAC_T::CTXDSA: CTXDSA Position        */
+#define EMAC_CTXDSA_CTXDSA_Msk           (0xfffffffful << EMAC_CTXDSA_CTXDSA_Pos)          /*!< EMAC_T::CTXDSA: CTXDSA Mask            */
+
+#define EMAC_CTXBSA_CTXBSA_Pos           (0)                                               /*!< EMAC_T::CTXBSA: CTXBSA Position        */
+#define EMAC_CTXBSA_CTXBSA_Msk           (0xfffffffful << EMAC_CTXBSA_CTXBSA_Pos)          /*!< EMAC_T::CTXBSA: CTXBSA Mask            */
+
+#define EMAC_CRXDSA_CRXDSA_Pos           (0)                                               /*!< EMAC_T::CRXDSA: CRXDSA Position        */
+#define EMAC_CRXDSA_CRXDSA_Msk           (0xfffffffful << EMAC_CRXDSA_CRXDSA_Pos)          /*!< EMAC_T::CRXDSA: CRXDSA Mask            */
+
+#define EMAC_CRXBSA_CRXBSA_Pos           (0)                                               /*!< EMAC_T::CRXBSA: CRXBSA Position        */
+#define EMAC_CRXBSA_CRXBSA_Msk           (0xfffffffful << EMAC_CRXBSA_CRXBSA_Pos)          /*!< EMAC_T::CRXBSA: CRXBSA Mask            */
+
+#define EMAC_TSCTL_TSEN_Pos              (0)                                               /*!< EMAC_T::TSCTL: TSEN Position           */
+#define EMAC_TSCTL_TSEN_Msk              (0x1ul << EMAC_TSCTL_TSEN_Pos)                    /*!< EMAC_T::TSCTL: TSEN Mask               */
+
+#define EMAC_TSCTL_TSIEN_Pos             (1)                                               /*!< EMAC_T::TSCTL: TSIEN Position          */
+#define EMAC_TSCTL_TSIEN_Msk             (0x1ul << EMAC_TSCTL_TSIEN_Pos)                   /*!< EMAC_T::TSCTL: TSIEN Mask              */
+
+#define EMAC_TSCTL_TSMODE_Pos            (2)                                               /*!< EMAC_T::TSCTL: TSMODE Position         */
+#define EMAC_TSCTL_TSMODE_Msk            (0x1ul << EMAC_TSCTL_TSMODE_Pos)                  /*!< EMAC_T::TSCTL: TSMODE Mask             */
+
+#define EMAC_TSCTL_TSUPDATE_Pos          (3)                                               /*!< EMAC_T::TSCTL: TSUPDATE Position       */
+#define EMAC_TSCTL_TSUPDATE_Msk          (0x1ul << EMAC_TSCTL_TSUPDATE_Pos)                /*!< EMAC_T::TSCTL: TSUPDATE Mask           */
+
+#define EMAC_TSCTL_TSALMEN_Pos           (5)                                               /*!< EMAC_T::TSCTL: TSALMEN Position        */
+#define EMAC_TSCTL_TSALMEN_Msk           (0x1ul << EMAC_TSCTL_TSALMEN_Pos)                 /*!< EMAC_T::TSCTL: TSALMEN Mask            */
+
+#define EMAC_TSSEC_SEC_Pos               (0)                                               /*!< EMAC_T::TSSEC: SEC Position            */
+#define EMAC_TSSEC_SEC_Msk               (0xfffffffful << EMAC_TSSEC_SEC_Pos)              /*!< EMAC_T::TSSEC: SEC Mask                */
+
+#define EMAC_TSSUBSEC_SUBSEC_Pos         (0)                                               /*!< EMAC_T::TSSUBSEC: SUBSEC Position      */
+#define EMAC_TSSUBSEC_SUBSEC_Msk         (0xfffffffful << EMAC_TSSUBSEC_SUBSEC_Pos)        /*!< EMAC_T::TSSUBSEC: SUBSEC Mask          */
+
+#define EMAC_TSINC_CNTINC_Pos            (0)                                               /*!< EMAC_T::TSINC: CNTINC Position         */
+#define EMAC_TSINC_CNTINC_Msk            (0xfful << EMAC_TSINC_CNTINC_Pos)                 /*!< EMAC_T::TSINC: CNTINC Mask             */
+
+#define EMAC_TSADDEND_ADDEND_Pos         (0)                                               /*!< EMAC_T::TSADDEND: ADDEND Position      */
+#define EMAC_TSADDEND_ADDEND_Msk         (0xfffffffful << EMAC_TSADDEND_ADDEND_Pos)        /*!< EMAC_T::TSADDEND: ADDEND Mask          */
+
+#define EMAC_UPDSEC_SEC_Pos              (0)                                               /*!< EMAC_T::UPDSEC: SEC Position           */
+#define EMAC_UPDSEC_SEC_Msk              (0xfffffffful << EMAC_UPDSEC_SEC_Pos)             /*!< EMAC_T::UPDSEC: SEC Mask               */
+
+#define EMAC_UPDSUBSEC_SUBSEC_Pos        (0)                                               /*!< EMAC_T::UPDSUBSEC: SUBSEC Position     */
+#define EMAC_UPDSUBSEC_SUBSEC_Msk        (0xfffffffful << EMAC_UPDSUBSEC_SUBSEC_Pos)       /*!< EMAC_T::UPDSUBSEC: SUBSEC Mask         */
+
+#define EMAC_ALMSEC_SEC_Pos              (0)                                               /*!< EMAC_T::ALMSEC: SEC Position           */
+#define EMAC_ALMSEC_SEC_Msk              (0xfffffffful << EMAC_ALMSEC_SEC_Pos)             /*!< EMAC_T::ALMSEC: SEC Mask               */
+
+#define EMAC_ALMSUBSEC_SUBSEC_Pos        (0)                                               /*!< EMAC_T::ALMSUBSEC: SUBSEC Position     */
+#define EMAC_ALMSUBSEC_SUBSEC_Msk        (0xfffffffful << EMAC_ALMSUBSEC_SUBSEC_Pos)       /*!< EMAC_T::ALMSUBSEC: SUBSEC Mask         */
+
+/**@}*/ /* EMAC_CONST */
+/**@}*/ /* end of EMAC register group */
+/**@}*/ /* end of REGISTER group */
+
+#if defined ( __CC_ARM   )
+    #pragma no_anon_unions
+#endif
+
+#endif /* __EMAC_REG_H__ */

+ 110 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_adc.h

@@ -0,0 +1,110 @@
+/**************************************************************************//**
+* @file     adc.h
+* @version  V1.00
+* $Revision: 6 $
+* $Date: 15/10/05 7:00p $
+* @brief    NUC980 ADC driver header file
+*
+* @note
+ * SPDX-License-Identifier: Apache-2.0
+* Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+
+#ifndef __NU_ADC_H__
+#define __NU_ADC_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup ADC_Driver ADC Driver
+  @{
+*/
+
+/** @addtogroup ADC_EXPORTED_CONSTANTS ADC Exported Constants
+  @{
+*/
+
+#define ADC_ERR_ARGS            1   /*!< The arguments is wrong */
+#define ADC_ERR_CMD             2   /*!< The command is wrong */
+
+/// @cond HIDDEN_SYMBOLS
+typedef INT32(*ADC_CALLBACK)(UINT32 status, UINT32 userData);
+/// @endcond HIDDEN_SYMBOLS
+/*---------------------------------------------------------------------------------------------------------*/
+/* ADC_CTL constant definitions                                                                            */
+/*---------------------------------------------------------------------------------------------------------*/
+#define ADC_CTL_ADEN            0x00000001  /*!< ADC Power Control */
+#define ADC_CTL_VBGEN           0x00000002  /*!< ADC Internal Bandgap Power Control */
+#define ADC_CTL_MST             0x00000100  /*!< Menu Start Conversion */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* ADC_CONF constant definitions                                                                           */
+/*---------------------------------------------------------------------------------------------------------*/
+#define ADC_CONF_NACEN          0x00000004  /*!< Normal AD Conversion Enable */
+#define ADC_CONF_SELFTEN        0x00000400  /*!< Selft Test Enable */
+#define ADC_CONF_HSPEED         (1<<22)     /*!< High Speed Enable */
+
+#define ADC_CONF_CHSEL_Pos      12          /*!< Channel Selection Position */
+#define ADC_CONF_CHSEL_Msk      (0xF<<ADC_CONF_CHSEL_Pos)   /*!< Channel Selection Mask */
+
+#define ADC_CONF_REFSEL_Pos     6           /*!< Reference Selection Position */
+#define ADC_CONF_REFSEL_Msk     (3<<6)      /*!< Reference Selection Mask */
+#define ADC_CONF_REFSEL_VREF    (0<<6)      /*!< ADC reference select VREF input */
+#define ADC_CONF_REFSEL_AVDD33  (3<<6)      /*!< ADC reference select AGND33 vs AVDD33 */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* ADC_IER constant definitions                                                                            */
+/*---------------------------------------------------------------------------------------------------------*/
+#define ADC_IER_MIEN            0x00000001  /*!< Menu Interrupt Enable */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* ADC_ISR constant definitions                                                                            */
+/*---------------------------------------------------------------------------------------------------------*/
+#define ADC_ISR_MF              0x00000001  /*!< Menu Complete Flag */
+#define ADC_ISR_NACF            0x00000400  /*!< Normal AD Conversion Finish */
+
+
+/** \brief  Structure type of ADC_CMD
+ */
+typedef enum
+{
+    START_MST,                       /*!<Menu Start Conversion */
+    VBPOWER_ON,                      /*!<Enable ADC Internal Bandgap Power */
+    VBPOWER_OFF,                     /*!<Disable ADC Internal Bandgap Power */
+    NAC_ON,                          /*!<Enable Normal AD Conversion */
+    NAC_OFF,                         /*!<Disable Normal AD Conversion */
+    SWITCH_CH,                       /*!<Switch Channel */
+} ADC_CMD;
+
+/*@}*/ /* end of group ADC_EXPORTED_CONSTANTS */
+
+/** @addtogroup ADC_EXPORTED_FUNCTIONS ADC Exported Functions
+  @{
+*/
+
+int adcOpen(void);
+int adcOpen2(uint32_t freq);
+int adcClose(void);
+int adcReadXY(short *bufX, short *bufY, int dataCnt);
+int adcReadZ(short *bufZ1, short *bufZ2, int dataCnt);
+int adcIoctl(ADC_CMD cmd, int arg1, int arg2);
+int adcChangeChannel(int channel);
+
+/*@}*/ /* end of group ADC_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group ADC_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_ADC_H__

+ 461 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_can.h

@@ -0,0 +1,461 @@
+/**************************************************************************//**
+ * @file     can.h
+ * @version  V2.00
+ * @brief    NUC980 Series CAN Driver Header File
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.
+ ******************************************************************************/
+#ifndef __NU_CAN_H__
+#define __NU_CAN_H__
+
+#include "nuc980.h"
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup CAN_Driver CAN Driver
+  @{
+*/
+
+/** @addtogroup CAN_EXPORTED_CONSTANTS CAN Exported Constants
+  @{
+*/
+/*---------------------------------------------------------------------------------------------------------*/
+/* CAN Test Mode Constant Definitions                                                                      */
+/*---------------------------------------------------------------------------------------------------------*/
+#define    CAN_NORMAL_MODE   0ul    /*!< CAN select normal mode \hideinitializer */
+#define    CAN_BASIC_MODE    1ul    /*!< CAN select basic mode \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* Message ID Type Constant Definitions                                                                    */
+/*---------------------------------------------------------------------------------------------------------*/
+#define    CAN_STD_ID    0ul    /*!< CAN select standard ID \hideinitializer */
+#define    CAN_EXT_ID    1ul    /*!< CAN select extended ID \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* Message Frame Type Constant Definitions                                                                 */
+/*---------------------------------------------------------------------------------------------------------*/
+#define    CAN_REMOTE_FRAME    0ul    /*!< CAN frame select remote frame \hideinitializer */
+#define    CAN_DATA_FRAME    1ul      /*!< CAN frame select data frame \hideinitializer */
+
+/*@}*/ /* end of group CAN_EXPORTED_CONSTANTS */
+
+
+typedef struct
+{
+    uint32_t CREQ;         /*!< [0x0020] IFn Command Request Register                                     */
+    uint32_t CMASK;        /*!< [0x0024] IFn Command Mask Register                                        */
+    uint32_t MASK1;        /*!< [0x0028] IFn Mask 1 Register                                              */
+    uint32_t MASK2;        /*!< [0x002c] IFn Mask 2 Register                                              */
+    uint32_t ARB1;         /*!< [0x0030] IFn Arbitration 1 Register                                       */
+    uint32_t ARB2;         /*!< [0x0034] IFn Arbitration 2 Register                                       */
+    uint32_t MCON;         /*!< [0x0038] IFn Message Control Register                                     */
+    uint32_t DAT_A1;       /*!< [0x003c] IFn Data A1 Register                                             */
+    uint32_t DAT_A2;       /*!< [0x0040] IFn Data A2 Register                                             */
+    uint32_t DAT_B1;       /*!< [0x0044] IFn Data B1 Register                                             */
+    uint32_t DAT_B2;       /*!< [0x0048] IFn Data B2 Register                                             */
+    uint32_t RESERVE0[13];
+} CAN_IF_T;
+
+typedef struct
+{
+    uint32_t CON;                   /*!< [0x0000] Control Register                                                 */
+    uint32_t STATUS;                /*!< [0x0004] Status Register                                                  */
+    uint32_t ERR;                   /*!< [0x0008] Error Counter Register                                           */
+    uint32_t BTIME;                 /*!< [0x000c] Bit Timing Register                                              */
+    uint32_t IIDR;                  /*!< [0x0010] Interrupt Identifier Register                                    */
+    uint32_t TEST;                  /*!< [0x0014] Test Register                                                    */
+    uint32_t BRPE;                  /*!< [0x0018] Baud Rate Prescaler Extension Register                           */
+    uint32_t RESERVE0[1];
+    CAN_IF_T IF[2];
+    uint32_t RESERVE2[8];
+    uint32_t TXREQ1;                /*!< [0x0100] Transmission Request Register 1                                  */
+    uint32_t TXREQ2;                /*!< [0x0104] Transmission Request Register 2                                  */
+    uint32_t RESERVE3[6];
+    uint32_t NDAT1;                 /*!< [0x0120] New Data Register 1                                              */
+    uint32_t NDAT2;                 /*!< [0x0124] New Data Register 2                                              */
+    uint32_t RESERVE4[6];
+    uint32_t IPND1;                 /*!< [0x0140] Interrupt Pending Register 1                                     */
+    uint32_t IPND2;                 /*!< [0x0144] Interrupt Pending Register 2                                     */
+    uint32_t RESERVE5[6];
+    uint32_t MVLD1;                 /*!< [0x0160] Message Valid Register 1                                         */
+    uint32_t MVLD2;                 /*!< [0x0164] Message Valid Register 2                                         */
+    uint32_t WU_EN;                 /*!< [0x0168] Wake-up Enable Control Register                                  */
+    uint32_t WU_STATUS;             /*!< [0x016c] Wake-up Status Register                                          */
+
+} CAN_T;
+
+
+
+
+#define CAN_CON_INIT_Pos                 (0)                                               /*!< CAN_T::CON: Init Position              */
+#define CAN_CON_INIT_Msk                 (0x1ul << CAN_CON_INIT_Pos)                       /*!< CAN_T::CON: Init Mask                  */
+
+#define CAN_CON_IE_Pos                   (1)                                               /*!< CAN_T::CON: IE Position                */
+#define CAN_CON_IE_Msk                   (0x1ul << CAN_CON_IE_Pos)                         /*!< CAN_T::CON: IE Mask                    */
+
+#define CAN_CON_SIE_Pos                  (2)                                               /*!< CAN_T::CON: SIE Position               */
+#define CAN_CON_SIE_Msk                  (0x1ul << CAN_CON_SIE_Pos)                        /*!< CAN_T::CON: SIE Mask                   */
+
+#define CAN_CON_EIE_Pos                  (3)                                               /*!< CAN_T::CON: EIE Position               */
+#define CAN_CON_EIE_Msk                  (0x1ul << CAN_CON_EIE_Pos)                        /*!< CAN_T::CON: EIE Mask                   */
+
+#define CAN_CON_DAR_Pos                  (5)                                               /*!< CAN_T::CON: DAR Position               */
+#define CAN_CON_DAR_Msk                  (0x1ul << CAN_CON_DAR_Pos)                        /*!< CAN_T::CON: DAR Mask                   */
+
+#define CAN_CON_CCE_Pos                  (6)                                               /*!< CAN_T::CON: CCE Position               */
+#define CAN_CON_CCE_Msk                  (0x1ul << CAN_CON_CCE_Pos)                        /*!< CAN_T::CON: CCE Mask                   */
+
+#define CAN_CON_TEST_Pos                 (7)                                               /*!< CAN_T::CON: Test Position              */
+#define CAN_CON_TEST_Msk                 (0x1ul << CAN_CON_TEST_Pos)                       /*!< CAN_T::CON: Test Mask                  */
+
+#define CAN_STATUS_LEC_Pos               (0)                                               /*!< CAN_T::STATUS: LEC Position            */
+#define CAN_STATUS_LEC_Msk               (0x7ul << CAN_STATUS_LEC_Pos)                     /*!< CAN_T::STATUS: LEC Mask                */
+
+#define CAN_STATUS_TXOK_Pos              (3)                                               /*!< CAN_T::STATUS: TxOK Position           */
+#define CAN_STATUS_TXOK_Msk              (0x1ul << CAN_STATUS_TXOK_Pos)                    /*!< CAN_T::STATUS: TxOK Mask               */
+
+#define CAN_STATUS_RXOK_Pos              (4)                                               /*!< CAN_T::STATUS: RxOK Position           */
+#define CAN_STATUS_RXOK_Msk              (0x1ul << CAN_STATUS_RXOK_Pos)                    /*!< CAN_T::STATUS: RxOK Mask               */
+
+#define CAN_STATUS_EPASS_Pos             (5)                                               /*!< CAN_T::STATUS: EPass Position          */
+#define CAN_STATUS_EPASS_Msk             (0x1ul << CAN_STATUS_EPASS_Pos)                   /*!< CAN_T::STATUS: EPass Mask              */
+
+#define CAN_STATUS_EWARN_Pos             (6)                                               /*!< CAN_T::STATUS: EWarn Position          */
+#define CAN_STATUS_EWARN_Msk             (0x1ul << CAN_STATUS_EWARN_Pos)                   /*!< CAN_T::STATUS: EWarn Mask              */
+
+#define CAN_STATUS_BOFF_Pos              (7)                                               /*!< CAN_T::STATUS: BOff Position           */
+#define CAN_STATUS_BOFF_Msk              (0x1ul << CAN_STATUS_BOFF_Pos)                    /*!< CAN_T::STATUS: BOff Mask               */
+
+#define CAN_ERR_TEC_Pos                  (0)                                               /*!< CAN_T::ERR: TEC Position               */
+#define CAN_ERR_TEC_Msk                  (0xfful << CAN_ERR_TEC_Pos)                       /*!< CAN_T::ERR: TEC Mask                   */
+
+#define CAN_ERR_REC_Pos                  (8)                                               /*!< CAN_T::ERR: REC Position               */
+#define CAN_ERR_REC_Msk                  (0x7ful << CAN_ERR_REC_Pos)                       /*!< CAN_T::ERR: REC Mask                   */
+
+#define CAN_ERR_RP_Pos                   (15)                                              /*!< CAN_T::ERR: RP Position                */
+#define CAN_ERR_RP_Msk                   (0x1ul << CAN_ERR_RP_Pos)                         /*!< CAN_T::ERR: RP Mask                    */
+
+#define CAN_BTIME_BRP_Pos                (0)                                               /*!< CAN_T::BTIME: BRP Position             */
+#define CAN_BTIME_BRP_Msk                (0x3ful << CAN_BTIME_BRP_Pos)                     /*!< CAN_T::BTIME: BRP Mask                 */
+
+#define CAN_BTIME_SJW_Pos                (6)                                               /*!< CAN_T::BTIME: SJW Position             */
+#define CAN_BTIME_SJW_Msk                (0x3ul << CAN_BTIME_SJW_Pos)                      /*!< CAN_T::BTIME: SJW Mask                 */
+
+#define CAN_BTIME_TSEG1_Pos              (8)                                               /*!< CAN_T::BTIME: TSeg1 Position           */
+#define CAN_BTIME_TSEG1_Msk              (0xful << CAN_BTIME_TSEG1_Pos)                    /*!< CAN_T::BTIME: TSeg1 Mask               */
+
+#define CAN_BTIME_TSEG2_Pos              (12)                                              /*!< CAN_T::BTIME: TSeg2 Position           */
+#define CAN_BTIME_TSEG2_Msk              (0x7ul << CAN_BTIME_TSEG2_Pos)                    /*!< CAN_T::BTIME: TSeg2 Mask               */
+
+#define CAN_IIDR_IntId_Pos               (0)                                               /*!< CAN_T::IIDR: IntId Position            */
+#define CAN_IIDR_IntId_Msk               (0xfffful << CAN_IIDR_IntId_Pos)                  /*!< CAN_T::IIDR: IntId Mask                */
+
+#define CAN_TEST_BASIC_Pos               (2)                                               /*!< CAN_T::TEST: Basic Position            */
+#define CAN_TEST_BASIC_Msk               (0x1ul << CAN_TEST_BASIC_Pos)                     /*!< CAN_T::TEST: Basic Mask                */
+
+#define CAN_TEST_SILENT_Pos              (3)                                               /*!< CAN_T::TEST: Silent Position           */
+#define CAN_TEST_SILENT_Msk              (0x1ul << CAN_TEST_SILENT_Pos)                    /*!< CAN_T::TEST: Silent Mask               */
+
+#define CAN_TEST_LBACK_Pos               (4)                                               /*!< CAN_T::TEST: LBack Position            */
+#define CAN_TEST_LBACK_Msk               (0x1ul << CAN_TEST_LBACK_Pos)                     /*!< CAN_T::TEST: LBack Mask                */
+
+#define CAN_TEST_Tx_Pos                  (5)                                               /*!< CAN_T::TEST: Tx Position               */
+#define CAN_TEST_Tx_Msk                  (0x3ul << CAN_TEST_Tx_Pos)                        /*!< CAN_T::TEST: Tx Mask                   */
+
+#define CAN_TEST_Rx_Pos                  (7)                                               /*!< CAN_T::TEST: Rx Position               */
+#define CAN_TEST_Rx_Msk                  (0x1ul << CAN_TEST_Rx_Pos)                        /*!< CAN_T::TEST: Rx Mask                   */
+
+#define CAN_BRPE_BRPE_Pos                (0)                                               /*!< CAN_T::BRPE: BRPE Position             */
+#define CAN_BRPE_BRPE_Msk                (0xful << CAN_BRPE_BRPE_Pos)                      /*!< CAN_T::BRPE: BRPE Mask                 */
+
+#define CAN_IF_CREQ_MSGNUM_Pos   (0)                                               /*!< CAN_IF_T::CREQ: MessageNumber Position*/
+#define CAN_IF_CREQ_MSGNUM_Msk   (0x3ful << CAN_IF_CREQ_MSGNUM_Pos)        /*!< CAN_IF_T::CREQ: MessageNumber Mask    */
+
+#define CAN_IF_CREQ_BUSY_Pos            (15)                                              /*!< CAN_IF_T::CREQ: Busy Position         */
+#define CAN_IF_CREQ_BUSY_Msk            (0x1ul << CAN_IF_CREQ_BUSY_Pos)                   /*!< CAN_IF_T::CREQ: Busy Mask             */
+
+#define CAN_IF_CMASK_DATAB_Pos          (0)                                               /*!< CAN_IF_T::CMASK: DAT_B Position       */
+#define CAN_IF_CMASK_DATAB_Msk          (0x1ul << CAN_IF_CMASK_DATAB_Pos)                /*!< CAN_IF_T::CMASK: DAT_B Mask           */
+
+#define CAN_IF_CMASK_DATAA_Pos          (1)                                               /*!< CAN_IF_T::CMASK: DAT_A Position       */
+#define CAN_IF_CMASK_DATAA_Msk          (0x1ul << CAN_IF_CMASK_DATAA_Pos)                /*!< CAN_IF_T::CMASK: DAT_A Mask           */
+
+#define CAN_IF_CMASK_TXRQSTNEWDAT_Pos  (2)                                               /*!< CAN_IF_T::CMASK: TxRqst_NewDat Position*/
+#define CAN_IF_CMASK_TXRQSTNEWDAT_Msk  (0x1ul << CAN_IF_CMASK_TXRQSTNEWDAT_Pos)        /*!< CAN_IF_T::CMASK: TxRqst_NewDat Mask   */
+
+#define CAN_IF_CMASK_CLRINTPND_Pos      (3)                                               /*!< CAN_IF_T::CMASK: ClrIntPnd Position   */
+#define CAN_IF_CMASK_CLRINTPND_Msk      (0x1ul << CAN_IF_CMASK_CLRINTPND_Pos)            /*!< CAN_IF_T::CMASK: ClrIntPnd Mask       */
+
+#define CAN_IF_CMASK_CONTROL_Pos        (4)                                               /*!< CAN_IF_T::CMASK: Control Position     */
+#define CAN_IF_CMASK_CONTROL_Msk        (0x1ul << CAN_IF_CMASK_CONTROL_Pos)              /*!< CAN_IF_T::CMASK: Control Mask         */
+
+#define CAN_IF_CMASK_ARB_Pos            (5)                                               /*!< CAN_IF_T::CMASK: Arb Position         */
+#define CAN_IF_CMASK_ARB_Msk            (0x1ul << CAN_IF_CMASK_ARB_Pos)                  /*!< CAN_IF_T::CMASK: Arb Mask             */
+
+#define CAN_IF_CMASK_MASK_Pos           (6)                                               /*!< CAN_IF_T::CMASK: Mask Position        */
+#define CAN_IF_CMASK_MASK_Msk           (0x1ul << CAN_IF_CMASK_MASK_Pos)                 /*!< CAN_IF_T::CMASK: Mask Mask            */
+
+#define CAN_IF_CMASK_WRRD_Pos          (7)                                               /*!< CAN_IF_T::CMASK: WR_RD Position       */
+#define CAN_IF_CMASK_WRRD_Msk          (0x1ul << CAN_IF_CMASK_WRRD_Pos)                /*!< CAN_IF_T::CMASK: WR_RD Mask           */
+
+#define CAN_IF_MASK1_Msk_Pos            (0)                                               /*!< CAN_IF_T::MASK1: Msk Position         */
+#define CAN_IF_MASK1_Msk_Msk            (0xfffful << CAN_IF_MASK1_Msk_Pos)               /*!< CAN_IF_T::MASK1: Msk Mask             */
+
+#define CAN_IF_MASK2_Msk_Pos            (0)                                               /*!< CAN_IF_T::MASK2: Msk Position         */
+#define CAN_IF_MASK2_Msk_Msk            (0x1ffful << CAN_IF_MASK2_Msk_Pos)               /*!< CAN_IF_T::MASK2: Msk Mask             */
+
+#define CAN_IF_MASK2_MDIR_Pos           (14)                                              /*!< CAN_IF_T::MASK2: MDir Position        */
+#define CAN_IF_MASK2_MDIR_Msk           (0x1ul << CAN_IF_MASK2_MDIR_Pos)                 /*!< CAN_IF_T::MASK2: MDir Mask            */
+
+#define CAN_IF_MASK2_MXTD_Pos           (15)                                              /*!< CAN_IF_T::MASK2: MXtd Position        */
+#define CAN_IF_MASK2_MXTD_Msk           (0x1ul << CAN_IF_MASK2_MXTD_Pos)                 /*!< CAN_IF_T::MASK2: MXtd Mask            */
+
+#define CAN_IF_ARB1_ID_Pos              (0)                                               /*!< CAN_IF_T::ARB1: ID Position           */
+#define CAN_IF_ARB1_ID_Msk              (0xfffful << CAN_IF_ARB1_ID_Pos)                 /*!< CAN_IF_T::ARB1: ID Mask               */
+
+#define CAN_IF_ARB2_ID_Pos              (0)                                               /*!< CAN_IF_T::ARB2: ID Position           */
+#define CAN_IF_ARB2_ID_Msk              (0x1ffful << CAN_IF_ARB2_ID_Pos)                 /*!< CAN_IF_T::ARB2: ID Mask               */
+
+#define CAN_IF_ARB2_DIR_Pos             (13)                                              /*!< CAN_IF_T::ARB2: Dir Position          */
+#define CAN_IF_ARB2_DIR_Msk             (0x1ul << CAN_IF_ARB2_DIR_Pos)                   /*!< CAN_IF_T::ARB2: Dir Mask              */
+
+#define CAN_IF_ARB2_XTD_Pos             (14)                                              /*!< CAN_IF_T::ARB2: Xtd Position          */
+#define CAN_IF_ARB2_XTD_Msk             (0x1ul << CAN_IF_ARB2_XTD_Pos)                   /*!< CAN_IF_T::ARB2: Xtd Mask              */
+
+#define CAN_IF_ARB2_MSGVAL_Pos          (15)                                              /*!< CAN_IF_T::ARB2: MsgVal Position       */
+#define CAN_IF_ARB2_MSGVAL_Msk          (0x1ul << CAN_IF_ARB2_MSGVAL_Pos)                /*!< CAN_IF_T::ARB2: MsgVal Mask           */
+
+#define CAN_IF_MCON_DLC_Pos             (0)                                               /*!< CAN_IF_T::MCON: DLC Position          */
+#define CAN_IF_MCON_DLC_Msk             (0xful << CAN_IF_MCON_DLC_Pos)                   /*!< CAN_IF_T::MCON: DLC Mask              */
+
+#define CAN_IF_MCON_EOB_Pos             (7)                                               /*!< CAN_IF_T::MCON: EoB Position          */
+#define CAN_IF_MCON_EOB_Msk             (0x1ul << CAN_IF_MCON_EOB_Pos)                   /*!< CAN_IF_T::MCON: EoB Mask              */
+
+#define CAN_IF_MCON_TxRqst_Pos          (8)                                               /*!< CAN_IF_T::MCON: TxRqst Position       */
+#define CAN_IF_MCON_TxRqst_Msk          (0x1ul << CAN_IF_MCON_TxRqst_Pos)                /*!< CAN_IF_T::MCON: TxRqst Mask           */
+
+#define CAN_IF_MCON_RmtEn_Pos           (9)                                               /*!< CAN_IF_T::MCON: RmtEn Position        */
+#define CAN_IF_MCON_RmtEn_Msk           (0x1ul << CAN_IF_MCON_RmtEn_Pos)                 /*!< CAN_IF_T::MCON: RmtEn Mask            */
+
+#define CAN_IF_MCON_RXIE_Pos            (10)                                              /*!< CAN_IF_T::MCON: RxIE Position         */
+#define CAN_IF_MCON_RXIE_Msk            (0x1ul << CAN_IF_MCON_RXIE_Pos)                  /*!< CAN_IF_T::MCON: RxIE Mask             */
+
+#define CAN_IF_MCON_TXIE_Pos            (11)                                              /*!< CAN_IF_T::MCON: TxIE Position         */
+#define CAN_IF_MCON_TXIE_Msk            (0x1ul << CAN_IF_MCON_TXIE_Pos)                  /*!< CAN_IF_T::MCON: TxIE Mask             */
+
+#define CAN_IF_MCON_UMASK_Pos           (12)                                              /*!< CAN_IF_T::MCON: UMask Position        */
+#define CAN_IF_MCON_UMASK_Msk           (0x1ul << CAN_IF_MCON_UMASK_Pos)                 /*!< CAN_IF_T::MCON: UMask Mask            */
+
+#define CAN_IF_MCON_IntPnd_Pos          (13)                                              /*!< CAN_IF_T::MCON: IntPnd Position       */
+#define CAN_IF_MCON_IntPnd_Msk          (0x1ul << CAN_IF_MCON_IntPnd_Pos)                /*!< CAN_IF_T::MCON: IntPnd Mask           */
+
+#define CAN_IF_MCON_MsgLst_Pos          (14)                                              /*!< CAN_IF_T::MCON: MsgLst Position       */
+#define CAN_IF_MCON_MsgLst_Msk          (0x1ul << CAN_IF_MCON_MsgLst_Pos)                /*!< CAN_IF_T::MCON: MsgLst Mask           */
+
+#define CAN_IF_MCON_NEWDAT_Pos          (15)                                              /*!< CAN_IF_T::MCON: NewDat Position       */
+#define CAN_IF_MCON_NEWDAT_Msk          (0x1ul << CAN_IF_MCON_NEWDAT_Pos)                 /*!< CAN_IF_T::MCON: NewDat Mask           */
+
+#define CAN_IF_DAT_A1_DATA0_Pos       (0)                                               /*!< CAN_IF_T::DAT_A1: Data_0_ Position    */
+#define CAN_IF_DAT_A1_DATA0_Msk       (0xfful << CAN_IF_DAT_A1_DATA0_Pos)            /*!< CAN_IF_T::DAT_A1: Data_0_ Mask        */
+
+#define CAN_IF_DAT_A1_DATA1_Pos       (8)                                               /*!< CAN_IF_T::DAT_A1: Data_1_ Position    */
+#define CAN_IF_DAT_A1_DATA1_Msk       (0xfful << CAN_IF_DAT_A1_DATA1_Pos)            /*!< CAN_IF_T::DAT_A1: Data_1_ Mask        */
+
+#define CAN_IF_DAT_A2_DATA2_Pos       (0)                                               /*!< CAN_IF_T::DAT_A2: Data_2_ Position    */
+#define CAN_IF_DAT_A2_DATA2_Msk       (0xfful << CAN_IF_DAT_A2_DATA2_Pos)            /*!< CAN_IF_T::DAT_A2: Data_2_ Mask        */
+
+#define CAN_IF_DAT_A2_DATA3_Pos       (8)                                               /*!< CAN_IF_T::DAT_A2: Data_3_ Position    */
+#define CAN_IF_DAT_A2_DATA3_Msk       (0xfful << CAN_IF_DAT_A2_DATA3_Pos)            /*!< CAN_IF_T::DAT_A2: Data_3_ Mask        */
+
+#define CAN_IF_DAT_B1_DATA4_Pos       (0)                                               /*!< CAN_IF_T::DAT_B1: Data_4_ Position    */
+#define CAN_IF_DAT_B1_DATA4_Msk       (0xfful << CAN_IF_DAT_B1_DATA4_Pos)            /*!< CAN_IF_T::DAT_B1: Data_4_ Mask        */
+
+#define CAN_IF_DAT_B1_DATA5_Pos       (8)                                               /*!< CAN_IF_T::DAT_B1: Data_5_ Position    */
+#define CAN_IF_DAT_B1_DATA5_Msk       (0xfful << CAN_IF_DAT_B1_DATA5_Pos)            /*!< CAN_IF_T::DAT_B1: Data_5_ Mask        */
+
+#define CAN_IF_DAT_B2_DATA6_Pos       (0)                                               /*!< CAN_IF_T::DAT_B2: Data_6_ Position    */
+#define CAN_IF_DAT_B2_DATA6_Msk       (0xfful << CAN_IF_DAT_B2_DATA6_Pos)            /*!< CAN_IF_T::DAT_B2: Data_6_ Mask        */
+
+#define CAN_IF_DAT_B2_DATA7_Pos       (8)                                               /*!< CAN_IF_T::DAT_B2: Data_7_ Position    */
+#define CAN_IF_DAT_B2_DATA7_Msk       (0xfful << CAN_IF_DAT_B2_DATA7_Pos)            /*!< CAN_IF_T::DAT_B2: Data_7_ Mask        */
+
+#define CAN_TXREQ1_TXRQST16_1_Pos        (0)                                               /*!< CAN_T::TXREQ1: TxRqst16_1 Position     */
+#define CAN_TXREQ1_TXRQST16_1_Msk        (0xfffful << CAN_TXREQ1_TXRQST16_1_Pos)           /*!< CAN_T::TXREQ1: TxRqst16_1 Mask         */
+
+#define CAN_TXREQ2_TXRQST32_17_Pos       (0)                                               /*!< CAN_T::TXREQ2: TxRqst32_17 Position    */
+#define CAN_TXREQ2_TXRQST32_17_Msk       (0xfffful << CAN_TXREQ2_TXRQST32_17_Pos)          /*!< CAN_T::TXREQ2: TxRqst32_17 Mask        */
+
+#define CAN_NDAT1_NewData16_1_Pos        (0)                                               /*!< CAN_T::NDAT1: NewData16_1 Position     */
+#define CAN_NDAT1_NewData16_1_Msk        (0xfffful << CAN_NDAT1_NewData16_1_Pos)           /*!< CAN_T::NDAT1: NewData16_1 Mask         */
+
+#define CAN_NDAT2_NewData32_17_Pos       (0)                                               /*!< CAN_T::NDAT2: NewData32_17 Position    */
+#define CAN_NDAT2_NewData32_17_Msk       (0xfffful << CAN_NDAT2_NewData32_17_Pos)          /*!< CAN_T::NDAT2: NewData32_17 Mask        */
+
+#define CAN_IPND1_IntPnd16_1_Pos         (0)                                               /*!< CAN_T::IPND1: IntPnd16_1 Position      */
+#define CAN_IPND1_IntPnd16_1_Msk         (0xfffful << CAN_IPND1_IntPnd16_1_Pos)            /*!< CAN_T::IPND1: IntPnd16_1 Mask          */
+
+#define CAN_IPND2_IntPnd32_17_Pos        (0)                                               /*!< CAN_T::IPND2: IntPnd32_17 Position     */
+#define CAN_IPND2_IntPnd32_17_Msk        (0xfffful << CAN_IPND2_IntPnd32_17_Pos)           /*!< CAN_T::IPND2: IntPnd32_17 Mask         */
+
+#define CAN_MVLD1_MsgVal16_1_Pos         (0)                                               /*!< CAN_T::MVLD1: MsgVal16_1 Position      */
+#define CAN_MVLD1_MsgVal16_1_Msk         (0xfffful << CAN_MVLD1_MsgVal16_1_Pos)            /*!< CAN_T::MVLD1: MsgVal16_1 Mask          */
+
+#define CAN_MVLD2_MsgVal32_17_Pos        (0)                                               /*!< CAN_T::MVLD2: MsgVal32_17 Position     */
+#define CAN_MVLD2_MsgVal32_17_Msk        (0xfffful << CAN_MVLD2_MsgVal32_17_Pos)           /*!< CAN_T::MVLD2: MsgVal32_17 Mask         */
+
+#define CAN_WU_EN_WAKUP_EN_Pos           (0)                                               /*!< CAN_T::WU_EN: WAKUP_EN Position        */
+#define CAN_WU_EN_WAKUP_EN_Msk           (0x1ul << CAN_WU_EN_WAKUP_EN_Pos)                 /*!< CAN_T::WU_EN: WAKUP_EN Mask            */
+
+#define CAN_WU_STATUS_WAKUP_STS_Pos      (0)                                               /*!< CAN_T::WU_STATUS: WAKUP_STS Position   */
+#define CAN_WU_STATUS_WAKUP_STS_Msk      (0x1ul << CAN_WU_STATUS_WAKUP_STS_Pos)            /*!< CAN_T::WU_STATUS: WAKUP_STS Mask       */
+
+#define CAN0                 ((CAN_T *)   CAN0_BA)
+#define CAN1                 ((CAN_T *)   CAN1_BA)
+#define CAN2                 ((CAN_T *)   CAN2_BA)
+#define CAN3                 ((CAN_T *)   CAN3_BA)
+
+/** @addtogroup CAN_EXPORTED_STRUCTS CAN Exported Structs
+  @{
+*/
+/**
+  * @details    CAN message structure
+  */
+typedef struct
+{
+    uint32_t  IdType;       /*!< ID type */
+    uint32_t  FrameType;    /*!< Frame type */
+    uint32_t  Id;           /*!< Message ID */
+    uint8_t   DLC;          /*!< Data length */
+    uint8_t   Data[8];      /*!< Data */
+} STR_CANMSG_T;
+
+/**
+  * @details    CAN mask message structure
+  */
+typedef struct
+{
+    uint8_t   u8Xtd;      /*!< Extended ID */
+    uint8_t   u8Dir;      /*!< Direction */
+    uint32_t  u32Id;      /*!< Message ID */
+    uint8_t   u8IdType;   /*!< ID type*/
+} STR_CANMASK_T;
+
+/*@}*/ /* end of group CAN_EXPORTED_STRUCTS */
+
+/** @cond HIDDEN_SYMBOLS */
+#define MSG(id)  (id)
+/** @endcond HIDDEN_SYMBOLS */
+
+/** @addtogroup CAN_EXPORTED_FUNCTIONS CAN Exported Functions
+  @{
+*/
+
+/**
+ * @brief Get interrupt status.
+ *
+ * @param[in] can The base address of can module.
+ *
+ * @return CAN module status register value.
+ *
+ * @details Status Interrupt is generated by bits BOff (CAN_STATUS[7]), EWarn (CAN_STATUS[6]),
+ *          EPass (CAN_STATUS[5]), RxOk (CAN_STATUS[4]), TxOk (CAN_STATUS[3]), and LEC (CAN_STATUS[2:0]).
+ *  \hideinitializer
+ */
+#define CAN_GET_INT_STATUS(can) ((can)->STATUS)
+
+/**
+ * @brief Get specified interrupt pending status.
+ *
+ * @param[in] can The base address of can module.
+ *
+ * @return The source of the interrupt.
+ *
+ * @details If several interrupts are pending, the CAN Interrupt Register will point to the pending interrupt
+ *          with the highest priority, disregarding their chronological order.
+ *  \hideinitializer
+ */
+#define CAN_GET_INT_PENDING_STATUS(can) ((can)->IIDR)
+
+/**
+ * @brief Disable wake-up function.
+ *
+ * @param[in] can The base address of can module.
+ *
+ * @return None
+ *
+ * @details  The macro is used to disable wake-up function.
+ * \hideinitializer
+ */
+#define CAN_DISABLE_WAKEUP(can) ((can)->WU_EN = 0ul)
+
+/**
+ * @brief Enable wake-up function.
+ *
+ * @param[in] can The base address of can module.
+ *
+ * @return None
+ *
+ * @details User can wake-up system when there is a falling edge in the CAN_Rx pin.
+ * \hideinitializer
+ */
+#define CAN_ENABLE_WAKEUP(can) ((can)->WU_EN = CAN_WU_EN_WAKUP_EN_Msk)
+
+/**
+ * @brief Get specified Message Object new data into bit value.
+ *
+ * @param[in] can The base address of can module.
+ * @param[in] u32MsgNum Specified Message Object number, valid value are from 0 to 31.
+ *
+ * @return Specified Message Object new data into bit value.
+ *
+ * @details The NewDat bit (CAN_IFn_MCON[15]) of a specific Message Object can be set/reset by the software through the IFn Message Interface Registers
+ *          or by the Message Handler after reception of a Data Frame or after a successful transmission.
+ * \hideinitializer
+ */
+#define CAN_GET_NEW_DATA_IN_BIT(can, u32MsgNum) ((u32MsgNum) < 16 ? (can)->NDAT1 & (1 << (u32MsgNum)) : (can)->NDAT2 & (1 << ((u32MsgNum)-16)))
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* Define CAN functions prototype                                                                          */
+/*---------------------------------------------------------------------------------------------------------*/
+uint32_t CAN_SetBaudRate(CAN_T *tCAN, uint32_t u32BaudRate);
+uint32_t CAN_Open(CAN_T *tCAN, uint32_t u32BaudRate, uint32_t u32Mode);
+void CAN_Close(CAN_T *tCAN);
+void CAN_CLR_INT_PENDING_BIT(CAN_T *tCAN, uint8_t u32MsgNum);
+void CAN_EnableInt(CAN_T *tCAN, uint32_t u32Mask);
+void CAN_DisableInt(CAN_T *tCAN, uint32_t u32Mask);
+int32_t CAN_Transmit(CAN_T *tCAN, uint32_t u32MsgNum, STR_CANMSG_T *pCanMsg);
+int32_t CAN_Receive(CAN_T *tCAN, uint32_t u32MsgNum, STR_CANMSG_T *pCanMsg);
+int32_t CAN_SetMultiRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32MsgCount, uint32_t u32IDType, uint32_t u32ID);
+int32_t CAN_SetRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID);
+int32_t CAN_SetRxMsgAndMsk(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID, uint32_t u32IDMask);
+int32_t CAN_SetTxMsg(CAN_T *tCAN, uint32_t u32MsgNum, STR_CANMSG_T *pCanMsg);
+int32_t CAN_TriggerTxMsg(CAN_T  *tCAN, uint32_t u32MsgNum);
+int32_t CAN_BasicSendMsg(CAN_T *tCAN, STR_CANMSG_T *pCanMsg);
+int32_t CAN_BasicReceiveMsg(CAN_T *tCAN, STR_CANMSG_T *pCanMsg);
+void CAN_EnterInitMode(CAN_T *tCAN, uint8_t u8Mask);
+void CAN_EnterTestMode(CAN_T *tCAN, uint8_t u8TestMask);
+void CAN_LeaveTestMode(CAN_T *tCAN);
+uint32_t CAN_GetCANBitRate(CAN_T *tCAN);
+uint32_t CAN_IsNewDataReceived(CAN_T *tCAN, uint8_t u8MsgObj);
+void CAN_LeaveInitMode(CAN_T *tCAN);
+int32_t CAN_SetRxMsgObjAndMsk(CAN_T *tCAN, uint8_t u8MsgObj, uint8_t u8idType, uint32_t u32id, uint32_t u32idmask, uint8_t u8singleOrFifoLast);
+int32_t CAN_SetRxMsgObj(CAN_T *tCAN, uint8_t u8MsgObj, uint8_t u8idType, uint32_t u32id, uint8_t u8singleOrFifoLast);
+void CAN_WaitMsg(CAN_T *tCAN);
+int32_t CAN_ReadMsgObj(CAN_T *tCAN, uint8_t u8MsgObj, uint8_t u8Release, STR_CANMSG_T *pCanMsg);
+
+/*@}*/ /* end of group CAN_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group CAN_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+
+
+#endif /*__NU_CAN_H__ */
+
+/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/

+ 471 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_cap.h

@@ -0,0 +1,471 @@
+/**************************************************************************//**
+ * @file     cap.h
+ * @brief    Image Capture Driver Header File
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ ******************************************************************************/
+#ifndef __NU_CAP_H__
+#define __NU_CAP_H__
+
+#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              */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*---------------------- Capture Engine -------------------------*/
+/**
+    @addtogroup CAP Capture Engine(CAP)
+    Memory Mapped Structure for CAP Controller
+@{ */
+
+typedef struct
+{
+    __IO uint32_t CTL;
+    __IO uint32_t PAR;
+    __IO uint32_t INT;
+    __IO uint32_t POSTERIZE;
+    __IO uint32_t MD;
+    __IO uint32_t MDADDR;
+    __IO uint32_t MDYADDR;
+    __IO uint32_t SEPIA;
+    __IO uint32_t CWSP;
+    __IO uint32_t CWS;
+    __IO uint32_t PKTSL;
+    __IO uint32_t PLNSL;
+    __IO uint32_t FRCTL;
+    __IO uint32_t STRIDE;
+    /// @cond HIDDEN_SYMBOLS
+    uint32_t RESERVE0[1];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t FIFOTH;
+    __IO uint32_t CMPADDR;
+    /// @cond HIDDEN_SYMBOLS
+    uint32_t RESERVE1[1];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t PKTSM;
+    __IO uint32_t PLNSM;
+    __I  uint32_t CURADDRP;
+    __I  uint32_t CURADDRY;
+    __I  uint32_t CURADDRU;
+    __I  uint32_t CURVADDR;
+    __IO uint32_t PKTBA0;
+    __IO uint32_t PKTBA1;
+    /// @cond HIDDEN_SYMBOLS
+    uint32_t RESERVE2[6];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t YBA;
+    __IO uint32_t UBA;
+    __IO uint32_t VBA;
+
+} CAP_T;
+
+/**
+    @addtogroup CAP_CONST CAP Bit Field Definition
+    Constant Definitions for CAP Controller
+@{ */
+
+#define CAP_CTL_CAPEN_Pos                (0)                                               /*!< CAP_T::CTL: CAPEN Position                */
+#define CAP_CTL_CAPEN_Msk                (0x1ul << CAP_CTL_CAPEN_Pos)                      /*!< CAP_T::CTL: CAPEN Mask                    */
+
+#define CAP_CTL_ADDRSW_Pos               (3)                                               /*!< CAP_T::CTL: ADDRSW Position               */
+#define CAP_CTL_ADDRSW_Msk               (0x1ul << CAP_CTL_ADDRSW_Pos)                     /*!< CAP_T::CTL: ADDRSW Mask                   */
+
+#define CAP_CTL_PLNEN_Pos                (5)                                               /*!< CAP_T::CTL: PLNEN Position                */
+#define CAP_CTL_PLNEN_Msk                (0x1ul << CAP_CTL_PLNEN_Pos)                      /*!< CAP_T::CTL: PLNEN Mask                    */
+
+#define CAP_CTL_PKTEN_Pos                (6)                                               /*!< CAP_T::CTL: PKTEN Position                */
+#define CAP_CTL_PKTEN_Msk                (0x1ul << CAP_CTL_PKTEN_Pos)                      /*!< CAP_T::CTL: PKTEN Mask                    */
+
+#define CAP_CTL_SHUTTER_Pos              (16)                                              /*!< CAP_T::CTL: SHUTTER Position              */
+#define CAP_CTL_SHUTTER_Msk              (0x1ul << CAP_CTL_SHUTTER_Pos)                    /*!< CAP_T::CTL: SHUTTER Mask                  */
+
+#define CAP_CTL_UPDATE_Pos               (20)                                              /*!< CAP_T::CTL: UPDATE Position               */
+#define CAP_CTL_UPDATE_Msk               (0x1ul << CAP_CTL_UPDATE_Pos)                     /*!< CAP_T::CTL: UPDATE Mask                   */
+
+#define CAP_CTL_VPRST_Pos                (24)                                              /*!< CAP_T::CTL: VPRST Position                */
+#define CAP_CTL_VPRST_Msk                (0x1ul << CAP_CTL_VPRST_Pos)                      /*!< CAP_T::CTL: VPRST Mask                    */
+
+#define CAP_PAR_INFMT_Pos                (0)                                               /*!< CAP_T::PAR: INFMT Position                */
+#define CAP_PAR_INFMT_Msk                (0x1ul << CAP_PAR_INFMT_Pos)                      /*!< CAP_T::PAR: INFMT Mask                    */
+
+#define CAP_PAR_SENTYPE_Pos              (1)                                               /*!< CAP_T::PAR: SENTYPE Position              */
+#define CAP_PAR_SENTYPE_Msk              (0x1ul << CAP_PAR_SENTYPE_Pos)                    /*!< CAP_T::PAR: SENTYPE Mask                  */
+
+#define CAP_PAR_INDATORD_Pos             (2)                                               /*!< CAP_T::PAR: INDATORD Position             */
+#define CAP_PAR_INDATORD_Msk             (0x3ul << CAP_PAR_INDATORD_Pos)                   /*!< CAP_T::PAR: INDATORD Mask                 */
+
+#define CAP_PAR_OUTFMT_Pos               (4)                                               /*!< CAP_T::PAR: OUTFMT Position               */
+#define CAP_PAR_OUTFMT_Msk               (0x3ul << CAP_PAR_OUTFMT_Pos)                     /*!< CAP_T::PAR: OUTFMT Mask                   */
+
+#define CAP_PAR_RANGE_Pos                (6)                                               /*!< CAP_T::PAR: RANGE Position                */
+#define CAP_PAR_RANGE_Msk                (0x1ul << CAP_PAR_RANGE_Pos)                      /*!< CAP_T::PAR: RANGE Mask                    */
+
+#define CAP_PAR_PLNFMT_Pos               (7)                                               /*!< CAP_T::PAR: PLNFMT Position               */
+#define CAP_PAR_PLNFMT_Msk               (0x1ul << CAP_PAR_PLNFMT_Pos)                     /*!< CAP_T::PAR: PLNFMT Mask                   */
+
+#define CAP_PAR_PCLKP_Pos                (8)                                               /*!< CAP_T::PAR: PCLKP Position                */
+#define CAP_PAR_PCLKP_Msk                (0x1ul << CAP_PAR_PCLKP_Pos)                      /*!< CAP_T::PAR: PCLKP Mask                    */
+
+#define CAP_PAR_HSP_Pos                  (9)                                               /*!< CAP_T::PAR: HSP Position                  */
+#define CAP_PAR_HSP_Msk                  (0x1ul << CAP_PAR_HSP_Pos)                        /*!< CAP_T::PAR: HSP Mask                      */
+
+#define CAP_PAR_VSP_Pos                  (10)                                              /*!< CAP_T::PAR: VSP Position                  */
+#define CAP_PAR_VSP_Msk                  (0x1ul << CAP_PAR_VSP_Pos)                        /*!< CAP_T::PAR: VSP Mask                      */
+
+#define CAP_PAR_COLORCTL_Pos             (11)                                              /*!< CAP_T::PAR: COLORCTL Position             */
+#define CAP_PAR_COLORCTL_Msk             (0x3ul << CAP_PAR_COLORCTL_Pos)                   /*!< CAP_T::PAR: COLORCTL Mask                 */
+
+#define CAP_PAR_FBB_Pos                  (18)                                              /*!< CAP_T::PAR: FBB Position                  */
+#define CAP_PAR_FBB_Msk                  (0x1ul << CAP_PAR_FBB_Pos)                        /*!< CAP_T::PAR: FBB Mask                      */
+
+#define CAP_INT_VINTF_Pos                (0)                                               /*!< CAP_T::INT: VINTF Position                */
+#define CAP_INT_VINTF_Msk                (0x1ul << CAP_INT_VINTF_Pos)                      /*!< CAP_T::INT: VINTF Mask                    */
+
+#define CAP_INT_MEINTF_Pos               (1)                                               /*!< CAP_T::INT: MEINTF Position               */
+#define CAP_INT_MEINTF_Msk               (0x1ul << CAP_INT_MEINTF_Pos)                     /*!< CAP_T::INT: MEINTF Mask                   */
+
+#define CAP_INT_ADDRMINTF_Pos            (3)                                               /*!< CAP_T::INT: ADDRMINTF Position            */
+#define CAP_INT_ADDRMINTF_Msk            (0x1ul << CAP_INT_ADDRMINTF_Pos)                  /*!< CAP_T::INT: ADDRMINTF Mask                */
+
+#define CAP_INT_MDINTF_Pos               (4)                                               /*!< CAP_T::INT: MDINTF Position               */
+#define CAP_INT_MDINTF_Msk               (0x1ul << CAP_INT_MDINTF_Pos)                     /*!< CAP_T::INT: MDINTF Mask                   */
+
+#define CAP_INT_VIEN_Pos                 (16)                                              /*!< CAP_T::INT: VIEN Position                 */
+#define CAP_INT_VIEN_Msk                 (0x1ul << CAP_INT_VIEN_Pos)                       /*!< CAP_T::INT: VIEN Mask                     */
+
+#define CAP_INT_MEIEN_Pos                (17)                                              /*!< CAP_T::INT: MEIEN Position                */
+#define CAP_INT_MEIEN_Msk                (0x1ul << CAP_INT_MEIEN_Pos)                      /*!< CAP_T::INT: MEIEN Mask                    */
+
+#define CAP_INT_ADDRMIEN_Pos             (19)                                              /*!< CAP_T::INT: ADDRMIEN Position             */
+#define CAP_INT_ADDRMIEN_Msk             (0x1ul << CAP_INT_ADDRMIEN_Pos)                   /*!< CAP_T::INT: ADDRMIEN Mask                 */
+
+#define CAP_INT_MDIEN_Pos                (20)                                              /*!< CAP_T::INT: MDIEN Position                */
+#define CAP_INT_MDIEN_Msk                (0x1ul << CAP_INT_MDIEN_Pos)                      /*!< CAP_T::INT: MDIEN Mask                    */
+
+#define CAP_POSTERIZE_VCOMP_Pos          (0)                                               /*!< CAP_T::POSTERIZE: VCOMP Position          */
+#define CAP_POSTERIZE_VCOMP_Msk          (0xfful << CAP_POSTERIZE_VCOMP_Pos)               /*!< CAP_T::POSTERIZE: VCOMP Mask              */
+
+#define CAP_POSTERIZE_UCOMP_Pos          (8)                                               /*!< CAP_T::POSTERIZE: UCOMP Position          */
+#define CAP_POSTERIZE_UCOMP_Msk          (0xfful << CAP_POSTERIZE_UCOMP_Pos)               /*!< CAP_T::POSTERIZE: UCOMP Mask              */
+
+#define CAP_POSTERIZE_YCOMP_Pos          (16)                                              /*!< CAP_T::POSTERIZE: YCOMP Position          */
+#define CAP_POSTERIZE_YCOMP_Msk          (0xfful << CAP_POSTERIZE_YCOMP_Pos)               /*!< CAP_T::POSTERIZE: YCOMP Mask              */
+
+#define CAP_MD_MDEN_Pos                  (0)                                               /*!< CAP_T::MD: MDEN Position                  */
+#define CAP_MD_MDEN_Msk                  (0x1ul << CAP_MD_MDEN_Pos)                        /*!< CAP_T::MD: MDEN Mask                      */
+
+#define CAP_MD_MDBS_Pos                  (8)                                               /*!< CAP_T::MD: MDBS Position                  */
+#define CAP_MD_MDBS_Msk                  (0x1ul << CAP_MD_MDBS_Pos)                        /*!< CAP_T::MD: MDBS Mask                      */
+
+#define CAP_MD_MDSM_Pos                  (9)                                               /*!< CAP_T::MD: MDSM Position                  */
+#define CAP_MD_MDSM_Msk                  (0x1ul << CAP_MD_MDSM_Pos)                        /*!< CAP_T::MD: MDSM Mask                      */
+
+#define CAP_MD_MDDF_Pos                  (10)                                              /*!< CAP_T::MD: MDDF Position                  */
+#define CAP_MD_MDDF_Msk                  (0x3ul << CAP_MD_MDDF_Pos)                        /*!< CAP_T::MD: MDDF Mask                      */
+
+#define CAP_MD_MDTHR_Pos                 (16)                                              /*!< CAP_T::MD: MDTHR Position                 */
+#define CAP_MD_MDTHR_Msk                 (0x1ful << CAP_MD_MDTHR_Pos)                      /*!< CAP_T::MD: MDTHR Mask                     */
+
+#define CAP_MDADDR_MDADDR_Pos            (0)                                               /*!< CAP_T::MDADDR: MDADDR Position            */
+#define CAP_MDADDR_MDADDR_Msk            (0xfffffffful << CAP_MDADDR_MDADDR_Pos)           /*!< CAP_T::MDADDR: MDADDR Mask                */
+
+#define CAP_MDYADDR_MDYADDR_Pos          (0)                                               /*!< CAP_T::MDYADDR: MDYADDR Position          */
+#define CAP_MDYADDR_MDYADDR_Msk          (0xfffffffful << CAP_MDYADDR_MDYADDR_Pos)         /*!< CAP_T::MDYADDR: MDYADDR Mask              */
+
+#define CAP_SEPIA_VCOMP_Pos              (0)                                               /*!< CAP_T::SEPIA: VCOMP Position              */
+#define CAP_SEPIA_VCOMP_Msk              (0xfful << CAP_SEPIA_VCOMP_Pos)                   /*!< CAP_T::SEPIA: VCOMP Mask                  */
+
+#define CAP_SEPIA_UCOMP_Pos              (8)                                               /*!< CAP_T::SEPIA: UCOMP Position              */
+#define CAP_SEPIA_UCOMP_Msk              (0xfful << CAP_SEPIA_UCOMP_Pos)                   /*!< CAP_T::SEPIA: UCOMP Mask                  */
+
+#define CAP_CWSP_CWSADDRH_Pos            (0)                                               /*!< CAP_T::CWSP: CWSADDRH Position            */
+#define CAP_CWSP_CWSADDRH_Msk            (0xffful << CAP_CWSP_CWSADDRH_Pos)                /*!< CAP_T::CWSP: CWSADDRH Mask                */
+
+#define CAP_CWSP_CWSADDRV_Pos            (16)                                              /*!< CAP_T::CWSP: CWSADDRV Position            */
+#define CAP_CWSP_CWSADDRV_Msk            (0x7fful << CAP_CWSP_CWSADDRV_Pos)                /*!< CAP_T::CWSP: CWSADDRV Mask                */
+
+#define CAP_CWS_CWW_Pos                  (0)                                               /*!< CAP_T::CWS: CWW Position                 */
+#define CAP_CWS_CWW_Msk                  (0xffful << CAP_CWS_CWW_Pos)                      /*!< CAP_T::CWS: CWW Mask                     */
+
+#define CAP_CWS_CWH_Pos                  (16)                                              /*!< CAP_T::CWS: CIWH Position                 */
+#define CAP_CWS_CWH_Msk                  (0x7fful << CAP_CWS_CWH_Pos)                      /*!< CAP_T::CWS: CIWH Mask                     */
+
+#define CAP_PKTSL_PKTSHML_Pos            (0)                                               /*!< CAP_T::PKTSL: PKTSHML Position            */
+#define CAP_PKTSL_PKTSHML_Msk            (0xfful << CAP_PKTSL_PKTSHML_Pos)                 /*!< CAP_T::PKTSL: PKTSHML Mask                */
+
+#define CAP_PKTSL_PKTSHNL_Pos            (8)                                               /*!< CAP_T::PKTSL: PKTSHNL Position            */
+#define CAP_PKTSL_PKTSHNL_Msk            (0xfful << CAP_PKTSL_PKTSHNL_Pos)                 /*!< CAP_T::PKTSL: PKTSHNL Mask                */
+
+#define CAP_PKTSL_PKTSVML_Pos            (16)                                              /*!< CAP_T::PKTSL: PKTSVML Position            */
+#define CAP_PKTSL_PKTSVML_Msk            (0xfful << CAP_PKTSL_PKTSVML_Pos)                 /*!< CAP_T::PKTSL: PKTSVML Mask                */
+
+#define CAP_PKTSL_PKTSVNL_Pos            (24)                                              /*!< CAP_T::PKTSL: PKTSVNL Position            */
+#define CAP_PKTSL_PKTSVNL_Msk            (0xfful << CAP_PKTSL_PKTSVNL_Pos)                 /*!< CAP_T::PKTSL: PKTSVNL Mask                */
+
+#define CAP_PLNSL_PLNSHML_Pos            (0)                                               /*!< CAP_T::PLNSL: PLNSHML Position            */
+#define CAP_PLNSL_PLNSHML_Msk            (0xfful << CAP_PLNSL_PLNSHML_Pos)                 /*!< CAP_T::PLNSL: PLNSHML Mask                */
+
+#define CAP_PLNSL_PLNSHNL_Pos            (8)                                               /*!< CAP_T::PLNSL: PLNSHNL Position            */
+#define CAP_PLNSL_PLNSHNL_Msk            (0xfful << CAP_PLNSL_PLNSHNL_Pos)                 /*!< CAP_T::PLNSL: PLNSHNL Mask                */
+
+#define CAP_PLNSL_PLNSVML_Pos            (16)                                              /*!< CAP_T::PLNSL: PLNSVML Position            */
+#define CAP_PLNSL_PLNSVML_Msk            (0xfful << CAP_PLNSL_PLNSVML_Pos)                 /*!< CAP_T::PLNSL: PLNSVML Mask                */
+
+#define CAP_PLNSL_PLNSVNL_Pos            (24)                                              /*!< CAP_T::PLNSL: PLNSVNL Position            */
+#define CAP_PLNSL_PLNSVNL_Msk            (0xfful << CAP_PLNSL_PLNSVNL_Pos)                 /*!< CAP_T::PLNSL: PLNSVNL Mask                */
+
+#define CAP_FRCTL_FRM_Pos                (0)                                               /*!< CAP_T::FRCTL: FRM Position                */
+#define CAP_FRCTL_FRM_Msk                (0x3ful << CAP_FRCTL_FRM_Pos)                     /*!< CAP_T::FRCTL: FRM Mask                    */
+
+#define CAP_FRCTL_FRN_Pos                (8)                                               /*!< CAP_T::FRCTL: FRN Position                */
+#define CAP_FRCTL_FRN_Msk                (0x3ful << CAP_FRCTL_FRN_Pos)                     /*!< CAP_T::FRCTL: FRN Mask                    */
+
+#define CAP_STRIDE_PKTSTRIDE_Pos         (0)                                               /*!< CAP_T::STRIDE: PKTSTRIDE Position         */
+#define CAP_STRIDE_PKTSTRIDE_Msk         (0x3ffful << CAP_STRIDE_PKTSTRIDE_Pos)            /*!< CAP_T::STRIDE: PKTSTRIDE Mask             */
+
+#define CAP_STRIDE_PLNSTRIDE_Pos         (16)                                              /*!< CAP_T::STRIDE: PLNSTRIDE Position         */
+#define CAP_STRIDE_PLNSTRIDE_Msk         (0x3ffful << CAP_STRIDE_PLNSTRIDE_Pos)            /*!< CAP_T::STRIDE: PLNSTRIDE Mask             */
+
+#define CAP_FIFOTH_PLNVFTH_Pos           (0)                                               /*!< CAP_T::FIFOTH: PLNVFTH Position           */
+#define CAP_FIFOTH_PLNVFTH_Msk           (0xful << CAP_FIFOTH_PLNVFTH_Pos)                 /*!< CAP_T::FIFOTH: PLNVFTH Mask               */
+
+#define CAP_FIFOTH_PLNUFTH_Pos           (8)                                               /*!< CAP_T::FIFOTH: PLNUFTH Position           */
+#define CAP_FIFOTH_PLNUFTH_Msk           (0xful << CAP_FIFOTH_PLNUFTH_Pos)                 /*!< CAP_T::FIFOTH: PLNUFTH Mask               */
+
+#define CAP_FIFOTH_PLNYFTH_Pos           (16)                                              /*!< CAP_T::FIFOTH: PLNYFTH Position           */
+#define CAP_FIFOTH_PLNYFTH_Msk           (0x1ful << CAP_FIFOTH_PLNYFTH_Pos)                /*!< CAP_T::FIFOTH: PLNYFTH Mask               */
+
+#define CAP_FIFOTH_PKTFTH_Pos            (24)                                              /*!< CAP_T::FIFOTH: PKTFTH Position            */
+#define CAP_FIFOTH_PKTFTH_Msk            (0x1ful << CAP_FIFOTH_PKTFTH_Pos)                 /*!< CAP_T::FIFOTH: PKTFTH Mask                */
+
+#define CAP_FIFOTH_OVF_Pos               (31)                                              /*!< CAP_T::FIFOTH: OVF Position               */
+#define CAP_FIFOTH_OVF_Msk               (0x1ul << CAP_FIFOTH_OVF_Pos)                     /*!< CAP_T::FIFOTH: OVF Mask                   */
+
+#define CAP_CMPADDR_CMPADDR_Pos          (0)                                               /*!< CAP_T::CMPADDR: CMPADDR Position          */
+#define CAP_CMPADDR_CMPADDR_Msk          (0xfffffffful << CAP_CMPADDR_CMPADDR_Pos)         /*!< CAP_T::CMPADDR: CMPADDR Mask              */
+
+#define CAP_PKTSM_PKTSHMH_Pos            (0)                                               /*!< CAP_T::PKTSM: PKTSHMH Position            */
+#define CAP_PKTSM_PKTSHMH_Msk            (0xfful << CAP_PKTSM_PKTSHMH_Pos)                 /*!< CAP_T::PKTSM: PKTSHMH Mask                */
+
+#define CAP_PKTSM_PKTSHNH_Pos            (8)                                               /*!< CAP_T::PKTSM: PKTSHNH Position            */
+#define CAP_PKTSM_PKTSHNH_Msk            (0xfful << CAP_PKTSM_PKTSHNH_Pos)                 /*!< CAP_T::PKTSM: PKTSHNH Mask                */
+
+#define CAP_PKTSM_PKTSVMH_Pos            (16)                                              /*!< CAP_T::PKTSM: PKTSVMH Position            */
+#define CAP_PKTSM_PKTSVMH_Msk            (0xfful << CAP_PKTSM_PKTSVMH_Pos)                 /*!< CAP_T::PKTSM: PKTSVMH Mask                */
+
+#define CAP_PKTSM_PKTSVNH_Pos            (24)                                              /*!< CAP_T::PKTSM: PKTSVNH Position            */
+#define CAP_PKTSM_PKTSVNH_Msk            (0xfful << CAP_PKTSM_PKTSVNH_Pos)                 /*!< CAP_T::PKTSM: PKTSVNH Mask                */
+
+#define CAP_PLNSM_PLNSHMH_Pos            (0)                                               /*!< CAP_T::PLNSM: PLNSHMH Position            */
+#define CAP_PLNSM_PLNSHMH_Msk            (0xfful << CAP_PLNSM_PLNSHMH_Pos)                 /*!< CAP_T::PLNSM: PLNSHMH Mask                */
+
+#define CAP_PLNSM_PLNSHNH_Pos            (8)                                               /*!< CAP_T::PLNSM: PLNSHNH Position            */
+#define CAP_PLNSM_PLNSHNH_Msk            (0xfful << CAP_PLNSM_PLNSHNH_Pos)                 /*!< CAP_T::PLNSM: PLNSHNH Mask                */
+
+#define CAP_PLNSM_PLNSVMH_Pos            (16)                                              /*!< CAP_T::PLNSM: PLNSVMH Position            */
+#define CAP_PLNSM_PLNSVMH_Msk            (0xfful << CAP_PLNSM_PLNSVMH_Pos)                 /*!< CAP_T::PLNSM: PLNSVMH Mask                */
+
+#define CAP_PLNSM_PLNSVNH_Pos            (24)                                              /*!< CAP_T::PLNSM: PLNSVNH Position            */
+#define CAP_PLNSM_PLNSVNH_Msk            (0xfful << CAP_PLNSM_PLNSVNH_Pos)                 /*!< CAP_T::PLNSM: PLNSVNH Mask                */
+
+#define CAP_CURADDRP_CURADDR_Pos         (0)                                               /*!< CAP_T::CURADDRP: CURADDR Position         */
+#define CAP_CURADDRP_CURADDR_Msk         (0xfffffffful << CAP_CURADDRP_CURADDR_Pos)        /*!< CAP_T::CURADDRP: CURADDR Mask             */
+
+#define CAP_CURADDRY_CURADDR_Pos         (0)                                               /*!< CAP_T::CURADDRY: CURADDR Position         */
+#define CAP_CURADDRY_CURADDR_Msk         (0xfffffffful << CAP_CURADDRY_CURADDR_Pos)        /*!< CAP_T::CURADDRY: CURADDR Mask             */
+
+#define CAP_CURADDRU_CURADDR_Pos         (0)                                               /*!< CAP_T::CURADDRU: CURADDR Position         */
+#define CAP_CURADDRU_CURADDR_Msk         (0xfffffffful << CAP_CURADDRU_CURADDR_Pos)        /*!< CAP_T::CURADDRU: CURADDR Mask             */
+
+#define CAP_CURVADDR_CURADDR_Pos         (0)                                               /*!< CAP_T::CURVADDR: CURADDR Position         */
+#define CAP_CURVADDR_CURADDR_Msk         (0xfffffffful << CAP_CURVADDR_CURADDR_Pos)        /*!< CAP_T::CURVADDR: CURADDR Mask             */
+
+#define CAP_PKTBA0_BASEADDR_Pos          (0)                                               /*!< CAP_T::PKTBA0: BASEADDR Position          */
+#define CAP_PKTBA0_BASEADDR_Msk          (0xfffffffful << CAP_PKTBA0_BASEADDR_Pos)         /*!< CAP_T::PKTBA0: BASEADDR Mask              */
+
+#define CAP_PKTBA1_BASEADDR_Pos          (0)                                               /*!< CAP_T::PKTBA1: BASEADDR Position          */
+#define CAP_PKTBA1_BASEADDR_Msk          (0xfffffffful << CAP_PKTBA1_BASEADDR_Pos)         /*!< CAP_T::PKTBA1: BASEADDR Mask              */
+
+#define CAP_YBA_BASEADDR_Pos             (0)                                               /*!< CAP_T::YBA: BASEADDR Position             */
+#define CAP_YBA_BASEADDR_Msk             (0xfffffffful << CAP_YBA_BASEADDR_Pos)            /*!< CAP_T::YBA: BASEADDR Mask                 */
+
+#define CAP_UBA_BASEADDR_Pos             (0)                                               /*!< CAP_T::UBA: BASEADDR Position             */
+#define CAP_UBA_BASEADDR_Msk             (0xfffffffful << CAP_UBA_BASEADDR_Pos)            /*!< CAP_T::UBA: BASEADDR Mask                 */
+
+#define CAP_VBA_BASEADDR_Pos             (0)                                               /*!< CAP_T::VBA: BASEADDR Position             */
+#define CAP_VBA_BASEADDR_Msk             (0xfffffffful << CAP_VBA_BASEADDR_Pos)            /*!< CAP_T::VBA: BASEADDR Mask                 */
+
+/**@}*/ /* CAP_CONST */
+/**@}*/ /* end of CAP register group */
+
+
+#define CAP0                  ((CAP_T *)   CAP0_BA)
+#define CAP1                  ((CAP_T *)   CAP1_BA)
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup CAP_Driver CAP Driver
+  @{
+*/
+
+/** @addtogroup CAP_EXPORTED_CONSTANTS CAP Exported Constants
+  @{
+*/
+
+
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* VINCTRL constant definitions                                                                            */
+/*---------------------------------------------------------------------------------------------------------*/
+#define CAP_CTL_CAPEN      (1ul<<CAP_CTL_CAPEN_Pos)     /*!< CAP CTL setting for enabling capture engine mode  \hideinitializer */
+#define CAP_CTL_ADDRSW     (1ul<<CAP_CTL_ADDRSW_Pos)    /*!< CAP CTL setting for packet buffer address switch  \hideinitializer */
+#define CAP_CTL_PKTEN      (1ul<<CAP_CTL_PKTEN_Pos)     /*!< CAP CTL setting for enabling packet output mode  \hideinitializer */
+#define CAP_CTL_PLNEN      (1ul<<CAP_CTL_PLNEN_Pos)     /*!< CAP CTL setting for enabling planar output mode  \hideinitializer */
+#define CAP_CTL_SHUTTER    (1ul<<CAP_CTL_SHUTTER_Pos)   /*!< CAP CTL setting for enabling shutter mode  \hideinitializer */
+#define CAP_CTL_UPDATE     (1ul<<CAP_CTL_UPDATE_Pos)    /*!< CAP CTL setting for enabling update register at new frame  \hideinitializer */
+#define CAP_CTL_RESET      (1ul<<CAP_CTL_VPRST_Pos)     /*!< CAP CTL setting for capture reset  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* CAPPAR constant definitions                                                                             */
+/*---------------------------------------------------------------------------------------------------------*/
+#define CAP_PAR_INFMT_YUV422 (0ul<<CAP_PAR_INFMT_Pos)         /*!< CAP PAR setting for Sensor Input Data YUV422 Format   \hideinitializer */
+#define CAP_PAR_INFMT_RGB565 (1ul<<CAP_PAR_INFMT_Pos)         /*!< CAP PAR setting for Sensor Input Data RGB565 Format   \hideinitializer */
+
+#define CAP_PAR_SENTYPE_CCIR601  (0ul<<CAP_PAR_SENTYPE_Pos)   /*!< CAP PAR setting for Sensor Input CCIR601 Type   \hideinitializer */
+#define CAP_PAR_SENTYPE_CCIR656  (1ul<<CAP_PAR_SENTYPE_Pos)   /*!< CAP PAR setting for Sensor Input CCIR656 Type   \hideinitializer */
+
+#define CAP_PAR_INDATORD_YUYV   (0x0ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, YUYV  \hideinitializer */
+#define CAP_PAR_INDATORD_YVYU   (0x1ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, YVYU  \hideinitializer */
+#define CAP_PAR_INDATORD_UYVY   (0x2ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, UYVY  \hideinitializer */
+#define CAP_PAR_INDATORD_VYUY   (0x3ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, VYUY  \hideinitializer */
+
+#define CAP_PAR_INDATORD_RGGB   (0x0ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, 0byte: R[0:4] G[5:8], 1byte G[0:2] R[3:8]  \hideinitializer */
+#define CAP_PAR_INDATORD_BGGR   (0x1ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, 0byte: b[0:4] G[5:8], 1byte G[0:2] R[3:8]  \hideinitializer */
+#define CAP_PAR_INDATORD_GBRG   (0x2ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, 0byte: G[0:3] G[4:8], 1byte G[0:4] G[5:8]  \hideinitializer */
+#define CAP_PAR_INDATORD_GRBG   (0x3ul<<CAP_PAR_INDATORD_Pos)       /*!< CAP PAR setting for Sensor Input Data Order, 0byte: G[0:3] G[4:8], 1byte G[0:4] G[5:8]  \hideinitializer */
+
+#define CAP_PAR_OUTFMT_YUV422 (0x0ul<<CAP_PAR_OUTFMT_Pos)     /*!< CAP PAR setting for Image Data YUV422 Format Output to System Memory  \hideinitializer */
+#define CAP_PAR_OUTFMT_ONLY_Y (0x1ul<<CAP_PAR_OUTFMT_Pos)     /*!< CAP PAR setting for Image Data ONLY_Y Format Output to System Memory  \hideinitializer */
+#define CAP_PAR_OUTFMT_RGB555 (0x2ul<<CAP_PAR_OUTFMT_Pos)     /*!< CAP PAR setting for Image Data RGB555 Format Output to System Memory  \hideinitializer */
+#define CAP_PAR_OUTFMT_RGB565 (0x3ul<<CAP_PAR_OUTFMT_Pos)     /*!< CAP PAR setting for Image Data RGB565 Format Output to System Memory  \hideinitializer */
+
+#define CAP_PAR_PLNFMT_YUV422 (0x0ul<<CAP_PAR_PLNFMT_Pos)       /*!< CAP PAR setting for Planar Output YUV422 Format  \hideinitializer */
+#define CAP_PAR_PLNFMT_YUV420 (0x1ul<<CAP_PAR_PLNFMT_Pos)       /*!< CAP PAR setting for Planar Output YUV420 Format  \hideinitializer */
+
+#define CAP_PAR_VSP_LOW      (0x0ul<<CAP_PAR_VSP_Pos)         /*!< CAP PAR setting for Sensor Vsync Polarity  \hideinitializer */
+#define CAP_PAR_VSP_HIGH     (0x1ul<<CAP_PAR_VSP_Pos)         /*!< CAP PAR setting for Sensor Vsync Polarity  \hideinitializer */
+#define CAP_PAR_HSP_LOW      (0x0ul<<CAP_PAR_HSP_Pos)         /*!< CAP PAR setting for Sensor Hsync Polarity  \hideinitializer */
+#define CAP_PAR_HSP_HIGH     (0x1ul<<CAP_PAR_HSP_Pos)         /*!< CAP PAR setting for Sensor Hsync Polarity  \hideinitializer */
+#define CAP_PAR_PCLKP_LOW    (0x0ul<<CAP_PAR_PCLKP_Pos)       /*!< CAP PAR setting for Sensor Pixel Clock Polarity  \hideinitializer */
+#define CAP_PAR_PCLKP_HIGH   (0x1ul<<CAP_PAR_PCLKP_Pos)       /*!< CAP PAR setting for Sensor Pixel Clock Polarity  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* VININT constant definitions                                                                             */
+/*---------------------------------------------------------------------------------------------------------*/
+#define CAP_INT_VIEN_ENABLE        (0x1ul<<CAP_INT_VIEN_Pos)        /*!< VININT setting for Frame End Interrupt enable  \hideinitializer */
+#define CAP_INT_MEIEN_ENABLE       (0x1ul<<CAP_INT_MEIEN_Pos)       /*!< VININT setting for Bus Master Transfer Error Interrupt enable  \hideinitializer */
+#define CAP_INT_ADDRMIEN_ENABLE    (0x1ul<<CAP_INT_ADDRMIEN_Pos)    /*!< VININT setting for Memory Address Match Interrupt enable  \hideinitializer */
+#define CAP_INT_MDIEN_ENABLE       (0x1ul<<CAP_INT_MDIEN_Pos)       /*!< VININT setting for Motion Detection Output Finish Interrupt Enable enable  \hideinitializer */
+
+
+static uint32_t u32EscapeFrame = 0;
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Define Error Code                                                                                      */
+/*---------------------------------------------------------------------------------------------------------*/
+#define CAP_INVALID_INT               ((int32_t)(0xFFFFFFFF-1))
+#define CAP_INVALID_BUF               ((int32_t)(0xFFFFFFFF-2))
+#define CAP_INVALID_PIPE              ((int32_t)(0xFFFFFFFF-3))
+
+
+/*@}*/ /* end of group CAP_EXPORTED_CONSTANTS */
+
+
+
+/** @addtogroup CAP_EXPORTED_FUNCTIONS CAP Exported Functions
+  @{
+*/
+
+/**
+ * @brief     Is CAP module Enable
+ *
+ * @param[in]  VCAP: The pointer of the specified CAP module
+ *
+ * @return   FALSE(Enable) or TRUE(Disable)
+ *
+ * @details   Check Image Capture Interface module Enable or Disable
+ *  \hideinitializer
+ */
+#define CAP_IS_STOPPED(VCAP)  ((VCAP->CTL & CAP_CTL_CAPEN_Msk)?0:1)
+
+/**
+ * @brief     Clear CAP flag
+ *
+ * @param[in]  VCAP: The pointer of the specified CAP module
+ *
+ * @param[in] u32IntMask interrupt flags settings. It could be
+ *                   - \ref CAP_INT_VINTF_Msk
+ *                   - \ref CAP_INT_MEINTF_Msk
+ *                   - \ref CAP_INT_ADDRMINTF_Msk
+ *                   - \ref CAP_INT_MDINTF_Msk
+ *
+ * @return    TRUE(Enable) or FALSE(Disable)
+ *
+ * @details   Clear Image Capture Interface interrupt flag
+ *  \hideinitializer
+ */
+#define CAP_CLR_INT_FLAG(VCAP,u32IntMask) (VCAP->INT |=u32IntMask)
+
+/**
+ * @brief     Get CAP Interrupt status
+ *
+ * @param[in]  VCAP: The pointer of the specified CAP module
+ *
+ * @return    TRUE(Enable) or FALSE(Disable)
+ *
+ * @details   Get Image Capture Interface interrupt status.
+ * \hideinitializer
+ */
+#define CAP_GET_INT_STS(VCAP) (VCAP->INT)
+
+void CAP_Open(CAP_T *VCAP, uint32_t u32InFormat, uint32_t u32OutFormet);
+void CAP_SetCroppingWindow(CAP_T *VCAP, uint32_t u32VStart, uint32_t u32HStart, uint32_t u32Height, uint32_t u32Width);
+void CAP_SetPacketBuf(CAP_T *VCAP, uint32_t  u32Address);
+void CAP_SetPlanarBuf(CAP_T *VCAP, uint32_t u32YAddr, uint32_t u32UAddr, uint32_t u32VAddr);
+void CAP_Close(CAP_T *VCAP);
+void CAP_EnableInt(CAP_T *VCAP, uint32_t u32IntMask);
+void CAP_DisableInt(CAP_T *VCAP, uint32_t u32IntMask);
+void CAP_Start(CAP_T *VCAP);
+void CAP_Stop(CAP_T *VCAP, uint32_t u32FrameComplete);
+void CAP_SetPacketScaling(CAP_T *VCAP, uint32_t u32VNumerator, uint32_t u32VDenominator, uint32_t u32HNumerator, uint32_t u32HDenominator);
+void CAP_SetPlanarScaling(CAP_T *VCAP, uint32_t u32VNumerator, uint32_t u32VDenominator, uint32_t u32HNumerator, uint32_t u32HDenominator);
+void CAP_SetPacketStride(CAP_T *VCAP, uint32_t u32Stride);
+void CAP_SetPlanarStride(CAP_T *VCAP, uint32_t u32Stride);
+void CAP_EnableMotionDet(CAP_T *VCAP, uint32_t u32Freq, uint32_t u32BlockSize, uint32_t u32Format, uint32_t u32Threshold,  uint32_t u32YDetAddr, uint32_t u32DetAddr);
+void CAP_DisableMotionDet(CAP_T *VCAP);
+
+/*@}*/ /* end of group CAP_EXPORTED_FUNCTIONS */
+
+
+
+/*@}*/ /* end of group CAP_Driver */
+
+/*@}*/ /* end of group Device_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__CAP_H__
+

+ 1456 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_crypto.h

@@ -0,0 +1,1456 @@
+/**************************************************************************//**
+ * @file     crypto.h
+ * @version  V1.10
+ * @brief    Cryptographic Accelerator driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ ******************************************************************************/
+#ifndef __NU_CRYPTO_H__
+#define __NU_CRYPTO_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup Crypto_Driver Crypto Driver
+  @{
+*/
+
+/**
+    @addtogroup CRPT Cryptographic Accelerator(CRPT)
+    Memory Mapped Structure for Cryptographic Accelerator
+@{ */
+
+typedef struct
+{
+
+    /**
+     * @var CRPT_T::INTEN
+     * Offset: 0x00  Crypto Interrupt Enable Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |AESIEN    |AES Interrupt Enable Control
+     * |        |          |0 = AES interrupt Disabled.
+     * |        |          |1 = AES interrupt Enabled.
+     * |        |          |In DMA mode, an interrupt will be triggered when amount of data set in AES_DMA_CNT is fed into the AES engine.
+     * |        |          |In Non-DMA mode, an interrupt will be triggered when the AES engine finishes the operation.
+     * |[1]     |AESEIEN   |AES Error Flag Enable Control
+     * |        |          |0 = AES error interrupt flag Disabled.
+     * |        |          |1 = AES error interrupt flag Enabled.
+     * |[8]     |TDESIEN   |TDES/DES Interrupt Enable Control
+     * |        |          |0 = TDES/DES interrupt Disabled.
+     * |        |          |1 = TDES/DES interrupt Enabled.
+     * |        |          |In DMA mode, an interrupt will be triggered when amount of data set in TDES_DMA_CNT is fed into the TDES engine.
+     * |        |          |In Non-DMA mode, an interrupt will be triggered when the TDES engine finishes the operation.
+     * |[9]     |TDESEIEN  |TDES/DES Error Flag Enable Control
+     * |        |          |0 = TDES/DES error interrupt flag Disabled.
+     * |        |          |1 = TDES/DES error interrupt flag Enabled.
+     * |[16]    |PRNGIEN   |PRNG Interrupt Enable Control
+     * |        |          |0 = PRNG interrupt Disabled.
+     * |        |          |1 = PRNG interrupt Enabled.
+     * |[22]    |ECCIEN    |ECC Interrupt Enable Control
+     * |        |          |0 = ECC interrupt Disabled.
+     * |        |          |1 = ECC interrupt Enabled.
+     * |        |          |In DMA mode, an interrupt will be triggered when amount of data set in ECC_DMA_CNT is fed into the ECC engine.
+     * |        |          |In Non-DMA mode, an interrupt will be triggered when the ECC engine finishes the operation.
+     * |[23]    |ECCEIEN   |ECC Error Interrupt Enable Control
+     * |        |          |0 = ECC error interrupt flag Disabled.
+     * |        |          |1 = ECC error interrupt flag Enabled.
+     * |[24]    |HMACIEN   |SHA/HMAC Interrupt Enable Control
+     * |        |          |0 = SHA/HMAC interrupt Disabled.
+     * |        |          |1 = SHA/HMAC interrupt Enabled.
+     * |        |          |In DMA mode, an interrupt will be triggered when amount of data set in SHA _DMA_CNT is fed into the SHA/HMAC engine
+     * |        |          |In Non-DMA mode, an interrupt will be triggered when the SHA/HMAC engine finishes the operation.
+     * |[25]    |HMACEIEN  |SHA/HMAC Error Interrupt Enable Control
+     * |        |          |0 = SHA/HMAC error interrupt flag Disabled.
+     * |        |          |1 = SHA/HMAC error interrupt flag Enabled.
+     * @var CRPT_T::INTSTS
+     * Offset: 0x04  Crypto Interrupt Flag
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |AESIF     |AES Finish Interrupt Flag
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No AES interrupt.
+     * |        |          |= AES encryption/decryption done interrupt.
+     * |[1]     |AESEIF    |AES Error Flag
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No AES error.
+     * |        |          |1 = AES encryption/decryption done interrupt.
+     * |[8]     |TDESIF    |TDES/DES Finish Interrupt Flag
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No TDES/DES interrupt.
+     * |        |          |1 = TDES/DES encryption/decryption done interrupt.
+     * |[9]     |TDESEIF   |TDES/DES Error Flag
+     * |        |          |This bit includes the operating and setting error
+     * |        |          |The detailed flag is shown in the CRPT_TDES_STS register
+     * |        |          |This includes operating and setting error.
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No TDES/DES error.
+     * |        |          |1 = TDES/DES encryption/decryption error interrupt.
+     * |[16]    |PRNGIF    |PRNG Finish Interrupt Flag
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No PRNG interrupt.
+     * |        |          |1 = PRNG key generation done interrupt.
+     * |[22]    |ECCIF     |ECC Finish Interrupt Flag
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No ECC interrupt.
+     * |        |          |1 = ECC operation done interrupt.
+     * |[23]    |ECCEIF    |ECC Error Flag
+     * |        |          |This register includes operating and setting error. The detail flag is shown in CRPT_ECC_STS register.
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No ECC error.
+     * |        |          |1 = ECC error interrupt.
+     * |[24]    |HMACIF    |SHA/HMAC Finish Interrupt Flag
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No SHA/HMAC interrupt.
+     * |        |          |1 = SHA/HMAC operation done interrupt.
+     * |[25]    |HMACEIF   |SHA/HMAC Error Flag
+     * |        |          |This register includes operating and setting error. The detail flag is shown in CRPT_HMAC_STS register.
+     * |        |          |This bit is cleared by writing 1, and it has no effect by writing 0.
+     * |        |          |0 = No SHA/HMAC error.
+     * |        |          |1 = SHA/HMAC error interrupt.
+     * @var CRPT_T::PRNG_CTL
+     * Offset: 0x08  PRNG Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |START     |Start PRNG Engine
+     * |        |          |0 = Stop PRNG engine.
+     * |        |          |1 = Generate new key and store the new key to register CRPT_PRNG_KEYx , which will be cleared when the new key is generated.
+     * |[1]     |SEEDRLD   |Reload New Seed for PRNG Engine
+     * |        |          |0 = Generating key based on the current seed.
+     * |        |          |1 = Reload new seed.
+     * |[3:2]   |KEYSZ     |PRNG Generate Key Size
+     * |        |          |00 = 64 bits.
+     * |        |          |01 = 128 bits.
+     * |        |          |10 = 192 bits.
+     * |        |          |11 = 256 bits.
+     * |[8]     |BUSY      |PRNG Busy (Read Only)
+     * |        |          |0 = PRNG engine is idle.
+     * |        |          |1 = Indicate that the PRNG engine is generating CRPT_PRNG_KEYx.
+     * @var CRPT_T::PRNG_SEED
+     * Offset: 0x0C  Seed for PRNG
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SEED      |Seed for PRNG (Write Only)
+     * |        |          |The bits store the seed for PRNG engine.
+     * @var CRPT_T::PRNG_KEY[8]
+     * Offset: 0x10 ~ 0x2C  PRNG Generated Key0 ~ Key7
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |KEY       |Store PRNG Generated Key (Read Only)
+     * |        |          |The bits store the key that is generated by PRNG.
+     * @var CRPT_T::AES_FDBCK[4]
+     * Offset: 0x50 ~ 0x5C  AES Engine Output Feedback Data after Cryptographic Operation
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |FDBCK     |AES Feedback Information
+     * |        |          |The feedback value is 128 bits in size.
+     * |        |          |The AES engine uses the data from CRPT_AES_FDBCKx as the data inputted to CRPT_AESn_IVx for the next block in DMA cascade mode.
+     * |        |          |The AES engine outputs feedback information for IV in the next block's operation
+     * |        |          |Software can use this feedback information to implement more than four DMA channels
+     * |        |          |Software can store that feedback value temporarily
+     * |        |          |After switching back, fill the stored feedback value to this register in the same channel operation, and then continue the operation with the original setting.
+     * @var CRPT_T::TDES_FDBCKH
+     * Offset: 0x60  TDES/DES Engine Output Feedback High Word Data after Cryptographic Operation
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |FDBCK     |TDES/DES Feedback
+     * |        |          |The feedback value is 64 bits in size.
+     * |        |          |The TDES/DES engine uses the data from {CRPT_TDES_FDBCKH, CRPT_TDES_FDBCKL} as the data inputted to {CRPT_TDESn_IVH, CRPT_TDESn_IVL} for the next block in DMA cascade mode
+     * |        |          |The feedback register is for CBC, CFB, and OFB mode.
+     * |        |          |TDES/DES engine outputs feedback information for IV in the next block's operation
+     * |        |          |Software can use this feedback information to implement more than four DMA channels
+     * |        |          |Software can store that feedback value temporarily
+     * |        |          |After switching back, fill the stored feedback value to this register in the same channel operation
+     * |        |          |Then can continue the operation with the original setting.
+     * @var CRPT_T::TDES_FDBCKL
+     * Offset: 0x64  TDES/DES Engine Output Feedback Low Word Data after Cryptographic Operation
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |FDBCK     |TDES/DES Feedback
+     * |        |          |The feedback value is 64 bits in size.
+     * |        |          |The TDES/DES engine uses the data from {CRPT_TDES_FDBCKH, CRPT_TDES_FDBCKL} as the data inputted to {CRPT_TDESn_IVH, CRPT_TDESn_IVL} for the next block in DMA cascade mode
+     * |        |          |The feedback register is for CBC, CFB, and OFB mode.
+     * |        |          |TDES/DES engine outputs feedback information for IV in the next block's operation
+     * |        |          |Software can use this feedback information to implement more than four DMA channels
+     * |        |          |Software can store that feedback value temporarily
+     * |        |          |After switching back, fill the stored feedback value to this register in the same channel operation
+     * |        |          |Then can continue the operation with the original setting.
+     * @var CRPT_T::AES_CTL
+     * Offset: 0x100  AES Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |START     |AES Engine Start
+     * |        |          |0 = No effect.
+     * |        |          |1 = Start AES engine. BUSY flag will be set.
+     * |        |          |Note: This bit is always 0 when it's read back.
+     * |[1]     |STOP      |AES Engine Stop
+     * |        |          |0 = No effect.
+     * |        |          |1 = Stop AES engine.
+     * |        |          |Note: This bit is always 0 when it's read back.
+     * |[3:2]   |KEYSZ     |AES Key Size
+     * |        |          |This bit defines three different key size for AES operation.
+     * |        |          |2'b00 = 128 bits key.
+     * |        |          |2'b01 = 192 bits key.
+     * |        |          |2'b10 = 256 bits key.
+     * |        |          |2'b11 = Reserved.
+     * |        |          |If the AES accelerator is operating and the corresponding flag BUSY is 1, updating this register has no effect.
+     * |[5]     |DMALAST   |AES Last Block
+     * |        |          |In DMA mode, this bit must be set as beginning the last DMA cascade round.
+     * |        |          |In Non-DMA mode, this bit must be set when feeding in the last block of data in ECB, CBC, CTR, OFB, and CFB mode, and feeding in the (last-1) block of data at CBC-CS1, CBC-CS2, and CBC-CS3 mode.
+     * |        |          |This bit is always 0 when it's read back. Must be written again once START is triggered.
+     * |[6]     |DMACSCAD  |AES Engine DMA with Cascade Mode
+     * |        |          |0 = DMA cascade function Disabled.
+     * |        |          |1 = In DMA cascade mode, software can update DMA source address register, destination address register, and byte count register during a cascade operation, without finishing the accelerator operation.
+     * |[7]     |DMAEN     |AES Engine DMA Enable Control
+     * |        |          |0 = AES DMA engine Disabled.
+     * |        |          |The AES engine operates in Non-DMA mode, and gets data from the port CRPT_AES_DATIN.
+     * |        |          |1 = AES_DMA engine Enabled.
+     * |        |          |The AES engine operates in DMA mode, and data movement from/to the engine is done by DMA logic.
+     * |[15:8]  |OPMODE    |AES Engine Operation Modes
+     * |        |          |0x00 = ECB (Electronic Codebook Mode)  0x01 = CBC (Cipher Block Chaining Mode).
+     * |        |          |0x02 = CFB (Cipher Feedback Mode).
+     * |        |          |0x03 = OFB (Output Feedback Mode).
+     * |        |          |0x04 = CTR (Counter Mode).
+     * |        |          |0x10 = CBC-CS1 (CBC Ciphertext-Stealing 1 Mode).
+     * |        |          |0x11 = CBC-CS2 (CBC Ciphertext-Stealing 2 Mode).
+     * |        |          |0x12 = CBC-CS3 (CBC Ciphertext-Stealing 3 Mode).
+     * |[16]    |ENCRPT    |AES Encryption/Decryption
+     * |        |          |0 = AES engine executes decryption operation.
+     * |        |          |1 = AES engine executes encryption operation.
+     * |[22]    |OUTSWAP   |AES Engine Output Data Swap
+     * |        |          |0 = Keep the original order.
+     * |        |          |1 = The order that CPU outputs data from the accelerator will be changed from {byte3, byte2, byte1, byte0} to {byte0, byte1, byte2, byte3}.
+     * |[23]    |INSWAP    |AES Engine Input Data Swap
+     * |        |          |0 = Keep the original order.
+     * |        |          |1 = The order that CPU feeds data to the accelerator will be changed from {byte3, byte2, byte1, byte0} to {byte0, byte1, byte2, byte3}.
+     * |[25:24] |CHANNEL   |AES Engine Working Channel
+     * |        |          |00 = Current control register setting is for channel 0.
+     * |        |          |01 = Current control register setting is for channel 1.
+     * |        |          |10 = Current control register setting is for channel 2.
+     * |        |          |11 = Current control register setting is for channel 3.
+     * |[30:26] |KEYUNPRT  |Unprotect Key
+     * |        |          |Writing 0 to CRPT_AES_CTL[31] and "10110" to CRPT_AES_CTL[30:26] is to unprotect the AES key.
+     * |        |          |The KEYUNPRT can be read and written
+     * |        |          |When it is written as the AES engine is operating, BUSY flag is 1, there would be no effect on KEYUNPRT.
+     * |[31]    |KEYPRT    |Protect Key
+     * |        |          |Read as a flag to reflect KEYPRT.
+     * |        |          |0 = No effect.
+     * |        |          |1 = Protect the content of the AES key from reading
+     * |        |          |The return value for reading CRPT_AESn_KEYx is not the content of the registers CRPT_AESn_KEYx
+     * |        |          |Once it is set, it can be cleared by asserting KEYUNPRT
+     * |        |          |And the key content would be cleared as well.
+     * @var CRPT_T::AES_STS
+     * Offset: 0x104  AES Engine Flag
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |BUSY      |AES Engine Busy
+     * |        |          |0 = The AES engine is idle or finished.
+     * |        |          |1 = The AES engine is under processing.
+     * |[8]     |INBUFEMPTY|AES Input Buffer Empty
+     * |        |          |0 = There are some data in input buffer waiting for the AES engine to process.
+     * |        |          |1 = AES input buffer is empty
+     * |        |          |Software needs to feed data to the AES engine
+     * |        |          |Otherwise, the AES engine will be pending to wait for input data.
+     * |[9]     |INBUFFULL |AES Input Buffer Full Flag
+     * |        |          |0 = AES input buffer is not full. Software can feed the data into the AES engine.
+     * |        |          |1 = AES input buffer is full
+     * |        |          |Software cannot feed data to the AES engine
+     * |        |          |Otherwise, the flag INBUFERR will be set to 1.
+     * |[10]    |INBUFERR  |AES Input Buffer Error Flag
+     * |        |          |0 = No error.
+     * |        |          |1 = Error happens during feeding data to the AES engine.
+     * |[12]    |CNTERR    |CRPT_AESn_CNT Setting Error
+     * |        |          |0 = No error in CRPT_AESn_CNT setting.
+     * |        |          |1 = CRPT_AESn_CNT is not a multiply of 16 in ECB, CBC, CFB, OFB, and CTR mode.
+     * |[16]    |OUTBUFEMPTY|AES Out Buffer Empty
+     * |        |          |0 = AES output buffer is not empty. There are some valid data kept in output buffer.
+     * |        |          |1 = AES output buffer is empty
+     * |        |          |Software cannot get data from CRPT_AES_DATOUT
+     * |        |          |Otherwise, the flag OUTBUFERR will be set to 1 since the output buffer is empty.
+     * |[17]    |OUTBUFFULL|AES Out Buffer Full Flag
+     * |        |          |0 = AES output buffer is not full.
+     * |        |          |1 = AES output buffer is full, and software needs to get data from CRPT_AES_DATOUT
+     * |        |          |Otherwise, the AES engine will be pending since the output buffer is full.
+     * |[18]    |OUTBUFERR |AES Out Buffer Error Flag
+     * |        |          |0 = No error.
+     * |        |          |1 = Error happens during getting the result from AES engine.
+     * |[20]    |BUSERR    |AES DMA Access Bus Error Flag
+     * |        |          |0 = No error.
+     * |        |          |1 = Bus error will stop DMA operation and AES engine.
+     * @var CRPT_T::AES_DATIN
+     * Offset: 0x108  AES Engine Data Input Port Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DATIN     |AES Engine Input Port
+     * |        |          |CPU feeds data to AES engine through this port by checking CRPT_AES_STS. Feed data as INBUFFULL is 0.
+     * @var CRPT_T::AES_DATOUT
+     * Offset: 0x10C  AES Engine Data Output Port Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DATOUT    |AES Engine Output Port
+     * |        |          |CPU gets results from the AES engine through this port by checking CRPT_AES_STS
+     * |        |          |Get data as OUTBUFEMPTY is 0.
+     * @var CRPT_T::AES0_KEY[8]
+     * Offset: 0x110 ~ 0x12C  AES Key Word 0 ~ 7 Register for Channel 0
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |KEY       |CRPT_AESn_KEYx
+     * |        |          |The KEY keeps the security key for AES operation.
+     * |        |          |n = 0, 1..3.
+     * |        |          |x = 0, 1..7.
+     * |        |          |The security key for AES accelerator can be 128, 192, or 256 bits and four, six, or eight 32-bit registers are to store each security key
+     * |        |          |{CRPT_AESn_KEY3, CRPT_AESn_KEY2, CRPT_AESn_KEY1, CRPT_AESn_KEY0} stores the 128-bit security key for AES operation
+     * |        |          |{CRPT_AESn_KEY5, CRPT_AESn_KEY4, CRPT_AESn_KEY3, CRPT_AESn_KEY2, CRPT_AESn_KEY1, CRPT_AESn_KEY0} stores the 192-bit security key for AES operation
+     * |        |          |{CRPT_AESn_KEY7, CRPT_AESn_KEY6, CRPT_AESn_KEY5, CRPT_AESn_KEY4, CRPT_AESn_KEY3, CRPT_AESn_KEY2, CRPT_AESn_KEY1, CRPT_AESn_KEY0} stores the 256-bit security key for AES operation.
+     * @var CRPT_T::AES0_IV[4]
+     * Offset: 0x130 ~ 0x13C  AES Initial Vector Word 0 ~ 3 Register for Channel 0
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |IV        |AES Initial Vectors
+     * |        |          |n = 0, 1..3.
+     * |        |          |x = 0, 1..3.
+     * |        |          |Four initial vectors (CRPT_AESn_IV0, CRPT_AESn_IV1, CRPT_AESn_IV2, and CRPT_AESn_IV3) are for AES operating in CBC, CFB, and OFB mode
+     * |        |          |Four registers (CRPT_AESn_IV0, CRPT_AESn_IV1, CRPT_AESn_IV2, and CRPT_AESn_IV3) act as Nonce counter when the AES engine is operating in CTR mode.
+     * @var CRPT_T::AES0_SADDR
+     * Offset: 0x140  AES DMA Source Address Register for Channel 0
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SADDR     |AES DMA Source Address
+     * |        |          |The AES accelerator supports DMA function to transfer the plain text between system memory and embedded FIFO
+     * |        |          |The SADDR keeps the source address of the data buffer where the source text is stored
+     * |        |          |Based on the source address, the AES accelerator can read the plain text from system memory and do AES operation
+     * |        |          |The start of source address should be located at word boundary
+     * |        |          |In other words, bit 1 and 0 of SADDR are ignored.
+     * |        |          |SADDR can be read and written
+     * |        |          |Writing to SADDR while the AES accelerator is operating doesn't affect the current AES operation
+     * |        |          |But the value of SADDR will be updated later on
+     * |        |          |Consequently, software can prepare the DMA source address for the next AES operation.
+     * |        |          |In DMA mode, software can update the next CRPT_AESn_SADDR before triggering START.
+     * |        |          |The value of CRPT_AESn_SADDR and CRPT_AESn_DADDR can be the same.
+     * @var CRPT_T::AES0_DADDR
+     * Offset: 0x144  AES DMA Destination Address Register for Channel 0
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DADDR     |AES DMA Destination Address
+     * |        |          |The AES accelerator supports DMA function to transfer the cipher text between system memory and embedded FIFO
+     * |        |          |The DADDR keeps the destination address of the data buffer where the engine output's text will be stored
+     * |        |          |Based on the destination address, the AES accelerator can write the cipher text back to system memory after the AES operation is finished
+     * |        |          |The start of destination address should be located at word boundary
+     * |        |          |In other words, bit 1 and 0 of DADDR are ignored.
+     * |        |          |DADDR can be read and written
+     * |        |          |Writing to DADDR while the AES accelerator is operating doesn't affect the current AES operation
+     * |        |          |But the value of DADDR will be updated later on
+     * |        |          |Consequently, software can prepare the destination address for the next AES operation.
+     * |        |          |In DMA mode, software can update the next CRPT_AESn_DADDR before triggering START.
+     * |        |          |The value of CRPT_AESn_SADDR and CRPT_AESn_DADDR can be the same.
+     * @var CRPT_T::AES0_CNT
+     * Offset: 0x148  AES Byte Count Register for Channel 0
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CNT       |AES Byte Count
+     * |        |          |The CRPT_AESn_CNT keeps the byte count of source text that is for the AES engine operating in DMA mode
+     * |        |          |The CRPT_AESn_CNT is 32-bit and the maximum of byte count is 4G bytes.
+     * |        |          |CRPT_AESn_CNT can be read and written
+     * |        |          |Writing to CRPT_AESn_CNT while the AES accelerator is operating doesn't affect the current AES operation
+     * |        |          |But the value of CRPT_AESn_CNT will be updated later on
+     * |        |          |Consequently, software can prepare the byte count of data for the next AES operation.
+     * |        |          |According to CBC-CS1, CBC-CS2, and CBC-CS3 standard, the count of operation data must be at least one block
+     * |        |          |Operations that are less than one block will output unexpected result.
+     * |        |          |In Non-DMA ECB, CBC, CFB, OFB, and CTR mode, CRPT_AESn_CNT must be set as byte count for the last block of data before feeding in the last block of data
+     * |        |          |In Non-DMA CBC-CS1, CBC-CS2, and CBC-CS3 mode, CRPT_AESn_CNT must be set as byte count for the last two blocks of data before feeding in the last two blocks of data.
+     * @var CRPT_T::HMAC_CTL
+     * Offset: 0x300  SHA/HMAC Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |START     |SHA/HMAC Engine Start
+     * |        |          |0 = No effect.
+     * |        |          |1 = Start SHA/HMAC engine. BUSY flag will be set.
+     * |        |          |This bit is always 0 when it's read back.
+     * |[1]     |STOP      |SHA/HMAC Engine Stop
+     * |        |          |0 = No effect.
+     * |        |          |1 = Stop SHA/HMAC engine.
+     * |        |          |This bit is always 0 when it's read back.
+     * |[4]     |HMACEN    |HMAC_SHA Engine Operating Mode
+     * |        |          |0 = execute SHA function.
+     * |        |          |1 = execute HMAC function.
+     * |[5]     |DMALAST   |SHA/HMAC Last Block
+     * |        |          |This bit must be set as feeding in last byte of data.
+     * |[7]     |DMAEN     |SHA/HMAC Engine DMA Enable Control
+     * |        |          |0 = SHA/HMAC DMA engine Disabled.
+     * |        |          |SHA/HMAC engine operates in Non-DMA mode, and gets data from the port CRPT_HMAC_DATIN.
+     * |        |          |1 = SHA/HMAC DMA engine Enabled.
+     * |        |          |SHA/HMAC engine operates in DMA mode, and data movement from/to the engine is done by DMA logic.
+     * |[10:8]  |OPMODE    |SHA/HMAC Engine Operation Modes
+     * |        |          |0x0xx: SHA160
+     * |        |          |0x100: SHA256
+     * |        |          |0x101: SHA224
+     * |        |          |0x110: SHA512
+     * |        |          |0x111: SHA384
+     * |        |          |These bits can be read and written. But writing to them wouldn't take effect as BUSY is 1.
+     * |[22]    |OUTSWAP   |SHA/HMAC Engine Output Data Swap
+     * |        |          |0 = Keep the original order.
+     * |        |          |1 = The order that CPU feeds data to the accelerator will be changed from {byte3, byte2, byte1, byte0} to {byte0, byte1, byte2, byte3}.
+     * |[23]    |INSWAP    |SHA/HMAC Engine Input Data Swap
+     * |        |          |0 = Keep the original order.
+     * |        |          |1 = The order that CPU feeds data to the accelerator will be changed from {byte3, byte2, byte1, byte0} to {byte0, byte1, byte2, byte3}.
+     * @var CRPT_T::HMAC_STS
+     * Offset: 0x304  SHA/HMAC Status Flag
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |BUSY      |SHA/HMAC Engine Busy
+     * |        |          |0 = SHA/HMAC engine is idle or finished.
+     * |        |          |1 = SHA/HMAC engine is busy.
+     * |[1]     |DMABUSY   |SHA/HMAC Engine DMA Busy Flag
+     * |        |          |0 = SHA/HMAC DMA engine is idle or finished.
+     * |        |          |1 = SHA/HMAC DMA engine is busy.
+     * |[8]     |DMAERR    |SHA/HMAC Engine DMA Error Flag
+     * |        |          |0 = Show the SHA/HMAC engine access normal.
+     * |        |          |1 = Show the SHA/HMAC engine access error.
+     * |[16]    |DATINREQ  |SHA/HMAC Non-DMA Mode Data Input Request
+     * |        |          |0 = No effect.
+     * |        |          |1 = Request SHA/HMAC Non-DMA mode data input.
+     * @var CRPT_T::HMAC_DGST[16]
+     * Offset: 0x308 ~ 0x344  SHA/HMAC Digest Message 0 ~ 15
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DGST      |SHA/HMAC Digest Message Output Register
+     * |        |          |For SHA-160, the digest is stored in CRPT_HMAC_DGST0 ~ CRPT_HMAC_DGST4.
+     * |        |          |For SHA-224, the digest is stored in CRPT_HMAC_DGST0 ~ CRPT_HMAC_DGST6.
+     * |        |          |For SHA-256, the digest is stored in CRPT_HMAC_DGST0 ~ CRPT_HMAC_DGST7.
+     * |        |          |For SHA-384, the digest is stored in CRPT_HMAC_DGST0 ~ CRPT_HMAC_DGST11.
+     * |        |          |For SHA-512, the digest is stored in CRPT_HMAC_DGST0 ~ CRPT_HMAC_DGST15.
+     * @var CRPT_T::HMAC_KEYCNT
+     * Offset: 0x348  SHA/HMAC Key Byte Count Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |KEYCNT    |SHA/HMAC Key Byte Count
+     * |        |          |The CRPT_HMAC_KEYCNT keeps the byte count of key that SHA/HMAC engine operates
+     * |        |          |The register is 32-bit and the maximum byte count is 4G bytes
+     * |        |          |It can be read and written.
+     * |        |          |Writing to the register CRPT_HMAC_KEYCNT as the SHA/HMAC accelerator operating doesn't affect the current SHA/HMAC operation
+     * |        |          |But the value of CRPT_SHA _KEYCNT will be updated later on
+     * |        |          |Consequently, software can prepare the key count for the next SHA/HMAC operation.
+     * @var CRPT_T::HMAC_SADDR
+     * Offset: 0x34C  SHA/HMAC DMA Source Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SADDR     |SHA/HMAC DMA Source Address
+     * |        |          |The SHA/HMAC accelerator supports DMA function to transfer the plain text between system memory and embedded FIFO
+     * |        |          |The CRPT_HMAC_SADDR keeps the source address of the data buffer where the source text is stored
+     * |        |          |Based on the source address, the SHA/HMAC accelerator can read the plain text from system memory and do SHA/HMAC operation
+     * |        |          |The start of source address should be located at word boundary
+     * |        |          |In other words, bit 1 and 0 of CRPT_HMAC_SADDR are ignored.
+     * |        |          |CRPT_HMAC_SADDR can be read and written
+     * |        |          |Writing to CRPT_HMAC_SADDR while the SHA/HMAC accelerator is operating doesn't affect the current SHA/HMAC operation
+     * |        |          |But the value of CRPT_HMAC_SADDR will be updated later on
+     * |        |          |Consequently, software can prepare the DMA source address for the next SHA/HMAC operation.
+     * |        |          |In DMA mode, software can update the next CRPT_HMAC_SADDR before triggering START.
+     * |        |          |CRPT_HMAC_SADDR and CRPT_HMAC_DADDR can be the same in the value.
+     * @var CRPT_T::HMAC_DMACNT
+     * Offset: 0x350  SHA/HMAC Byte Count Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DMACNT    |SHA/HMAC Operation Byte Count
+     * |        |          |The CRPT_HMAC_DMACNT keeps the byte count of source text that is for the SHA/HMAC engine operating in DMA mode
+     * |        |          |The CRPT_HMAC_DMACNT is 32-bit and the maximum of byte count is 4G bytes.
+     * |        |          |CRPT_HMAC_DMACNT can be read and written
+     * |        |          |Writing to CRPT_HMAC_DMACNT while the SHA/HMAC accelerator is operating doesn't affect the current SHA/HMAC operation
+     * |        |          |But the value of CRPT_HMAC_DMACNT will be updated later on
+     * |        |          |Consequently, software can prepare the byte count of data for the next SHA/HMAC operation.
+     * |        |          |In Non-DMA mode, CRPT_HMAC_DMACNT must be set as the byte count of the last block before feeding in the last block of data.
+     * @var CRPT_T::HMAC_DATIN
+     * Offset: 0x354  SHA/HMAC Engine Non-DMA Mode Data Input Port Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DATIN     |SHA/HMAC Engine Input Port
+     * |        |          |CPU feeds data to SHA/HMAC engine through this port by checking CRPT_HMAC_STS
+     * |        |          |Feed data as DATINREQ is 1.
+     * @var CRPT_T::ECC_CTL
+     * Offset: 0x800  ECC Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |START     |ECC Accelerator Start
+     * |        |          |0 = No effect.
+     * |        |          |1 = Start ECC accelerator. BUSY flag will be set.
+     * |        |          |This bit is always 0 when it's read back.
+     * |        |          |ECC accelerator will ignore this START signal when BUSY flag is 1.
+     * |[1]     |STOP      |ECC Accelerator Stop
+     * |        |          |0 = No effect.
+     * |        |          |1 = Abort ECC accelerator and make it into idle state.
+     * |        |          |This bit is always 0 when it's read back.
+     * |        |          |Remember to clear ECC interrupt flag after stopping ECC accelerator.
+     * |[7]     |DMAEN     |ECC Accelerator DMA Enable Control
+     * |        |          |0 = ECC DMA engine Disabled.
+     * |        |          |1 = ECC DMA engine Enabled.
+     * |        |          |Only when START and DMAEN are 1, ECC DMA engine will be active
+     * |[8]     |FSEL      |Field Selection
+     * |        |          |0 = Binary Field (GF(2^m)).
+     * |        |          |1 = Prime Field (GF(p)).
+     * |[10:9]  |ECCOP     |Point Operation for BF and PF
+     * |        |          |00 = Point multiplication :.
+     * |        |          |(POINTX1, POINTY1) = SCALARK * (POINTX1, POINTY1).
+     * |        |          |01 = Modulus operation : choose by MODOP (CRPT_ECC_CTL[12:11]).
+     * |        |          |10 = Point addition :.
+     * |        |          |(POINTX1, POINTY1) = (POINTX1, POINTY1) +.
+     * |        |          |(POINTX2, POINTY2)
+     * |        |          |11 = Point doubling :.
+     * |        |          |(POINTX1, POINTY1) = 2 * (POINTX1, POINTY1).
+     * |        |          |Besides above three input data, point operations still need the parameters of elliptic curve (CURVEA, CURVEB, CURVEN and CURVEM) as shown in Figure 6.27-11
+     * |[12:11] |MODOP     |Modulus Operation for PF
+     * |        |          |00 = Division :.
+     * |        |          |POINTX1 = (POINTY1 / POINTX1) % CURVEN.
+     * |        |          |01 = Multiplication :.
+     * |        |          |POINTX1 = (POINTX1 * POINTY1) % CURVEN.
+     * |        |          |10 = Addition :.
+     * |        |          |POINTX1 = (POINTX1 + POINTY1) % CURVEN.
+     * |        |          |11 = Subtraction :.
+     * |        |          |POINTX1 = (POINTX1 - POINTY1) % CURVEN.
+     * |        |          |MODOP is active only when ECCOP = 01.
+     * |[16]    |LDP1      |The Control Signal of Register for the X and Y Coordinate of the First Point (POINTX1, POINTY1)
+     * |        |          |0 = The register for POINTX1 and POINTY1 is not modified by DMA or user.
+     * |        |          |1 = The register for POINTX1 and POINTY1 is modified by DMA or user.
+     * |[17]    |LDP2      |The Control Signal of Register for the X and Y Coordinate of the Second Point (POINTX2, POINTY2)
+     * |        |          |0 = The register for POINTX2 and POINTY2 is not modified by DMA or user.
+     * |        |          |1 = The register for POINTX2 and POINTY2 is modified by DMA or user.
+     * |[18]    |LDA       |The Control Signal of Register for the Parameter CURVEA of Elliptic Curve
+     * |        |          |0 = The register for CURVEA is not modified by DMA or user.
+     * |        |          |1 = The register for CURVEA is modified by DMA or user.
+     * |[19]    |LDB       |The Control Signal of Register for the Parameter CURVEB of Elliptic Curve
+     * |        |          |0 = The register for CURVEB is not modified by DMA or user.
+     * |        |          |1 = The register for CURVEB is modified by DMA or user.
+     * |[20]    |LDN       |The Control Signal of Register for the Parameter CURVEN of Elliptic Curve
+     * |        |          |0 = The register for CURVEN is not modified by DMA or user.
+     * |        |          |1 = The register for CURVEN is modified by DMA or user.
+     * |[21]    |LDK       |The Control Signal of Register for SCALARK
+     * |        |          |0 = The register for SCALARK is not modified by DMA or user.
+     * |        |          |1 = The register for SCALARK is modified by DMA or user.
+     * |[31:22] |CURVEM    |The key length of elliptic curve.
+     * @var CRPT_T::ECC_STS
+     * Offset: 0x804  ECC Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |BUSY      |ECC Accelerator Busy Flag
+     * |        |          |0 = The ECC accelerator is idle or finished.
+     * |        |          |1 = The ECC accelerator is under processing and protects all registers.
+     * |        |          |Remember to clear ECC interrupt flag after ECC accelerator finished
+     * |[1]     |DMABUSY   |ECC DMA Busy Flag
+     * |        |          |0 = ECC DMA is idle or finished.
+     * |        |          |1 = ECC DMA is busy.
+     * |[16]    |BUSERR    |ECC DMA Access Bus Error Flag
+     * |        |          |0 = No error.
+     * |        |          |1 = Bus error will stop DMA operation and ECC accelerator.
+     * @var CRPT_T::ECC_X1[18]
+     * Offset: 0x808 ~ 0x84C  ECC The X-coordinate word 0 ~ 17 of the first point
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |POINTX1   |ECC the x-coordinate Value of the First Point (POINTX1)
+     * |        |          |For B-163 or K-163, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_05
+     * |        |          |For B-233 or K-233, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_07
+     * |        |          |For B-283 or K-283, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_08
+     * |        |          |For B-409 or K-409, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_12
+     * |        |          |For B-571 or K-571, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_17
+     * |        |          |For P-192, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_05
+     * |        |          |For P-224, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_06
+     * |        |          |For P-256, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_07
+     * |        |          |For P-384, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_11
+     * |        |          |For P-521, POINTX1 is stored in CRPT_ECC_X1_00~CRPT_ECC_X1_16
+     * @var CRPT_T::ECC_Y1[18]
+     * Offset: 0x850 ~ 0x894  ECC The Y-coordinate word 0 ~ 17 of the first point
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |POINTY1   |ECC the Y-coordinate Value of the First Point (POINTY1)
+     * |        |          |For B-163 or K-163, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_05
+     * |        |          |For B-233 or K-233, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_07
+     * |        |          |For B-283 or K-283, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_08
+     * |        |          |For B-409 or K-409, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_12
+     * |        |          |For B-571 or K-571, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_17
+     * |        |          |For P-192, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_05
+     * |        |          |For P-224, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_06
+     * |        |          |For P-256, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_07
+     * |        |          |For P-384, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_11
+     * |        |          |For P-521, POINTY1 is stored in CRPT_ECC_Y1_00~CRPT_ECC_Y1_16
+     * @var CRPT_T::ECC_X2[18]
+     * Offset: 0x898 ~ 0x8DC  ECC The X-coordinate word 0 ~ 17 of the second point
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |POINTX2   |ECC the x-coordinate Value of the Second Point (POINTX2)
+     * |        |          |For B-163 or K-163, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_05
+     * |        |          |For B-233 or K-233, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_07
+     * |        |          |For B-283 or K-283, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_08
+     * |        |          |For B-409 or K-409, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_12
+     * |        |          |For B-571 or K-571, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_17
+     * |        |          |For P-192, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_05
+     * |        |          |For P-224, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_06
+     * |        |          |For P-256, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_07
+     * |        |          |For P-384, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_11
+     * |        |          |For P-521, POINTX2 is stored in CRPT_ECC_X2_00~CRPT_ECC_X2_16
+     * @var CRPT_T::ECC_Y2[18]
+     * Offset: 0x8E0 ~ 0x924  ECC The Y-coordinate word 0 ~ 17 of the second point
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |POINTY2   |ECC the Y-coordinate Value of the Second Point (POINTY2)
+     * |        |          |For B-163 or K-163, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_05
+     * |        |          |For B-233 or K-233, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_07
+     * |        |          |For B-283 or K-283, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_08
+     * |        |          |For B-409 or K-409, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_12
+     * |        |          |For B-571 or K-571, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_17
+     * |        |          |For P-192, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_05
+     * |        |          |For P-224, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_06
+     * |        |          |For P-256, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_07
+     * |        |          |For P-384, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_11
+     * |        |          |For P-521, POINTY2 is stored in CRPT_ECC_Y2_00~CRPT_ECC_Y2_16
+     * @var CRPT_T::ECC_A[18]
+     * Offset: 0x928 ~ 0x96C  ECC The parameter CURVEA word 0 ~ 17 of elliptic curve
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CURVEA    |ECC the Parameter CURVEA Value of Elliptic Curve (CURVEA)
+     * |        |          |The formula of elliptic curve is y2=x3+CURVEA*x+CURVEB in GF(p) and y2+x*y=x3+CURVEA*x2+CURVEB in GF(2^m).
+     * |        |          |For B-163 or K-163, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_05
+     * |        |          |For B-233 or K-233, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_07
+     * |        |          |For B-283 or K-283, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_08
+     * |        |          |For B-409 or K-409, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_12
+     * |        |          |For B-571 or K-571, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_17
+     * |        |          |For P-192, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_05
+     * |        |          |For P-224, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_06
+     * |        |          |For P-256, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_07
+     * |        |          |For P-384, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_11
+     * |        |          |For P-521, CURVEA is stored in CRPT_ECC_A_00~CRPT_ECC_A_16
+     * @var CRPT_T::ECC_B[18]
+     * Offset: 0x970 ~ 0x9B4  ECC The parameter CURVEB word 0 ~ 17 of elliptic curve
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CURVEB    |ECC the Parameter CURVEB Value of Elliptic Curve (CURVEA)
+     * |        |          |The formula of elliptic curve is y2=x3+CURVEA*x+CURVEB in GF(p) and y2+x*y=x3+CURVEA*x2+CURVEB in GF(2^m).
+     * |        |          |For B-163 or K-163, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_05
+     * |        |          |For B-233 or K-233, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_07
+     * |        |          |For B-283 or K-283, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_08
+     * |        |          |For B-409 or K-409, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_12
+     * |        |          |For B-521 or K-521, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_17
+     * |        |          |For P-192, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_05
+     * |        |          |For P-224, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_06
+     * |        |          |For P-256, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_07
+     * |        |          |For P-384, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_11
+     * |        |          |For P-521, CURVEB is stored in CRPT_ECC_B_00~CRPT_ECC_B_16
+     * @var CRPT_T::ECC_N[18]
+     * Offset: 0x9B8 ~ 0x9FC  ECC The parameter CURVEN word 0 ~ 17 of elliptic curve
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CURVEN    |ECC the Parameter CURVEN Value of Elliptic Curve (CURVEN)
+     * |        |          |In GF(p), CURVEN is the prime p.
+     * |        |          |In GF(2^m), CURVEN is the irreducible polynomial.
+     * |        |          |For B-163 or K-163, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_05
+     * |        |          |For B-233 or K-233, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_07
+     * |        |          |For B-283 or K-283, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_08
+     * |        |          |For B-409 or K-409, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_12
+     * |        |          |For B-571 or K-571, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_17
+     * |        |          |For P-192, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_05
+     * |        |          |For P-224, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_06
+     * |        |          |For P-256, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_07
+     * |        |          |For P-384, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_11
+     * |        |          |For P-521, CURVEN is stored in CRPT_ECC_N_00~CRPT_ECC_N_16
+     * @var CRPT_T::ECC_K[18]
+     * Offset: 0xA00 ~ 0xA44  ECC The scalar SCALARK word0 of point multiplication
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SCALARK   |ECC the Scalar SCALARK Value of Point Multiplication(SCALARK)
+     * |        |          |Because the SCALARK usually stores the private key, ECC accelerator do not allow to read the register SCALARK.
+     * |        |          |For B-163 or K-163, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_05
+     * |        |          |For B-233 or K-233, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_07
+     * |        |          |For B-283 or K-283, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_08
+     * |        |          |For B-409 or K-409, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_12
+     * |        |          |For B-571 or K-571, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_17
+     * |        |          |For P-192, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_05
+     * |        |          |For P-224, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_06
+     * |        |          |For P-256, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_07
+     * |        |          |For P-384, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_11
+     * |        |          |For P-521, SCALARK is stored in CRPT_ECC_K_00~CRPT_ECC_K_16
+     * @var CRPT_T::ECC_SADDR
+     * Offset: 0xA48  ECC DMA Source Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SADDR     |ECC DMA Source Address
+     * |        |          |The ECC accelerator supports DMA function to transfer the DATA and PARAMETER between
+     * |        |          |SRAM memory space and ECC accelerator. The SADDR keeps the source address of the data
+     * |        |          |buffer where the source text is stored. Based on the source address, the ECC accelerator
+     * |        |          |can read the DATA and PARAMETER from SRAM memory space and do ECC operation. The start
+     * |        |          |of source address should be located at word boundary. That is, bit 1 and 0 of SADDR are
+     * |        |          |ignored. SADDR can be read and written. In DMA mode, software must update the CRPT_ECC_SADDR
+     * |        |          |before triggering START.
+     * @var CRPT_T::ECC_DADDR
+     * Offset: 0xA4C  ECC DMA Destination Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DADDR     |ECC DMA Destination Address
+     * |        |          |The ECC accelerator supports DMA function to transfer the DATA and PARAMETER between system memory and ECC accelerator
+     * |        |          |The DADDR keeps the destination address of the data buffer where output data of ECC engine will be stored
+     * |        |          |Based on the destination address, the ECC accelerator can write the result data back to system memory after the ECC operation is finished
+     * |        |          |The start of destination address should be located at word boundary
+     * |        |          |That is, bit 1 and 0 of DADDR are ignored
+     * |        |          |DADDR can be read and written
+     * |        |          |In DMA mode, software must update the CRPT_ECC_DADDR before triggering START
+     * @var CRPT_T::ECC_STARTREG
+     * Offset: 0xA50  ECC Starting Address of Updated Registers
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |STARTREG  |ECC Starting Address of Updated Registers
+     * |        |          |The address of the updated registers that DMA feeds the first data or parameter to ECC engine
+     * |        |          |When ECC engine is active, ECC accelerator does not allow users to modify STARTREG
+     * |        |          |For example, we want to updated input data from register CRPT_ECC POINTX1
+     * |        |          |Thus, the value of STARTREG is 0x808.
+     * @var CRPT_T::ECC_WORDCNT
+     * Offset: 0xA54  ECC DMA Word Count
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |WORDCNT   |ECC DMA Word Count
+     * |        |          |The CRPT_ECC_WORDCNT keeps the word count of source data that is for the required input data of ECC accelerator with various operations in DMA mode
+     * |        |          |Although CRPT_ECC_WORDCNT is 32-bit, the maximum of word count in ECC accelerator is 144 words
+     * |        |          |CRPT_ECC_WORDCNT can be read and written
+     */
+    __IO uint32_t INTEN;                 /*!< [0x0000] Crypto Interrupt Enable Control Register                         */
+    __IO uint32_t INTSTS;                /*!< [0x0004] Crypto Interrupt Flag                                            */
+    __IO uint32_t PRNG_CTL;              /*!< [0x0008] PRNG Control Register                                            */
+    __O  uint32_t PRNG_SEED;             /*!< [0x000c] Seed for PRNG                                                    */
+    __I  uint32_t PRNG_KEY[8];           /*!< [0x0010] ~ [0x002c] PRNG Generated Key0 ~ Key7                            */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE0[8];
+    /// @endcond //HIDDEN_SYMBOLS
+    __I  uint32_t AES_FDBCK[4];          /*!< [0x0050] ~ [0x005c] AES Engine Output Feedback Data after Cryptographic Operation     */
+    __I  uint32_t TDES_FDBCKH;           /*!< [0x0060] TDES/DES Engine Output Feedback High Word Data after Cryptographic Operation */
+    __I  uint32_t TDES_FDBCKL;           /*!< [0x0064] TDES/DES Engine Output Feedback Low Word Data after Cryptographic Operation  */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE1[38];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t AES_CTL;               /*!< [0x0100] AES Control Register                                             */
+    __I  uint32_t AES_STS;               /*!< [0x0104] AES Engine Flag                                                  */
+    __IO uint32_t AES_DATIN;             /*!< [0x0108] AES Engine Data Input Port Register                              */
+    __I  uint32_t AES_DATOUT;            /*!< [0x010c] AES Engine Data Output Port Register                             */
+    __IO uint32_t AES0_KEY[8];           /*!< [0x0110] ~ [0x012c] AES Key Word 0~7 Register for Channel 0               */
+    __IO uint32_t AES0_IV[4];            /*!< [0x0130] ~ [0x013c] AES Initial Vector Word 0 ~ 3 Register for Channel 0  */
+    __IO uint32_t AES0_SADDR;            /*!< [0x0140] AES DMA Source Address Register for Channel 0                    */
+    __IO uint32_t AES0_DADDR;            /*!< [0x0144] AES DMA Destination Address Register for Channel 0               */
+    __IO uint32_t AES0_CNT;              /*!< [0x0148] AES Byte Count Register for Channel 0                            */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE2[109];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t HMAC_CTL;              /*!< [0x0300] SHA/HMAC Control Register                                        */
+    __I  uint32_t HMAC_STS;              /*!< [0x0304] SHA/HMAC Status Flag                                             */
+    __I  uint32_t HMAC_DGST[16];         /*!< [0x0308] ~ [0x0344] SHA/HMAC Digest Message 0~15                          */
+    __IO uint32_t HMAC_KEYCNT;           /*!< [0x0348] SHA/HMAC Key Byte Count Register                                 */
+    __IO uint32_t HMAC_SADDR;            /*!< [0x034c] SHA/HMAC DMA Source Address Register                             */
+    __IO uint32_t HMAC_DMACNT;           /*!< [0x0350] SHA/HMAC Byte Count Register                                     */
+    __IO uint32_t HMAC_DATIN;            /*!< [0x0354] SHA/HMAC Engine Non-DMA Mode Data Input Port Register            */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE3[298];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t ECC_CTL;               /*!< [0x0800] ECC Control Register                                             */
+    __I  uint32_t ECC_STS;               /*!< [0x0804] ECC Status Register                                              */
+    __IO uint32_t ECC_X1[18];            /*!< [0x0808] ~ [0x084c] ECC The X-coordinate word 0~17 of the first point     */
+    __IO uint32_t ECC_Y1[18];            /*!< [0x0850] ~ [0x0894] ECC The Y-coordinate word 0~17 of the first point     */
+    __IO uint32_t ECC_X2[18];            /*!< [0x0898] ~ [0x08dc] ECC The X-coordinate word 0~17 of the second point    */
+    __IO uint32_t ECC_Y2[18];            /*!< [0x08e0] ~ [0x0924] ECC The Y-coordinate word 0~17 of the second point    */
+    __IO uint32_t ECC_A[18];             /*!< [0x0928] ~ [0x096c] ECC The parameter CURVEA word 0~17 of elliptic curve  */
+    __IO uint32_t ECC_B[18];             /*!< [0x0970] ~ [0x09b4] ECC The parameter CURVEB word 0~17 of elliptic curve  */
+    __IO uint32_t ECC_N[18];             /*!< [0x09b8] ~ [0x09fc] ECC The parameter CURVEN word 0~17 of elliptic curve  */
+    __O  uint32_t ECC_K[18];             /*!< [0x0a00] ~ [0x0a44] ECC The scalar SCALARK word 0~17 of point multiplication */
+    __IO uint32_t ECC_SADDR;             /*!< [0x0a48] ECC DMA Source Address Register                                  */
+    __IO uint32_t ECC_DADDR;             /*!< [0x0a4c] ECC DMA Destination Address Register                             */
+    __IO uint32_t ECC_STARTREG;          /*!< [0x0a50] ECC Starting Address of Updated Registers                        */
+    __IO uint32_t ECC_WORDCNT;           /*!< [0x0a54] ECC DMA Word Count                                               */
+    /// @cond HIDDEN_SYMBOLS
+    uint32_t RESERVE4[358];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t ECC_FSM_DBG;           /* Offset 0xFF0:         ECC FSM Debug Register                                */
+    /// @cond HIDDEN_SYMBOLS
+    uint32_t RESERVE5[3];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t RSA_CTL;               /* Offset 0x1000: RSA Control Register                                         */
+    __IO uint32_t RSA_STS;               /* Offset 0x1004: RSA Status Register                                          */
+    __IO uint32_t RSA_M[128];            /* Offset 0x1008: RSA the base of exponentiation words                         */
+    __IO uint32_t RSA_E[128];            /* Offset 0x1208: RSA the exponent of exponentiation words                     */
+    __IO uint32_t RSA_N[128];            /* Offset 0x1408: RSA the base of modulus operation word                       */
+    __IO uint32_t RSA_C[128];            /* Offset 0x1608: RSA the constant value of Montgomery domain words            */
+    __IO uint32_t RSA_SADDR;             /* Offset 0x1808: RSA DMA Source Address Register                              */
+    __IO uint32_t RSA_DADDR;             /* Offset 0x180C: RSA DMA Destination Address Register                         */
+    __IO uint32_t RSA_STARTREG;          /* Offset 0x1810: RSA Starting Address of Updated Registers                    */
+    __IO uint32_t RSA_WORDCNT;           /* Offset 0x1814: RSA DMA Word Count                                           */
+} CRPT_T;
+
+#define CRPT      ((CRPT_T *)0xB001C000)
+
+/**
+    @addtogroup CRPT_CONST CRPT Bit Field Definition
+    Constant Definitions for CRPT Controller
+@{ */
+
+#define CRPT_INTEN_AESIEN_Pos            (0)                                               /*!< CRPT_T::INTEN: AESIEN Position         */
+#define CRPT_INTEN_AESIEN_Msk            (0x1ul << CRPT_INTEN_AESIEN_Pos)                  /*!< CRPT_T::INTEN: AESIEN Mask             */
+
+#define CRPT_INTEN_AESEIEN_Pos           (1)                                               /*!< CRPT_T::INTEN: AESEIEN Position        */
+#define CRPT_INTEN_AESEIEN_Msk           (0x1ul << CRPT_INTEN_AESEIEN_Pos)                 /*!< CRPT_T::INTEN: AESEIEN Mask            */
+
+#define CRPT_INTEN_TDESIEN_Pos           (8)                                               /*!< CRPT_T::INTEN: TDESIEN Position        */
+#define CRPT_INTEN_TDESIEN_Msk           (0x1ul << CRPT_INTEN_TDESIEN_Pos)                 /*!< CRPT_T::INTEN: TDESIEN Mask            */
+
+#define CRPT_INTEN_TDESEIEN_Pos          (9)                                               /*!< CRPT_T::INTEN: TDESEIEN Position       */
+#define CRPT_INTEN_TDESEIEN_Msk          (0x1ul << CRPT_INTEN_TDESEIEN_Pos)                /*!< CRPT_T::INTEN: TDESEIEN Mask           */
+
+#define CRPT_INTEN_PRNGIEN_Pos           (16)                                              /*!< CRPT_T::INTEN: PRNGIEN Position        */
+#define CRPT_INTEN_PRNGIEN_Msk           (0x1ul << CRPT_INTEN_PRNGIEN_Pos)                 /*!< CRPT_T::INTEN: PRNGIEN Mask            */
+
+#define CRPT_INTEN_ECCIEN_Pos            (22)                                              /*!< CRPT_T::INTEN: ECCIEN Position         */
+#define CRPT_INTEN_ECCIEN_Msk            (0x1ul << CRPT_INTEN_ECCIEN_Pos)                  /*!< CRPT_T::INTEN: ECCIEN Mask             */
+
+#define CRPT_INTEN_ECCEIEN_Pos           (23)                                              /*!< CRPT_T::INTEN: ECCEIEN Position        */
+#define CRPT_INTEN_ECCEIEN_Msk           (0x1ul << CRPT_INTEN_ECCEIEN_Pos)                 /*!< CRPT_T::INTEN: ECCEIEN Mask            */
+
+#define CRPT_INTEN_HMACIEN_Pos           (24)                                              /*!< CRPT_T::INTEN: HMACIEN Position        */
+#define CRPT_INTEN_HMACIEN_Msk           (0x1ul << CRPT_INTEN_HMACIEN_Pos)                 /*!< CRPT_T::INTEN: HMACIEN Mask            */
+
+#define CRPT_INTEN_HMACEIEN_Pos          (25)                                              /*!< CRPT_T::INTEN: HMACEIEN Position       */
+#define CRPT_INTEN_HMACEIEN_Msk          (0x1ul << CRPT_INTEN_HMACEIEN_Pos)                /*!< CRPT_T::INTEN: HMACEIEN Mask           */
+
+#define CRPT_INTSTS_AESIF_Pos            (0)                                               /*!< CRPT_T::INTSTS: AESIF Position         */
+#define CRPT_INTSTS_AESIF_Msk            (0x1ul << CRPT_INTSTS_AESIF_Pos)                  /*!< CRPT_T::INTSTS: AESIF Mask             */
+
+#define CRPT_INTSTS_AESEIF_Pos           (1)                                               /*!< CRPT_T::INTSTS: AESEIF Position        */
+#define CRPT_INTSTS_AESEIF_Msk           (0x1ul << CRPT_INTSTS_AESEIF_Pos)                 /*!< CRPT_T::INTSTS: AESEIF Mask            */
+
+#define CRPT_INTSTS_TDESIF_Pos           (8)                                               /*!< CRPT_T::INTSTS: TDESIF Position        */
+#define CRPT_INTSTS_TDESIF_Msk           (0x1ul << CRPT_INTSTS_TDESIF_Pos)                 /*!< CRPT_T::INTSTS: TDESIF Mask            */
+
+#define CRPT_INTSTS_TDESEIF_Pos          (9)                                               /*!< CRPT_T::INTSTS: TDESEIF Position       */
+#define CRPT_INTSTS_TDESEIF_Msk          (0x1ul << CRPT_INTSTS_TDESEIF_Pos)                /*!< CRPT_T::INTSTS: TDESEIF Mask           */
+
+#define CRPT_INTSTS_PRNGIF_Pos           (16)                                              /*!< CRPT_T::INTSTS: PRNGIF Position        */
+#define CRPT_INTSTS_PRNGIF_Msk           (0x1ul << CRPT_INTSTS_PRNGIF_Pos)                 /*!< CRPT_T::INTSTS: PRNGIF Mask            */
+
+#define CRPT_INTSTS_ECCIF_Pos            (22)                                              /*!< CRPT_T::INTSTS: ECCIF Position         */
+#define CRPT_INTSTS_ECCIF_Msk            (0x1ul << CRPT_INTSTS_ECCIF_Pos)                  /*!< CRPT_T::INTSTS: ECCIF Mask             */
+
+#define CRPT_INTSTS_ECCEIF_Pos           (23)                                              /*!< CRPT_T::INTSTS: ECCEIF Position        */
+#define CRPT_INTSTS_ECCEIF_Msk           (0x1ul << CRPT_INTSTS_ECCEIF_Pos)                 /*!< CRPT_T::INTSTS: ECCEIF Mask            */
+
+#define CRPT_INTSTS_HMACIF_Pos           (24)                                              /*!< CRPT_T::INTSTS: HMACIF Position        */
+#define CRPT_INTSTS_HMACIF_Msk           (0x1ul << CRPT_INTSTS_HMACIF_Pos)                 /*!< CRPT_T::INTSTS: HMACIF Mask            */
+
+#define CRPT_INTSTS_HMACEIF_Pos          (25)                                              /*!< CRPT_T::INTSTS: HMACEIF Position       */
+#define CRPT_INTSTS_HMACEIF_Msk          (0x1ul << CRPT_INTSTS_HMACEIF_Pos)                /*!< CRPT_T::INTSTS: HMACEIF Mask           */
+
+#define CRPT_PRNG_CTL_START_Pos          (0)                                               /*!< CRPT_T::PRNG_CTL: START Position       */
+#define CRPT_PRNG_CTL_START_Msk          (0x1ul << CRPT_PRNG_CTL_START_Pos)                /*!< CRPT_T::PRNG_CTL: START Mask           */
+
+#define CRPT_PRNG_CTL_SEEDRLD_Pos        (1)                                               /*!< CRPT_T::PRNG_CTL: SEEDRLD Position     */
+#define CRPT_PRNG_CTL_SEEDRLD_Msk        (0x1ul << CRPT_PRNG_CTL_SEEDRLD_Pos)              /*!< CRPT_T::PRNG_CTL: SEEDRLD Mask         */
+
+#define CRPT_PRNG_CTL_KEYSZ_Pos          (2)                                               /*!< CRPT_T::PRNG_CTL: KEYSZ Position       */
+#define CRPT_PRNG_CTL_KEYSZ_Msk          (0x3ul << CRPT_PRNG_CTL_KEYSZ_Pos)                /*!< CRPT_T::PRNG_CTL: KEYSZ Mask           */
+
+#define CRPT_PRNG_CTL_BUSY_Pos           (8)                                               /*!< CRPT_T::PRNG_CTL: BUSY Position        */
+#define CRPT_PRNG_CTL_BUSY_Msk           (0x1ul << CRPT_PRNG_CTL_BUSY_Pos)                 /*!< CRPT_T::PRNG_CTL: BUSY Mask            */
+
+#define CRPT_PRNG_SEED_SEED_Pos          (0)                                               /*!< CRPT_T::PRNG_SEED: SEED Position       */
+#define CRPT_PRNG_SEED_SEED_Msk          (0xfffffffful << CRPT_PRNG_SEED_SEED_Pos)         /*!< CRPT_T::PRNG_SEED: SEED Mask           */
+
+#define CRPT_PRNG_KEYx_KEY_Pos           (0)                                               /*!< CRPT_T::PRNG_KEY[8]: KEY Position      */
+#define CRPT_PRNG_KEYx_KEY_Msk           (0xfffffffful << CRPT_PRNG_KEYx_KEY_Pos)          /*!< CRPT_T::PRNG_KEY[8]: KEY Mask          */
+
+#define CRPT_AES_FDBCKx_FDBCK_Pos        (0)                                               /*!< CRPT_T::AES_FDBCK[4]: FDBCK Position   */
+#define CRPT_AES_FDBCKx_FDBCK_Msk        (0xfffffffful << CRPT_AES_FDBCKx_FDBCK_Pos)       /*!< CRPT_T::AES_FDBCK[4]: FDBCK Mask       */
+
+#define CRPT_TDES_FDBCKH_FDBCK_Pos       (0)                                               /*!< CRPT_T::TDES_FDBCKH: FDBCK Position    */
+#define CRPT_TDES_FDBCKH_FDBCK_Msk       (0xfffffffful << CRPT_TDES_FDBCKH_FDBCK_Pos)      /*!< CRPT_T::TDES_FDBCKH: FDBCK Mask        */
+
+#define CRPT_TDES_FDBCKL_FDBCK_Pos       (0)                                               /*!< CRPT_T::TDES_FDBCKL: FDBCK Position    */
+#define CRPT_TDES_FDBCKL_FDBCK_Msk       (0xfffffffful << CRPT_TDES_FDBCKL_FDBCK_Pos)      /*!< CRPT_T::TDES_FDBCKL: FDBCK Mask        */
+
+#define CRPT_AES_CTL_START_Pos           (0)                                               /*!< CRPT_T::AES_CTL: START Position        */
+#define CRPT_AES_CTL_START_Msk           (0x1ul << CRPT_AES_CTL_START_Pos)                 /*!< CRPT_T::AES_CTL: START Mask            */
+
+#define CRPT_AES_CTL_STOP_Pos            (1)                                               /*!< CRPT_T::AES_CTL: STOP Position         */
+#define CRPT_AES_CTL_STOP_Msk            (0x1ul << CRPT_AES_CTL_STOP_Pos)                  /*!< CRPT_T::AES_CTL: STOP Mask             */
+
+#define CRPT_AES_CTL_KEYSZ_Pos           (2)                                               /*!< CRPT_T::AES_CTL: KEYSZ Position        */
+#define CRPT_AES_CTL_KEYSZ_Msk           (0x3ul << CRPT_AES_CTL_KEYSZ_Pos)                 /*!< CRPT_T::AES_CTL: KEYSZ Mask            */
+
+#define CRPT_AES_CTL_DMALAST_Pos         (5)                                               /*!< CRPT_T::AES_CTL: DMALAST Position      */
+#define CRPT_AES_CTL_DMALAST_Msk         (0x1ul << CRPT_AES_CTL_DMALAST_Pos)               /*!< CRPT_T::AES_CTL: DMALAST Mask          */
+
+#define CRPT_AES_CTL_DMACSCAD_Pos        (6)                                               /*!< CRPT_T::AES_CTL: DMACSCAD Position     */
+#define CRPT_AES_CTL_DMACSCAD_Msk        (0x1ul << CRPT_AES_CTL_DMACSCAD_Pos)              /*!< CRPT_T::AES_CTL: DMACSCAD Mask         */
+
+#define CRPT_AES_CTL_DMAEN_Pos           (7)                                               /*!< CRPT_T::AES_CTL: DMAEN Position        */
+#define CRPT_AES_CTL_DMAEN_Msk           (0x1ul << CRPT_AES_CTL_DMAEN_Pos)                 /*!< CRPT_T::AES_CTL: DMAEN Mask            */
+
+#define CRPT_AES_CTL_OPMODE_Pos          (8)                                               /*!< CRPT_T::AES_CTL: OPMODE Position       */
+#define CRPT_AES_CTL_OPMODE_Msk          (0xfful << CRPT_AES_CTL_OPMODE_Pos)               /*!< CRPT_T::AES_CTL: OPMODE Mask           */
+
+#define CRPT_AES_CTL_ENCRPT_Pos          (16)                                              /*!< CRPT_T::AES_CTL: ENCRPT Position       */
+#define CRPT_AES_CTL_ENCRPT_Msk          (0x1ul << CRPT_AES_CTL_ENCRPT_Pos)                /*!< CRPT_T::AES_CTL: ENCRPT Mask           */
+
+#define CRPT_AES_CTL_OUTSWAP_Pos         (22)                                              /*!< CRPT_T::AES_CTL: OUTSWAP Position      */
+#define CRPT_AES_CTL_OUTSWAP_Msk         (0x1ul << CRPT_AES_CTL_OUTSWAP_Pos)               /*!< CRPT_T::AES_CTL: OUTSWAP Mask          */
+
+#define CRPT_AES_CTL_INSWAP_Pos          (23)                                              /*!< CRPT_T::AES_CTL: INSWAP Position       */
+#define CRPT_AES_CTL_INSWAP_Msk          (0x1ul << CRPT_AES_CTL_INSWAP_Pos)                /*!< CRPT_T::AES_CTL: INSWAP Mask           */
+
+#define CRPT_AES_CTL_CHANNEL_Pos         (24)                                              /*!< CRPT_T::AES_CTL: CHANNEL Position      */
+#define CRPT_AES_CTL_CHANNEL_Msk         (0x3ul << CRPT_AES_CTL_CHANNEL_Pos)               /*!< CRPT_T::AES_CTL: CHANNEL Mask          */
+
+#define CRPT_AES_CTL_KEYUNPRT_Pos        (26)                                              /*!< CRPT_T::AES_CTL: KEYUNPRT Position     */
+#define CRPT_AES_CTL_KEYUNPRT_Msk        (0x1ful << CRPT_AES_CTL_KEYUNPRT_Pos)             /*!< CRPT_T::AES_CTL: KEYUNPRT Mask         */
+
+#define CRPT_AES_CTL_KEYPRT_Pos          (31)                                              /*!< CRPT_T::AES_CTL: KEYPRT Position       */
+#define CRPT_AES_CTL_KEYPRT_Msk          (0x1ul << CRPT_AES_CTL_KEYPRT_Pos)                /*!< CRPT_T::AES_CTL: KEYPRT Mask           */
+
+#define CRPT_AES_STS_BUSY_Pos            (0)                                               /*!< CRPT_T::AES_STS: BUSY Position         */
+#define CRPT_AES_STS_BUSY_Msk            (0x1ul << CRPT_AES_STS_BUSY_Pos)                  /*!< CRPT_T::AES_STS: BUSY Mask             */
+
+#define CRPT_AES_STS_INBUFEMPTY_Pos      (8)                                               /*!< CRPT_T::AES_STS: INBUFEMPTY Position   */
+#define CRPT_AES_STS_INBUFEMPTY_Msk      (0x1ul << CRPT_AES_STS_INBUFEMPTY_Pos)            /*!< CRPT_T::AES_STS: INBUFEMPTY Mask       */
+
+#define CRPT_AES_STS_INBUFFULL_Pos       (9)                                               /*!< CRPT_T::AES_STS: INBUFFULL Position    */
+#define CRPT_AES_STS_INBUFFULL_Msk       (0x1ul << CRPT_AES_STS_INBUFFULL_Pos)             /*!< CRPT_T::AES_STS: INBUFFULL Mask        */
+
+#define CRPT_AES_STS_INBUFERR_Pos        (10)                                              /*!< CRPT_T::AES_STS: INBUFERR Position     */
+#define CRPT_AES_STS_INBUFERR_Msk        (0x1ul << CRPT_AES_STS_INBUFERR_Pos)              /*!< CRPT_T::AES_STS: INBUFERR Mask         */
+
+#define CRPT_AES_STS_CNTERR_Pos          (12)                                              /*!< CRPT_T::AES_STS: CNTERR Position       */
+#define CRPT_AES_STS_CNTERR_Msk          (0x1ul << CRPT_AES_STS_CNTERR_Pos)                /*!< CRPT_T::AES_STS: CNTERR Mask           */
+
+#define CRPT_AES_STS_OUTBUFEMPTY_Pos     (16)                                              /*!< CRPT_T::AES_STS: OUTBUFEMPTY Position  */
+#define CRPT_AES_STS_OUTBUFEMPTY_Msk     (0x1ul << CRPT_AES_STS_OUTBUFEMPTY_Pos)           /*!< CRPT_T::AES_STS: OUTBUFEMPTY Mask      */
+
+#define CRPT_AES_STS_OUTBUFFULL_Pos      (17)                                              /*!< CRPT_T::AES_STS: OUTBUFFULL Position   */
+#define CRPT_AES_STS_OUTBUFFULL_Msk      (0x1ul << CRPT_AES_STS_OUTBUFFULL_Pos)            /*!< CRPT_T::AES_STS: OUTBUFFULL Mask       */
+
+#define CRPT_AES_STS_OUTBUFERR_Pos       (18)                                              /*!< CRPT_T::AES_STS: OUTBUFERR Position    */
+#define CRPT_AES_STS_OUTBUFERR_Msk       (0x1ul << CRPT_AES_STS_OUTBUFERR_Pos)             /*!< CRPT_T::AES_STS: OUTBUFERR Mask        */
+
+#define CRPT_AES_STS_BUSERR_Pos          (20)                                              /*!< CRPT_T::AES_STS: BUSERR Position       */
+#define CRPT_AES_STS_BUSERR_Msk          (0x1ul << CRPT_AES_STS_BUSERR_Pos)                /*!< CRPT_T::AES_STS: BUSERR Mask           */
+
+#define CRPT_AES_DATIN_DATIN_Pos         (0)                                               /*!< CRPT_T::AES_DATIN: DATIN Position      */
+#define CRPT_AES_DATIN_DATIN_Msk         (0xfffffffful << CRPT_AES_DATIN_DATIN_Pos)        /*!< CRPT_T::AES_DATIN: DATIN Mask          */
+
+#define CRPT_AES_DATOUT_DATOUT_Pos       (0)                                               /*!< CRPT_T::AES_DATOUT: DATOUT Position    */
+#define CRPT_AES_DATOUT_DATOUT_Msk       (0xfffffffful << CRPT_AES_DATOUT_DATOUT_Pos)      /*!< CRPT_T::AES_DATOUT: DATOUT Mask        */
+
+#define CRPT_AES0_KEYx_KEY_Pos           (0)                                               /*!< CRPT_T::AES0_KEY[8]: KEY Position      */
+#define CRPT_AES0_KEYx_KEY_Msk           (0xfffffffful << CRPT_AES0_KEYx_KEY_Pos)          /*!< CRPT_T::AES0_KEY[8]: KEY Mask          */
+
+#define CRPT_AES0_IVx_IV_Pos             (0)                                               /*!< CRPT_T::AES0_IV[4]: IV Position        */
+#define CRPT_AES0_IVx_IV_Msk             (0xfffffffful << CRPT_AES0_IVx_IV_Pos)            /*!< CRPT_T::AES0_IV[4]: IV Mask            */
+
+#define CRPT_AES0_SADDR_SADDR_Pos        (0)                                               /*!< CRPT_T::AES0_SADDR: SADDR Position     */
+#define CRPT_AES0_SADDR_SADDR_Msk        (0xfffffffful << CRPT_AES0_SADDR_SADDR_Pos)       /*!< CRPT_T::AES0_SADDR: SADDR Mask         */
+
+#define CRPT_AES0_DADDR_DADDR_Pos        (0)                                               /*!< CRPT_T::AES0_DADDR: DADDR Position     */
+#define CRPT_AES0_DADDR_DADDR_Msk        (0xfffffffful << CRPT_AES0_DADDR_DADDR_Pos)       /*!< CRPT_T::AES0_DADDR: DADDR Mask         */
+
+#define CRPT_AES0_CNT_CNT_Pos            (0)                                               /*!< CRPT_T::AES0_CNT: CNT Position         */
+#define CRPT_AES0_CNT_CNT_Msk            (0xfffffffful << CRPT_AES0_CNT_CNT_Pos)           /*!< CRPT_T::AES0_CNT: CNT Mask             */
+
+#define CRPT_HMAC_CTL_START_Pos          (0)                                               /*!< CRPT_T::HMAC_CTL: START Position       */
+#define CRPT_HMAC_CTL_START_Msk          (0x1ul << CRPT_HMAC_CTL_START_Pos)                /*!< CRPT_T::HMAC_CTL: START Mask           */
+
+#define CRPT_HMAC_CTL_STOP_Pos           (1)                                               /*!< CRPT_T::HMAC_CTL: STOP Position        */
+#define CRPT_HMAC_CTL_STOP_Msk           (0x1ul << CRPT_HMAC_CTL_STOP_Pos)                 /*!< CRPT_T::HMAC_CTL: STOP Mask            */
+
+#define CRPT_HMAC_CTL_HMACEN_Pos         (4)                                               /*!< CRPT_T::HMAC_CTL: HMACEN Position      */
+#define CRPT_HMAC_CTL_HMACEN_Msk         (0x1ul << CRPT_HMAC_CTL_HMACEN_Pos)               /*!< CRPT_T::HMAC_CTL: HMACEN Mask          */
+
+#define CRPT_HMAC_CTL_DMALAST_Pos        (5)                                               /*!< CRPT_T::HMAC_CTL: DMALAST Position     */
+#define CRPT_HMAC_CTL_DMALAST_Msk        (0x1ul << CRPT_HMAC_CTL_DMALAST_Pos)              /*!< CRPT_T::HMAC_CTL: DMALAST Mask         */
+
+#define CRPT_HMAC_CTL_DMAEN_Pos          (7)                                               /*!< CRPT_T::HMAC_CTL: DMAEN Position       */
+#define CRPT_HMAC_CTL_DMAEN_Msk          (0x1ul << CRPT_HMAC_CTL_DMAEN_Pos)                /*!< CRPT_T::HMAC_CTL: DMAEN Mask           */
+
+#define CRPT_HMAC_CTL_OPMODE_Pos         (8)                                               /*!< CRPT_T::HMAC_CTL: OPMODE Position      */
+#define CRPT_HMAC_CTL_OPMODE_Msk         (0x7ul << CRPT_HMAC_CTL_OPMODE_Pos)               /*!< CRPT_T::HMAC_CTL: OPMODE Mask          */
+
+#define CRPT_HMAC_CTL_OUTSWAP_Pos        (22)                                              /*!< CRPT_T::HMAC_CTL: OUTSWAP Position     */
+#define CRPT_HMAC_CTL_OUTSWAP_Msk        (0x1ul << CRPT_HMAC_CTL_OUTSWAP_Pos)              /*!< CRPT_T::HMAC_CTL: OUTSWAP Mask         */
+
+#define CRPT_HMAC_CTL_INSWAP_Pos         (23)                                              /*!< CRPT_T::HMAC_CTL: INSWAP Position      */
+#define CRPT_HMAC_CTL_INSWAP_Msk         (0x1ul << CRPT_HMAC_CTL_INSWAP_Pos)               /*!< CRPT_T::HMAC_CTL: INSWAP Mask          */
+
+#define CRPT_HMAC_STS_BUSY_Pos           (0)                                               /*!< CRPT_T::HMAC_STS: BUSY Position        */
+#define CRPT_HMAC_STS_BUSY_Msk           (0x1ul << CRPT_HMAC_STS_BUSY_Pos)                 /*!< CRPT_T::HMAC_STS: BUSY Mask            */
+
+#define CRPT_HMAC_STS_DMABUSY_Pos        (1)                                               /*!< CRPT_T::HMAC_STS: DMABUSY Position     */
+#define CRPT_HMAC_STS_DMABUSY_Msk        (0x1ul << CRPT_HMAC_STS_DMABUSY_Pos)              /*!< CRPT_T::HMAC_STS: DMABUSY Mask         */
+
+#define CRPT_HMAC_STS_DMAERR_Pos         (8)                                               /*!< CRPT_T::HMAC_STS: DMAERR Position      */
+#define CRPT_HMAC_STS_DMAERR_Msk         (0x1ul << CRPT_HMAC_STS_DMAERR_Pos)               /*!< CRPT_T::HMAC_STS: DMAERR Mask          */
+
+#define CRPT_HMAC_STS_DATINREQ_Pos       (16)                                              /*!< CRPT_T::HMAC_STS: DATINREQ Position    */
+#define CRPT_HMAC_STS_DATINREQ_Msk       (0x1ul << CRPT_HMAC_STS_DATINREQ_Pos)             /*!< CRPT_T::HMAC_STS: DATINREQ Mask        */
+
+#define CRPT_HMAC_DGSTx_DGST_Pos         (0)                                               /*!< CRPT_T::HMAC_DGST[16]: DGST Position   */
+#define CRPT_HMAC_DGSTx_DGST_Msk         (0xfffffffful << CRPT_HMAC_DGSTx_DGST_Pos)        /*!< CRPT_T::HMAC_DGST[16]: DGST Mask       */
+
+#define CRPT_HMAC_KEYCNT_KEYCNT_Pos      (0)                                               /*!< CRPT_T::HMAC_KEYCNT: KEYCNT Position   */
+#define CRPT_HMAC_KEYCNT_KEYCNT_Msk      (0xfffffffful << CRPT_HMAC_KEYCNT_KEYCNT_Pos)     /*!< CRPT_T::HMAC_KEYCNT: KEYCNT Mask       */
+
+#define CRPT_HMAC_SADDR_SADDR_Pos        (0)                                               /*!< CRPT_T::HMAC_SADDR: SADDR Position     */
+#define CRPT_HMAC_SADDR_SADDR_Msk        (0xfffffffful << CRPT_HMAC_SADDR_SADDR_Pos)       /*!< CRPT_T::HMAC_SADDR: SADDR Mask         */
+
+#define CRPT_HMAC_DMACNT_DMACNT_Pos      (0)                                               /*!< CRPT_T::HMAC_DMACNT: DMACNT Position   */
+#define CRPT_HMAC_DMACNT_DMACNT_Msk      (0xfffffffful << CRPT_HMAC_DMACNT_DMACNT_Pos)     /*!< CRPT_T::HMAC_DMACNT: DMACNT Mask       */
+
+#define CRPT_HMAC_DATIN_DATIN_Pos        (0)                                               /*!< CRPT_T::HMAC_DATIN: DATIN Position     */
+#define CRPT_HMAC_DATIN_DATIN_Msk        (0xfffffffful << CRPT_HMAC_DATIN_DATIN_Pos)       /*!< CRPT_T::HMAC_DATIN: DATIN Mask         */
+
+#define CRPT_ECC_CTL_START_Pos           (0)                                               /*!< CRPT_T::ECC_CTL: START Position        */
+#define CRPT_ECC_CTL_START_Msk           (0x1ul << CRPT_ECC_CTL_START_Pos)                 /*!< CRPT_T::ECC_CTL: START Mask            */
+
+#define CRPT_ECC_CTL_STOP_Pos            (1)                                               /*!< CRPT_T::ECC_CTL: STOP Position         */
+#define CRPT_ECC_CTL_STOP_Msk            (0x1ul << CRPT_ECC_CTL_STOP_Pos)                  /*!< CRPT_T::ECC_CTL: STOP Mask             */
+
+#define CRPT_ECC_CTL_DMAEN_Pos           (7)                                               /*!< CRPT_T::ECC_CTL: DMAEN Position        */
+#define CRPT_ECC_CTL_DMAEN_Msk           (0x1ul << CRPT_ECC_CTL_DMAEN_Pos)                 /*!< CRPT_T::ECC_CTL: DMAEN Mask            */
+
+#define CRPT_ECC_CTL_FSEL_Pos            (8)                                               /*!< CRPT_T::ECC_CTL: FSEL Position         */
+#define CRPT_ECC_CTL_FSEL_Msk            (0x1ul << CRPT_ECC_CTL_FSEL_Pos)                  /*!< CRPT_T::ECC_CTL: FSEL Mask             */
+
+#define CRPT_ECC_CTL_ECCOP_Pos           (9)                                               /*!< CRPT_T::ECC_CTL: ECCOP Position        */
+#define CRPT_ECC_CTL_ECCOP_Msk           (0x3ul << CRPT_ECC_CTL_ECCOP_Pos)                 /*!< CRPT_T::ECC_CTL: ECCOP Mask            */
+
+#define CRPT_ECC_CTL_MODOP_Pos           (11)                                              /*!< CRPT_T::ECC_CTL: MODOP Position        */
+#define CRPT_ECC_CTL_MODOP_Msk           (0x3ul << CRPT_ECC_CTL_MODOP_Pos)                 /*!< CRPT_T::ECC_CTL: MODOP Mask            */
+
+#define CRPT_ECC_CTL_LDP1_Pos            (16)                                              /*!< CRPT_T::ECC_CTL: LDP1 Position         */
+#define CRPT_ECC_CTL_LDP1_Msk            (0x1ul << CRPT_ECC_CTL_LDP1_Pos)                  /*!< CRPT_T::ECC_CTL: LDP1 Mask             */
+
+#define CRPT_ECC_CTL_LDP2_Pos            (17)                                              /*!< CRPT_T::ECC_CTL: LDP2 Position         */
+#define CRPT_ECC_CTL_LDP2_Msk            (0x1ul << CRPT_ECC_CTL_LDP2_Pos)                  /*!< CRPT_T::ECC_CTL: LDP2 Mask             */
+
+#define CRPT_ECC_CTL_LDA_Pos             (18)                                              /*!< CRPT_T::ECC_CTL: LDA Position          */
+#define CRPT_ECC_CTL_LDA_Msk             (0x1ul << CRPT_ECC_CTL_LDA_Pos)                   /*!< CRPT_T::ECC_CTL: LDA Mask              */
+
+#define CRPT_ECC_CTL_LDB_Pos             (19)                                              /*!< CRPT_T::ECC_CTL: LDB Position          */
+#define CRPT_ECC_CTL_LDB_Msk             (0x1ul << CRPT_ECC_CTL_LDB_Pos)                   /*!< CRPT_T::ECC_CTL: LDB Mask              */
+
+#define CRPT_ECC_CTL_LDN_Pos             (20)                                              /*!< CRPT_T::ECC_CTL: LDN Position          */
+#define CRPT_ECC_CTL_LDN_Msk             (0x1ul << CRPT_ECC_CTL_LDN_Pos)                   /*!< CRPT_T::ECC_CTL: LDN Mask              */
+
+#define CRPT_ECC_CTL_LDK_Pos             (21)                                              /*!< CRPT_T::ECC_CTL: LDK Position          */
+#define CRPT_ECC_CTL_LDK_Msk             (0x1ul << CRPT_ECC_CTL_LDK_Pos)                   /*!< CRPT_T::ECC_CTL: LDK Mask              */
+
+#define CRPT_ECC_CTL_CURVEM_Pos          (22)                                              /*!< CRPT_T::ECC_CTL: CURVEM Position       */
+#define CRPT_ECC_CTL_CURVEM_Msk          (0x3fful << CRPT_ECC_CTL_CURVEM_Pos)              /*!< CRPT_T::ECC_CTL: CURVEM Mask           */
+
+#define CRPT_ECC_STS_BUSY_Pos            (0)                                               /*!< CRPT_T::ECC_STS: BUSY Position         */
+#define CRPT_ECC_STS_BUSY_Msk            (0x1ul << CRPT_ECC_STS_BUSY_Pos)                  /*!< CRPT_T::ECC_STS: BUSY Mask             */
+
+#define CRPT_ECC_STS_DMABUSY_Pos         (1)                                               /*!< CRPT_T::ECC_STS: DMABUSY Position      */
+#define CRPT_ECC_STS_DMABUSY_Msk         (0x1ul << CRPT_ECC_STS_DMABUSY_Pos)               /*!< CRPT_T::ECC_STS: DMABUSY Mask          */
+
+#define CRPT_ECC_STS_BUSERR_Pos          (16)                                              /*!< CRPT_T::ECC_STS: BUSERR Position       */
+#define CRPT_ECC_STS_BUSERR_Msk          (0x1ul << CRPT_ECC_STS_BUSERR_Pos)                /*!< CRPT_T::ECC_STS: BUSERR Mask           */
+
+#define CRPT_ECC_X1_POINTX1_Pos          (0)                                               /*!< CRPT_T::ECC_X1[18]:  POINTX1 Position  */
+#define CRPT_ECC_X1_POINTX1_Msk          (0xfffffffful << CRPT_ECC_X1_POINTX1_Pos)         /*!< CRPT_T::ECC_X1[18]:  POINTX1 Mask      */
+
+#define CRPT_ECC_Y1_POINTY1_Pos          (0)                                               /*!< CRPT_T::ECC_Y1[18]: POINTY1 Position   */
+#define CRPT_ECC_Y1_POINTY1_Msk          (0xfffffffful << CRPT_ECC_Y1_POINTY1_Pos)         /*!< CRPT_T::ECC_Y1[18]: POINTY1 Mask       */
+
+#define CRPT_ECC_X2_POINTX2_Pos          (0)                                               /*!< CRPT_T::ECC_X2[18]: POINTX2 Position   */
+#define CRPT_ECC_X2_POINTX2_Msk          (0xfffffffful << CRPT_ECC_X2_POINTX2_Pos)         /*!< CRPT_T::ECC_X2[18]: POINTX2 Mask       */
+
+#define CRPT_ECC_Y2_POINTY2_Pos          (0)                                               /*!< CRPT_T::ECC_Y2[18]: POINTY2 Position   */
+#define CRPT_ECC_Y2_POINTY2_Msk          (0xfffffffful << CRPT_ECC_Y2_POINTY2_Pos)         /*!< CRPT_T::ECC_Y2[18]: POINTY2 Mask       */
+
+#define CRPT_ECC_A_CURVEA_Pos            (0)                                               /*!< CRPT_T::ECC_A[18]: CURVEA Position     */
+#define CRPT_ECC_A_CURVEA_Msk            (0xfffffffful << CRPT_ECC_A_CURVEA_Pos)           /*!< CRPT_T::ECC_A[18]: CURVEA Mask         */
+
+#define CRPT_ECC_B_CURVEB_Pos            (0)                                               /*!< CRPT_T::ECC_B[18]: CURVEB Position     */
+#define CRPT_ECC_B_CURVEB_Msk            (0xfffffffful << CRPT_ECC_B_CURVEB_Pos)           /*!< CRPT_T::ECC_B[18]: CURVEB Mask         */
+
+#define CRPT_ECC_N_CURVEN_Pos            (0)                                               /*!< CRPT_T::ECC_N[18]: CURVEN Position     */
+#define CRPT_ECC_N_CURVEN_Msk            (0xfffffffful << CRPT_ECC_N_CURVEN_Pos)           /*!< CRPT_T::ECC_N[18]: CURVEN Mask         */
+
+#define CRPT_ECC_K_SCALARK_Pos           (0)                                               /*!< CRPT_T::ECC_K[18]: SCALARK Position    */
+#define CRPT_ECC_K_SCALARK_Msk           (0xfffffffful << CRPT_ECC_K_SCALARK_Pos)          /*!< CRPT_T::ECC_K[18]: SCALARK Mask        */
+
+#define CRPT_ECC_DADDR_DADDR_Pos         (0)                                               /*!< CRPT_T::ECC_DADDR: DADDR Position      */
+#define CRPT_ECC_DADDR_DADDR_Msk         (0xfffffffful << CRPT_ECC_DADDR_DADDR_Pos)        /*!< CRPT_T::ECC_DADDR: DADDR Mask          */
+
+#define CRPT_ECC_STARTREG_STARTREG_Pos   (0)                                               /*!< CRPT_T::ECC_STARTREG: STARTREG Position*/
+#define CRPT_ECC_STARTREG_STARTREG_Msk   (0xfffffffful << CRPT_ECC_STARTREG_STARTREG_Pos)  /*!< CRPT_T::ECC_STARTREG: STARTREG Mask    */
+
+#define CRPT_ECC_WORDCNT_WORDCNT_Pos     (0)                                               /*!< CRPT_T::ECC_WORDCNT: WORDCNT Position  */
+#define CRPT_ECC_WORDCNT_WORDCNT_Msk     (0xfffffffful << CRPT_ECC_WORDCNT_WORDCNT_Pos)    /*!< CRPT_T::ECC_WORDCNT: WORDCNT Mask      */
+
+#define CRPT_RSA_CTL_START_Pos            (0)                                              /*!< CRPT RSA_CTL: START Position            */
+#define CRPT_RSA_CTL_START_Msk            (0x1ul << CRPT_RSA_CTL_START_Pos)                /*!< CRPT RSA_CTL: START Mask                */
+
+#define CRPT_RSA_CTL_STOP_Pos             (1)                                              /*!< CRPT RSA_CTL: STOP Position             */
+#define CRPT_RSA_CTL_STOP_Msk             (0x1ul << CRPT_RSA_CTL_STOP_Pos)                 /*!< CRPT RSA_CTL: STOP Mask                 */
+
+#define CRPT_RSA_CTL_DMAEN_Pos            (7)                                              /*!< CRPT RSA_CTL: DMAEN Position            */
+#define CRPT_RSA_CTL_DMAEN_Msk            (0x1ul << CRPT_RSA_CTL_DMAEN_Pos)                /*!< CRPT RSA_CTL: DMAEN Mask                */
+
+#define CRPT_RSA_CTL_LDM_Pos              (8)                                              /*!< CRPT RSA_CTL: LDM Position              */
+#define CRPT_RSA_CTL_LDM_Msk              (0x1ul << CRPT_RSA_CTL_LDM_Pos)                  /*!< CRPT RSA_CTL: LDM Mask                  */
+
+#define CRPT_RSA_CTL_LDE_Pos              (9)                                              /*!< CRPT RSA_CTL: LDE Position              */
+#define CRPT_RSA_CTL_LDE_Msk              (0x1ul << CRPT_RSA_CTL_LDE_Pos)                  /*!< CRPT RSA_CTL: LDE Mask                  */
+
+#define CRPT_RSA_CTL_LDN_Pos              (10)                                             /*!< CRPT RSA_CTL: LDN Position              */
+#define CRPT_RSA_CTL_LDN_Msk              (0x1ul << CRPT_RSA_CTL_LDN_Pos)                  /*!< CRPT RSA_CTL: LDN Mask                  */
+
+#define CRPT_RSA_CTL_LDC_Pos              (11)                                             /*!< CRPT RSA_CTL: LDC Position              */
+#define CRPT_RSA_CTL_LDC_Msk              (0x1ul << CRPT_RSA_CTL_LDC_Pos)                  /*!< CRPT RSA_CTL: LDC Mask                  */
+
+#define CRPT_RSA_CTL_KEYLEN_Pos           (16)                                             /*!< CRPT RSA_CTL: KEYLEN Position           */
+#define CRPT_RSA_CTL_KEYLEN_Msk           (0x1FFFul << CRPT_RSA_CTL_KEYLEN_Pos)            /*!< CRPT RSA_CTL: KEYLEN Mask               */
+
+#define CRPT_RSA_STS_BUSY_Pos             (0)                                              /*!< CRPT RSA_STS: BUSY Position             */
+#define CRPT_RSA_STS_BUSY_Msk             (0x1ul << CRPT_RSA_STS_BUSY_Pos)                 /*!< CRPT RSA_STS: BUSY Mask                 */
+
+#define CRPT_RSA_STS_DMABUSY_Pos          (1)                                              /*!< CRPT RSA_STS: DMABUSY Position          */
+#define CRPT_RSA_STS_DMABUSY_Msk          (0x1ul << CRPT_RSA_STS_DMABUSY_Pos)              /*!< CRPT RSA_STS: DMABUSY Mask              */
+
+#define CRPT_RSA_STS_BUSERR_Pos           (16)                                             /*!< CRPT ECC_RSA: BUSERR Position           */
+#define CRPT_RSA_STS_BUSERR_Msk           (0x1ul << CRPT_RSA_STS_BUSERR_Pos)               /*!< CRPT ECC_RSA: BUSERR Mask               */
+
+
+/**@}*/ /* CRPT_CONST CRYPTO */
+
+/**@}*/ /* end of CRYPTO register group */
+
+
+/** @addtogroup CRYPTO_EXPORTED_CONSTANTS CRYPTO Exported Constants
+  @{
+*/
+
+#define PRNG_KEY_SIZE_64        0UL     /*!< Select to generate 64-bit random key    \hideinitializer */
+#define PRNG_KEY_SIZE_128       1UL     /*!< Select to generate 128-bit random key   \hideinitializer */
+#define PRNG_KEY_SIZE_192       2UL     /*!< Select to generate 192-bit random key   \hideinitializer */
+#define PRNG_KEY_SIZE_256       3UL     /*!< Select to generate 256-bit random key   \hideinitializer */
+
+#define PRNG_SEED_CONT          0UL     /*!< PRNG using current seed                 \hideinitializer */
+#define PRNG_SEED_RELOAD        1UL     /*!< PRNG reload new seed                    \hideinitializer */
+
+#define AES_KEY_SIZE_128        0UL     /*!< AES select 128-bit key length           \hideinitializer */
+#define AES_KEY_SIZE_192        1UL     /*!< AES select 192-bit key length           \hideinitializer */
+#define AES_KEY_SIZE_256        2UL     /*!< AES select 256-bit key length           \hideinitializer */
+
+#define AES_MODE_ECB            0UL     /*!< AES select ECB mode                     \hideinitializer */
+#define AES_MODE_CBC            1UL     /*!< AES select CBC mode                     \hideinitializer */
+#define AES_MODE_CFB            2UL     /*!< AES select CFB mode                     \hideinitializer */
+#define AES_MODE_OFB            3UL     /*!< AES select OFB mode                     \hideinitializer */
+#define AES_MODE_CTR            4UL     /*!< AES select CTR mode                     \hideinitializer */
+#define AES_MODE_CBC_CS1        0x10UL  /*!< AES select CBC CS1 mode                 \hideinitializer */
+#define AES_MODE_CBC_CS2        0x11UL  /*!< AES select CBC CS2 mode                 \hideinitializer */
+#define AES_MODE_CBC_CS3        0x12UL  /*!< AES select CBC CS3 mode                 \hideinitializer */
+
+#define AES_NO_SWAP             0UL     /*!< AES do not swap input and output data   \hideinitializer */
+#define AES_OUT_SWAP            1UL     /*!< AES swap output data                    \hideinitializer */
+#define AES_IN_SWAP             2UL     /*!< AES swap input data                     \hideinitializer */
+#define AES_IN_OUT_SWAP         3UL     /*!< AES swap both input and output data     \hideinitializer */
+
+#define SHA_MODE_SHA1           0UL     /*!< SHA select SHA-1 160-bit                \hideinitializer */
+#define SHA_MODE_SHA224         5UL     /*!< SHA select SHA-224 224-bit              \hideinitializer */
+#define SHA_MODE_SHA256         4UL     /*!< SHA select SHA-256 256-bit              \hideinitializer */
+#define SHA_MODE_SHA384         7UL     /*!< SHA select SHA-384 384-bit              \hideinitializer */
+#define SHA_MODE_SHA512         6UL     /*!< SHA select SHA-512 512-bit              \hideinitializer */
+
+#define SHA_NO_SWAP             0UL     /*!< SHA do not swap input and output data   \hideinitializer */
+#define SHA_OUT_SWAP            1UL     /*!< SHA swap output data                    \hideinitializer */
+#define SHA_IN_SWAP             2UL     /*!< SHA swap input data                     \hideinitializer */
+#define SHA_IN_OUT_SWAP         3UL     /*!< SHA swap both input and output data     \hideinitializer */
+
+#define CRYPTO_DMA_FIRST        0x4UL   /*!< Do first encrypt/decrypt in DMA cascade \hideinitializer */
+#define CRYPTO_DMA_ONE_SHOT     0x5UL   /*!< Do one shot encrypt/decrypt with DMA      \hideinitializer */
+#define CRYPTO_DMA_CONTINUE     0x6UL   /*!< Do continuous encrypt/decrypt in DMA cascade \hideinitializer */
+#define CRYPTO_DMA_LAST         0x7UL   /*!< Do last encrypt/decrypt in DMA cascade          \hideinitializer */
+
+typedef enum
+{
+    /*!< ECC curve                \hideinitializer */
+    CURVE_P_192,                        /*!< ECC curve P-192          \hideinitializer */
+    CURVE_P_224,                        /*!< ECC curve P-224          \hideinitializer */
+    CURVE_P_256,                        /*!< ECC curve P-256          \hideinitializer */
+    CURVE_P_384,                        /*!< ECC curve P-384          \hideinitializer */
+    CURVE_P_521,                        /*!< ECC curve P-521          \hideinitializer */
+    CURVE_K_163,                        /*!< ECC curve K-163          \hideinitializer */
+    CURVE_K_233,                        /*!< ECC curve K-233          \hideinitializer */
+    CURVE_K_283,                        /*!< ECC curve K-283          \hideinitializer */
+    CURVE_K_409,                        /*!< ECC curve K-409          \hideinitializer */
+    CURVE_K_571,                        /*!< ECC curve K-571          \hideinitializer */
+    CURVE_B_163,                        /*!< ECC curve B-163          \hideinitializer */
+    CURVE_B_233,                        /*!< ECC curve B-233          \hideinitializer */
+    CURVE_B_283,                        /*!< ECC curve B-283          \hideinitializer */
+    CURVE_B_409,                        /*!< ECC curve B-409          \hideinitializer */
+    CURVE_B_571,                        /*!< ECC curve K-571          \hideinitializer */
+    CURVE_KO_192,                       /*!< ECC 192-bits "Koblitz" curve   \hideinitializer */
+    CURVE_KO_224,                       /*!< ECC 224-bits "Koblitz" curve   \hideinitializer */
+    CURVE_KO_256,                       /*!< ECC 256-bits "Koblitz" curve   \hideinitializer */
+    CURVE_BP_256,                       /*!< ECC Brainpool 256-bits curve   \hideinitializer */
+    CURVE_BP_384,                       /*!< ECC Brainpool 256-bits curve   \hideinitializer */
+    CURVE_BP_512,                       /*!< ECC Brainpool 256-bits curve   \hideinitializer */
+    CURVE_UNDEF,                        /*!< Invalid curve            \hideinitializer */
+}
+E_ECC_CURVE;                            /*!< ECC curve                \hideinitializer */
+
+
+#define RSA_MAX_KLEN            (2048)
+#define RSA_KBUF_HLEN           (RSA_MAX_KLEN/4 + 8)
+#define RSA_KBUF_BLEN           (RSA_MAX_KLEN + 32)
+
+
+/*@}*/ /* end of group CRYPTO_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup CRYPTO_EXPORTED_MACROS CRYPTO Exported Macros
+  @{
+*/
+
+/*----------------------------------------------------------------------------------------------*/
+/*  Macros                                                                                      */
+/*----------------------------------------------------------------------------------------------*/
+
+/**
+  * @brief This macro enables PRNG interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define PRNG_ENABLE_INT(crpt)       ((crpt)->INTEN |= CRPT_INTEN_PRNGIEN_Msk)
+
+/**
+  * @brief This macro disables PRNG interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define PRNG_DISABLE_INT(crpt)      ((crpt)->INTEN &= ~CRPT_INTEN_PRNGIEN_Msk)
+
+/**
+  * @brief This macro gets PRNG interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return PRNG interrupt flag.
+  * \hideinitializer
+  */
+#define PRNG_GET_INT_FLAG(crpt)     ((crpt)->INTSTS & CRPT_INTSTS_PRNGIF_Msk)
+
+/**
+  * @brief This macro clears PRNG interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define PRNG_CLR_INT_FLAG(crpt)     ((crpt)->INTSTS = CRPT_INTSTS_PRNGIF_Msk)
+
+/**
+  * @brief This macro enables AES interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define AES_ENABLE_INT(crpt)        ((crpt)->INTEN |= (CRPT_INTEN_AESIEN_Msk|CRPT_INTEN_AESEIEN_Msk))
+
+/**
+  * @brief This macro disables AES interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define AES_DISABLE_INT(crpt)       ((crpt)->INTEN &= ~(CRPT_INTEN_AESIEN_Msk|CRPT_INTEN_AESEIEN_Msk))
+
+/**
+  * @brief This macro gets AES interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return AES interrupt flag.
+  * \hideinitializer
+  */
+#define AES_GET_INT_FLAG(crpt)      ((crpt)->INTSTS & (CRPT_INTSTS_AESIF_Msk|CRPT_INTSTS_AESEIF_Msk))
+
+/**
+  * @brief This macro clears AES interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define AES_CLR_INT_FLAG(crpt)      ((crpt)->INTSTS = (CRPT_INTSTS_AESIF_Msk|CRPT_INTSTS_AESEIF_Msk))
+
+/**
+  * @brief This macro enables AES key protection.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define AES_ENABLE_KEY_PROTECT(crpt)  ((crpt)->AES_CTL |= CRPT_AES_CTL_KEYPRT_Msk)
+
+/**
+  * @brief This macro disables AES key protection.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define AES_DISABLE_KEY_PROTECT(crpt) ((crpt)->AES_CTL = ((crpt)->AES_CTL & ~CRPT_AES_CTL_KEYPRT_Msk) | (0x16UL<<CRPT_AES_CTL_KEYUNPRT_Pos)); \
+                                      ((crpt)->AES_CTL &= ~CRPT_AES_CTL_KEYPRT_Msk)
+
+/**
+  * @brief This macro enables SHA interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define SHA_ENABLE_INT(crpt)        ((crpt)->INTEN |= (CRPT_INTEN_HMACIEN_Msk|CRPT_INTEN_HMACEIEN_Msk))
+
+/**
+  * @brief This macro disables SHA interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define SHA_DISABLE_INT(crpt)       ((crpt)->INTEN &= ~(CRPT_INTEN_HMACIEN_Msk|CRPT_INTEN_HMACEIEN_Msk))
+
+/**
+  * @brief This macro gets SHA interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return SHA interrupt flag.
+  * \hideinitializer
+  */
+#define SHA_GET_INT_FLAG(crpt)      ((crpt)->INTSTS & (CRPT_INTSTS_HMACIF_Msk|CRPT_INTSTS_HMACEIF_Msk))
+
+/**
+  * @brief This macro clears SHA interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define SHA_CLR_INT_FLAG(crpt)      ((crpt)->INTSTS = (CRPT_INTSTS_HMACIF_Msk|CRPT_INTSTS_HMACEIF_Msk))
+
+/**
+  * @brief This macro enables ECC interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define ECC_ENABLE_INT(crpt)        ((crpt)->INTEN |= (CRPT_INTEN_ECCIEN_Msk|CRPT_INTEN_ECCEIEN_Msk))
+
+/**
+  * @brief This macro disables ECC interrupt.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define ECC_DISABLE_INT(crpt)       ((crpt)->INTEN &= ~(CRPT_INTEN_ECCIEN_Msk|CRPT_INTEN_ECCEIEN_Msk))
+
+/**
+  * @brief This macro gets ECC interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return ECC interrupt flag.
+  * \hideinitializer
+  */
+#define ECC_GET_INT_FLAG(crpt)      ((crpt)->INTSTS & (CRPT_INTSTS_ECCIF_Msk|CRPT_INTSTS_ECCEIF_Msk))
+
+/**
+  * @brief This macro clears ECC interrupt flag.
+  * @param crpt     Specified cripto module
+  * @return None
+  * \hideinitializer
+  */
+#define ECC_CLR_INT_FLAG(crpt)      ((crpt)->INTSTS = (CRPT_INTSTS_ECCIF_Msk|CRPT_INTSTS_ECCEIF_Msk))
+
+
+/*@}*/ /* end of group CRYPTO_EXPORTED_MACROS */
+
+
+/** @addtogroup CRYPTO_EXPORTED_FUNCTIONS CRYPTO Exported Functions
+  @{
+*/
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Functions                                                                                      */
+/*---------------------------------------------------------------------------------------------------------*/
+
+void PRNG_Open(CRPT_T *crpt, uint32_t u32KeySize, uint32_t u32SeedReload, uint32_t u32Seed);
+void PRNG_Start(CRPT_T *crpt);
+void PRNG_Read(CRPT_T *crpt, uint32_t u32RandKey[]);
+void AES_Open(CRPT_T *crpt, uint32_t u32EncDec, uint32_t u32OpMode, uint32_t u32KeySize, uint32_t u32SwapType);
+void AES_Start(CRPT_T *crpt, uint32_t u32DMAMode);
+void AES_SetKey(CRPT_T *crpt, uint32_t au32Keys[], uint32_t u32KeySize);
+void AES_SetInitVect(CRPT_T *crpt, uint32_t au32IV[]);
+void AES_SetDMATransfer(CRPT_T *crpt, uint32_t u32SrcAddr, uint32_t u32DstAddr, uint32_t u32TransCnt);
+void SHA_Open(CRPT_T *crpt, uint32_t u32OpMode, uint32_t u32SwapType, uint32_t hmac_key_len);
+void SHA_Start(CRPT_T *crpt, uint32_t u32DMAMode);
+void SHA_SetDMATransfer(CRPT_T *crpt, uint32_t u32SrcAddr, uint32_t u32TransCnt);
+void SHA_Read(CRPT_T *crpt, uint32_t u32Digest[]);
+void ECC_Complete(CRPT_T *crpt);
+int  ECC_IsPrivateKeyValid(CRPT_T *crpt, E_ECC_CURVE ecc_curve,  char private_k[]);
+int32_t  ECC_GeneratePublicKey(CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *private_k, char public_k1[], char public_k2[]);
+int32_t  ECC_Mutiply(CRPT_T *crpt, E_ECC_CURVE ecc_curve, char x1[], char y1[], char *k, char x2[], char y2[]);
+int32_t  ECC_GenerateSecretZ(CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *private_k, char public_k1[], char public_k2[], char secret_z[]);
+int32_t  ECC_GenerateSignature(CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *message, char *d, char *k, char *R, char *S);
+int32_t  ECC_VerifySignature(CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *message, char *public_k1, char *public_k2, char *R, char *S);
+void RSA_Calculate_C(int rsa_len, char *n, char *C);
+int32_t  RSA_GenerateSignature(CRPT_T *crpt, int rsa_len, char *n, char *d, char *C, char *msg, char *sig);
+int32_t  RSA_VerifySignature(CRPT_T *crpt, int rsa_len, char *n, char *e, char *C, char *sig, char *msg);
+
+
+/*@}*/ /* end of group CRYPTO_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group Crypto_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __NU_CRYPTO_H__ */
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/
+

+ 418 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_ebi.h

@@ -0,0 +1,418 @@
+/**************************************************************************//**
+ * @file     ebi.h
+ * @brief    EBI driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_EBI_H__
+#define __NU_EBI_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "nuc980.h"
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup EBI_Driver EBI Driver
+  @{
+*/
+
+/** @addtogroup EBI_EXPORTED_CONSTANTS EBI Exported Constants
+  @{
+*/
+
+#define EBI                  ((EBI_T *)   EBI_BA)
+
+/*---------------------- External Bus Interface Controller -------------------------*/
+/**
+    @addtogroup EBI External Bus Interface Controller(EBI)
+    Memory Mapped Structure for EBI Controller
+@{ */
+
+
+typedef struct
+{
+
+    __IO uint32_t CTL0;          /* Offset: 0x00  External Bus Interface Bank0 Control Register */
+    __IO uint32_t TCTL0;         /* Offset: 0x04  External Bus Interface Bank0 Timing Control Register */
+    __I  uint32_t RESERVE0[2];
+    __IO uint32_t CTL1;          /* Offset: 0x10  External Bus Interface Bank1 Control Register */
+    __IO uint32_t TCTL1;         /* Offset: 0x14  External Bus Interface Bank1 Timing Control Register */
+    __I  uint32_t RESERVE1[2];
+    __IO uint32_t CTL2;          /* Offset: 0x20  External Bus Interface Bank1 Control Register */
+    __IO uint32_t TCTL2;         /* Offset: 0x24  External Bus Interface Bank1 Timing Control Register */
+
+} EBI_T;
+
+
+
+/**
+    @addtogroup EBI_CONST EBI Bit Field Definition
+    Constant Definitions for EBI Controller
+@{ */
+
+#define EBI_CTL_EN_Pos                  (0)                                               /*!< EBI_T::CTL: EN Position \hideinitializer */
+#define EBI_CTL_EN_Msk                  (0x1ul << EBI_CTL_EN_Pos)                         /*!< EBI_T::CTL: EN Mask \hideinitializer */
+
+#define EBI_CTL_DW16_Pos                (1)                                               /*!< EBI_T::CTL: DW16 Position \hideinitializer */
+#define EBI_CTL_DW16_Msk                (0x1ul << EBI_CTL_DW16_Pos)                       /*!< EBI_T::CTL: DW16 Mask \hideinitializer */
+
+#define EBI_CTL_CSPOLINV_Pos            (2)                                               /*!< EBI_T::CTL: CSPOLINV Position \hideinitializer */
+#define EBI_CTL_CSPOLINV_Msk            (0x1ul << EBI_CTL_CSPOLINV_Pos)                   /*!< EBI_T::CTL: CSPOLINV Mask \hideinitializer */
+
+#define EBI_CTL_CACCESS_Pos             (4)                                               /*!< EBI EBICON: CS_PINV Position \hideinitializer */
+#define EBI_CTL_CACCESS_Msk             (1ul << EBI_CTL_CACCESS_Pos)                      /*!< EBI EBICON: CS_PINV Mask \hideinitializer */
+
+#define EBI_CTL_MCLKDIV_Pos             (8)                                               /*!< EBI_T::CTL: MCLKDIV Position \hideinitializer */
+#define EBI_CTL_MCLKDIV_Msk             (0x7ul << EBI_CTL_MCLKDIV_Pos)                    /*!< EBI_T::CTL: MCLKDIV Mask \hideinitializer */
+
+#define EBI_CTL_WBUFEN_Pos              (24)                                              /*!< EBI_T::CTL: WBUFEN Position \hideinitializer */
+#define EBI_CTL_WBUFEN_Msk              (0x1ul << EBI_CTL_WBUFEN_Pos)                     /*!< EBI_T::CTL: WBUFEN Mask \hideinitializer */
+
+#define EBI_TCTL_TACC_Pos               (3)                                               /*!< EBI_T::TCTL: TACC Position \hideinitializer */
+#define EBI_TCTL_TACC_Msk               (0x1ful << EBI_TCTL_TACC_Pos)                     /*!< EBI_T::TCTL: TACC Mask \hideinitializer */
+
+#define EBI_TCTL_TAHD_Pos               (8)                                               /*!< EBI_T::TCTL: TAHD Position \hideinitializer */
+#define EBI_TCTL_TAHD_Msk               (0x7ul << EBI_TCTL_TAHD_Pos)                      /*!< EBI_T::TCTL: TAHD Mask \hideinitializer */
+
+#define EBI_TCTL_W2X_Pos                (12)                                              /*!< EBI_T::TCTL: W2X Position \hideinitializer */
+#define EBI_TCTL_W2X_Msk                (0xful << EBI_TCTL_W2X_Pos)                       /*!< EBI_T::TCTL: W2X Mask \hideinitializer */
+
+#define EBI_TCTL_RAHDOFF_Pos            (22)                                              /*!< EBI_T::TCTL: RAHDOFF Position \hideinitializer */
+#define EBI_TCTL_RAHDOFF_Msk            (0x1ul << EBI_TCTL_RAHDOFF_Pos)                   /*!< EBI_T::TCTL: RAHDOFF Mask \hideinitializer */
+
+#define EBI_TCTL_WAHDOFF_Pos            (23)                                              /*!< EBI_T::TCTL: WAHDOFF Position \hideinitializer */
+#define EBI_TCTL_WAHDOFF_Msk            (0x1ul << EBI_TCTL_WAHDOFF_Pos)                   /*!< EBI_T::TCTL: WAHDOFF Mask \hideinitializer */
+
+#define EBI_TCTL_R2R_Pos                (24)                                              /*!< EBI_T::TCTL: R2R Position \hideinitializer */
+#define EBI_TCTL_R2R_Msk                (0xful << EBI_TCTL_R2R_Pos)                       /*!< EBI_T::TCTL: R2R Mask \hideinitializer */
+
+/**@}*/ /* EBI_CONST */
+/**@}*/ /* end of EBI register group */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Miscellaneous Constant Definitions                                                                     */
+/*---------------------------------------------------------------------------------------------------------*/
+#define EBI_BANK0_BASE_ADDR     0x60000000UL /*!< EBI bank0 base address \hideinitializer */
+#define EBI_BANK1_BASE_ADDR     0x60100000UL /*!< EBI bank1 base address \hideinitializer */
+#define EBI_BANK2_BASE_ADDR     0x60200000UL /*!< EBI bank2 base address \hideinitializer */
+#define EBI_MAX_SIZE            0x00100000UL /*!< Maximum EBI size for each bank is 1 MB \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Constants for EBI bank number                                                                          */
+/*---------------------------------------------------------------------------------------------------------*/
+#define EBI_BANK0               0UL    /*!< EBI bank 0 \hideinitializer */
+#define EBI_BANK1               1UL    /*!< EBI bank 1 \hideinitializer */
+#define EBI_BANK2               2UL    /*!< EBI bank 2 \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Constants for EBI data bus width                                                                       */
+/*---------------------------------------------------------------------------------------------------------*/
+#define EBI_BUSWIDTH_8BIT       8UL   /*!< EBI bus width is 8-bit \hideinitializer */
+#define EBI_BUSWIDTH_16BIT      16UL  /*!< EBI bus width is 16-bit \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Constants for EBI CS Active Level                                                                      */
+/*---------------------------------------------------------------------------------------------------------*/
+#define EBI_CS_ACTIVE_LOW       0UL    /*!< EBI CS active level is low \hideinitializer */
+#define EBI_CS_ACTIVE_HIGH      1UL    /*!< EBI CS active level is high \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Constants for EBI MCLK divider and Timing                                                              */
+/*---------------------------------------------------------------------------------------------------------*/
+#define EBI_MCLKDIV_1           0x0UL /*!< EBI output clock(MCLK) is HCLK/1 \hideinitializer */
+#define EBI_MCLKDIV_2           0x1UL /*!< EBI output clock(MCLK) is HCLK/2 \hideinitializer */
+#define EBI_MCLKDIV_4           0x2UL /*!< EBI output clock(MCLK) is HCLK/4 \hideinitializer */
+#define EBI_MCLKDIV_8           0x3UL /*!< EBI output clock(MCLK) is HCLK/8 \hideinitializer */
+#define EBI_MCLKDIV_16          0x4UL /*!< EBI output clock(MCLK) is HCLK/16 \hideinitializer */
+#define EBI_MCLKDIV_32          0x5UL /*!< EBI output clock(MCLK) is HCLK/32 \hideinitializer */
+#define EBI_MCLKDIV_64          0x6UL /*!< EBI output clock(MCLK) is HCLK/64 \hideinitializer */
+#define EBI_MCLKDIV_128         0x7UL /*!< EBI output clock(MCLK) is HCLK/128 \hideinitializer */
+
+#define EBI_TIMING_FASTEST      0x0UL /*!< EBI timing is the fastest \hideinitializer */
+#define EBI_TIMING_VERYFAST     0x1UL /*!< EBI timing is very fast \hideinitializer */
+#define EBI_TIMING_FAST         0x2UL /*!< EBI timing is fast \hideinitializer */
+#define EBI_TIMING_NORMAL       0x3UL /*!< EBI timing is normal  \hideinitializer */
+#define EBI_TIMING_SLOW         0x4UL /*!< EBI timing is slow \hideinitializer */
+#define EBI_TIMING_VERYSLOW     0x5UL /*!< EBI timing is very slow \hideinitializer */
+#define EBI_TIMING_SLOWEST      0x6UL /*!< EBI timing is the slowest \hideinitializer */
+
+#define EBI_OPMODE_NORMAL       0x0UL          /*!< EBI bus operate in normal mode \hideinitializer */
+#define EBI_OPMODE_CACCESS      (0x1UL << 4)   /*!< EBI bus operate in Continuous Data Access mode \hideinitializer */
+
+
+/*@}*/ /* end of group EBI_EXPORTED_CONSTANTS */
+
+/** @addtogroup EBI_EXPORTED_FUNCTIONS EBI Exported Functions
+  @{
+*/
+
+/**
+  * @brief      Read 8-bit data on EBI bank0
+  *
+  * @param[in]  u32Addr     The data address on EBI bank0.
+  *
+  * @return     8-bit Data
+  *
+  * @details    This macro is used to read 8-bit data from specify address on EBI bank0.
+  * \hideinitializer
+  */
+#define EBI0_READ_DATA8(u32Addr)            (*((volatile unsigned char *)(EBI_BANK0_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 8-bit data to EBI bank0
+  *
+  * @param[in]  u32Addr     The data address on EBI bank0.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 8-bit data to specify address on EBI bank0.
+  * \hideinitializer
+  */
+#define EBI0_WRITE_DATA8(u32Addr, u32Data)  (*((volatile unsigned char *)(EBI_BANK0_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 16-bit data on EBI bank0
+  *
+  * @param[in]  u32Addr     The data address on EBI bank0.
+  *
+  * @return     16-bit Data
+  *
+  * @details    This macro is used to read 16-bit data from specify address on EBI bank0.
+  * \hideinitializer
+  */
+#define EBI0_READ_DATA16(u32Addr)           (*((volatile unsigned short *)(EBI_BANK0_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 16-bit data to EBI bank0
+  *
+  * @param[in]  u32Addr     The data address on EBI bank0.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 16-bit data to specify address on EBI bank0.
+  * \hideinitializer
+  */
+#define EBI0_WRITE_DATA16(u32Addr, u32Data) (*((volatile unsigned short *)(EBI_BANK0_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 32-bit data on EBI bank0
+  *
+  * @param[in]  u32Addr     The data address on EBI bank0.
+  *
+  * @return     32-bit Data
+  *
+  * @details    This macro is used to read 32-bit data from specify address on EBI bank0.
+  * \hideinitializer
+  */
+#define EBI0_READ_DATA32(u32Addr)           (*((volatile unsigned int *)(EBI_BANK0_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 32-bit data to EBI bank0
+  *
+  * @param[in]  u32Addr     The data address on EBI bank0.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 32-bit data to specify address on EBI bank0.
+  * \hideinitializer
+  */
+#define EBI0_WRITE_DATA32(u32Addr, u32Data) (*((volatile unsigned int *)(EBI_BANK0_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 8-bit data on EBI bank1
+  *
+  * @param[in]  u32Addr     The data address on EBI bank1.
+  *
+  * @return     8-bit Data
+  *
+  * @details    This macro is used to read 8-bit data from specify address on EBI bank1.
+  * \hideinitializer
+  */
+#define EBI1_READ_DATA8(u32Addr)            (*((volatile unsigned char *)(EBI_BANK1_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 8-bit data to EBI bank1
+  *
+  * @param[in]  u32Addr     The data address on EBI bank1.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 8-bit data to specify address on EBI bank1.
+  * \hideinitializer
+  */
+#define EBI1_WRITE_DATA8(u32Addr, u32Data)  (*((volatile unsigned char *)(EBI_BANK1_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 16-bit data on EBI bank1
+  *
+  * @param[in]  u32Addr     The data address on EBI bank1.
+  *
+  * @return     16-bit Data
+  *
+  * @details    This macro is used to read 16-bit data from specify address on EBI bank1.
+  * \hideinitializer
+  */
+#define EBI1_READ_DATA16(u32Addr)           (*((volatile unsigned short *)(EBI_BANK1_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 16-bit data to EBI bank1
+  *
+  * @param[in]  u32Addr     The data address on EBI bank1.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 16-bit data to specify address on EBI bank1.
+  * \hideinitializer
+  */
+#define EBI1_WRITE_DATA16(u32Addr, u32Data) (*((volatile unsigned short *)(EBI_BANK1_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 32-bit data on EBI bank1
+  *
+  * @param[in]  u32Addr     The data address on EBI bank1.
+  *
+  * @return     32-bit Data
+  *
+  * @details    This macro is used to read 32-bit data from specify address on EBI bank1.
+  * \hideinitializer
+  */
+#define EBI1_READ_DATA32(u32Addr)           (*((volatile unsigned int *)(EBI_BANK1_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 32-bit data to EBI bank1
+  *
+  * @param[in]  u32Addr     The data address on EBI bank1.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 32-bit data to specify address on EBI bank1.
+  * \hideinitializer
+  */
+#define EBI1_WRITE_DATA32(u32Addr, u32Data) (*((volatile unsigned int *)(EBI_BANK1_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 8-bit data on EBI bank2
+  *
+  * @param[in]  u32Addr     The data address on EBI bank2.
+  *
+  * @return     8-bit Data
+  *
+  * @details    This macro is used to read 8-bit data from specify address on EBI bank2.
+  * \hideinitializer
+  */
+#define EBI2_READ_DATA8(u32Addr)            (*((volatile unsigned char *)(EBI_BANK2_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 8-bit data to EBI bank2
+  *
+  * @param[in]  u32Addr     The data address on EBI bank2.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 8-bit data to specify address on EBI bank2.
+  * \hideinitializer
+  */
+#define EBI2_WRITE_DATA8(u32Addr, u32Data)  (*((volatile unsigned char *)(EBI_BANK2_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 16-bit data on EBI bank2
+  *
+  * @param[in]  u32Addr     The data address on EBI bank2.
+  *
+  * @return     16-bit Data
+  *
+  * @details    This macro is used to read 16-bit data from specify address on EBI bank2.
+  * \hideinitializer
+  */
+#define EBI2_READ_DATA16(u32Addr)           (*((volatile unsigned short *)(EBI_BANK2_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 16-bit data to EBI bank2
+  *
+  * @param[in]  u32Addr     The data address on EBI bank2.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 16-bit data to specify address on EBI bank2.
+  * \hideinitializer
+  */
+#define EBI2_WRITE_DATA16(u32Addr, u32Data) (*((volatile unsigned short *)(EBI_BANK2_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief      Read 32-bit data on EBI bank2
+  *
+  * @param[in]  u32Addr     The data address on EBI bank2.
+  *
+  * @return     32-bit Data
+  *
+  * @details    This macro is used to read 32-bit data from specify address on EBI bank2.
+  * \hideinitializer
+  */
+#define EBI2_READ_DATA32(u32Addr)           (*((volatile unsigned int *)(EBI_BANK2_BASE_ADDR+(u32Addr))))
+
+/**
+  * @brief      Write 32-bit data to EBI bank2
+  *
+  * @param[in]  u32Addr     The data address on EBI bank2.
+  * @param[in]  u32Data     Specify data to be written.
+  *
+  * @return     None
+  *
+  * @details    This macro is used to write 32-bit data to specify address on EBI bank2.
+  * \hideinitializer
+  */
+#define EBI2_WRITE_DATA32(u32Addr, u32Data) (*((volatile unsigned int *)(EBI_BANK2_BASE_ADDR+(u32Addr))) = (u32Data))
+
+/**
+  * @brief       Enable EBI Write Buffer
+  *
+  * @return      None
+  *
+  * @details     This macro is used to improve EBI write operation for EBI all banks.
+  * \hideinitializer
+  */
+#define EBI_ENABLE_WRITE_BUFFER()           outpw(REG_EBI_CTL0, inpw(REG_EBI_CTL0) | (0x1UL << 24))
+
+
+/**
+  * @brief       Disable EBI Write Buffer
+  *
+  * @return      None
+  *
+  * @details     This macro is used to disable EBI write buffer function.
+  * \hideinitializer
+  */
+#define EBI_DISABLE_WRITE_BUFFER()          outpw(REG_EBI_CTL0, (inpw(REG_EBI_CTL0) & ~(0x1UL << 24)) | (0x1UL << 24))
+
+void EBI_Open(uint32_t u32Bank, uint32_t u32DataWidth, uint32_t u32TimingClass, uint32_t u32BusMode, uint32_t u32CSActiveLevel);
+void EBI_Close(uint32_t u32Bank);
+void EBI_SetBusTiming(uint32_t u32Bank, uint32_t u32TimingConfig, uint32_t u32MclkDiv);
+
+/*@}*/ /* end of group EBI_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group EBI_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_EBI_H__
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

+ 396 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_emac.h

@@ -0,0 +1,396 @@
+/**************************************************************************//**
+ * @file     nu_emac.h
+ * @version  V1.00
+ * @brief    EMAC driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2016-2020 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+#ifndef __NU_EMAC_H__
+#define __NU_EMAC_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdint.h>
+#include "emac_reg.h"
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup EMAC_Driver EMAC Driver
+  @{
+*/
+
+/** @addtogroup EMAC_EXPORTED_CONSTANTS EMAC Exported Constants
+  @{
+*/
+
+#define EMAC_PHY_ADDR      1UL    /*!<  PHY address, this address is board dependent \hideinitializer */
+#define EMAC_RX_DESC_SIZE  64UL    /*!<  Number of Rx Descriptors, should be 2 at least \hideinitializer */
+#define EMAC_TX_DESC_SIZE  32UL    /*!<  Number of Tx Descriptors, should be 2 at least \hideinitializer */
+#define EMAC_CAMENTRY_NB   16UL   /*!<  Number of CAM \hideinitializer */
+#define EMAC_MAX_PKT_SIZE  1536UL /*!<  Number of HDR + EXTRA + VLAN_TAG + PAYLOAD + CRC \hideinitializer */
+
+#define EMAC_LINK_DOWN    0UL    /*!<  Ethernet link is down \hideinitializer */
+#define EMAC_LINK_100F    1UL    /*!<  Ethernet link is 100Mbps full duplex \hideinitializer */
+#define EMAC_LINK_100H    2UL    /*!<  Ethernet link is 100Mbps half duplex \hideinitializer */
+#define EMAC_LINK_10F     3UL    /*!<  Ethernet link is 10Mbps full duplex \hideinitializer */
+#define EMAC_LINK_10H     4UL    /*!<  Ethernet link is 10Mbps half duplex \hideinitializer */
+
+/*@}*/ /* end of group EMAC_EXPORTED_CONSTANTS */
+
+
+/** Tx/Rx buffer descriptor structure */
+typedef struct
+{
+    uint32_t u32Status1;   /*!<  Status word 1 */
+    uint32_t u32Data;      /*!<  Pointer to data buffer */
+    uint32_t u32Status2;   /*!<  Status word 2 */
+    uint32_t u32Next;      /*!<  Pointer to next descriptor */
+    uint32_t u32Backup1;   /*!<  For backup descriptor fields over written by time stamp */
+    uint32_t u32Backup2;   /*!<  For backup descriptor fields over written by time stamp */
+} EMAC_DESCRIPTOR_T;
+
+/** Tx/Rx buffer structure */
+typedef struct
+{
+    uint8_t au8Buf[EMAC_MAX_PKT_SIZE];
+} EMAC_FRAME_T;
+
+typedef struct
+{
+    EMAC_T  *psEmac;
+
+    uint32_t u32TxDescSize;
+    uint32_t u32RxDescSize;
+
+    EMAC_DESCRIPTOR_T *psRXDescs;
+    EMAC_FRAME_T *psRXFrames;
+    EMAC_DESCRIPTOR_T *psTXDescs;
+    EMAC_FRAME_T *psTXFrames;
+
+    EMAC_DESCRIPTOR_T *psCurrentTxDesc;
+    EMAC_DESCRIPTOR_T *psNextTxDesc;
+    EMAC_DESCRIPTOR_T *psCurrentRxDesc;
+
+} EMAC_MEMMGR_T;
+
+/** @addtogroup EMAC_EXPORTED_FUNCTIONS EMAC Exported Functions
+  @{
+*/
+
+
+/**
+  * @brief  Enable EMAC Tx function
+  * @param  None
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_ENABLE_TX(EMAC) (EMAC->CTL |= EMAC_CTL_TXON_Msk)
+
+
+/**
+  * @brief  Enable EMAC Rx function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_ENABLE_RX(EMAC) do{EMAC->CTL |= EMAC_CTL_RXON_Msk; EMAC->RXST = 0;}while(0)
+
+/**
+  * @brief  Disable EMAC Tx function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_DISABLE_TX(EMAC) (EMAC->CTL &= ~EMAC_CTL_TXON_Msk)
+
+
+/**
+  * @brief  Disable EMAC Rx function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_DISABLE_RX(EMAC) (EMAC->CTL &= ~EMAC_CTL_RXON_Msk)
+
+/**
+  * @brief  Enable EMAC Magic Packet Wakeup function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_ENABLE_MAGIC_PKT_WAKEUP(EMAC) (EMAC->CTL |= EMAC_CTL_WOLEN_Msk)
+
+/**
+  * @brief  Disable EMAC Magic Packet Wakeup function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_DISABLE_MAGIC_PKT_WAKEUP(EMAC) (EMAC->CTL &= ~EMAC_CTL_WOLEN_Msk)
+
+/**
+  * @brief  Enable EMAC to receive broadcast packets
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_ENABLE_RECV_BCASTPKT(EMAC) (EMAC->CAMCTL |= EMAC_CAMCTL_ABP_Msk)
+
+/**
+  * @brief  Disable EMAC to receive broadcast packets
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_DISABLE_RECV_BCASTPKT(EMAC) (EMAC->CAMCTL &= ~EMAC_CAMCTL_ABP_Msk)
+
+/**
+  * @brief  Enable EMAC to receive multicast packets
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_ENABLE_RECV_MCASTPKT(EMAC) (EMAC->CAMCTL |= EMAC_CAMCTL_AMP_Msk)
+
+/**
+  * @brief  Disable EMAC Magic Packet Wakeup function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_DISABLE_RECV_MCASTPKT(EMAC) (EMAC->CAMCTL &= ~EMAC_CAMCTL_AMP_Msk)
+
+/**
+  * @brief  Check if EMAC time stamp alarm interrupt occurred or not
+  * @param  The pointer of the specified EMAC module
+  * @return If time stamp alarm interrupt occurred or not
+  * @retval 0 Alarm interrupt does not occur
+  * @retval 1 Alarm interrupt occurred
+  * \hideinitializer
+  */
+#define EMAC_GET_ALARM_FLAG(EMAC) (EMAC->INTSTS & EMAC_INTSTS_TSALMIF_Msk ? 1 : 0)
+
+/**
+  * @brief  Clear EMAC time stamp alarm interrupt flag
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  * \hideinitializer
+  */
+#define EMAC_CLR_ALARM_FLAG(EMAC) (EMAC->INTSTS = EMAC_INTSTS_TSALMIF_Msk)
+
+/**
+  * @brief  Trigger EMAC Rx function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  */
+#define EMAC_TRIGGER_RX(EMAC) do{EMAC->RXST = 0UL;}while(0)
+
+/**
+  * @brief  Trigger EMAC Tx function
+  * @param  The pointer of the specified EMAC module
+  * @return None
+  */
+#define EMAC_TRIGGER_TX(EMAC) do{EMAC->TXST = 0UL;}while(0)
+
+/**
+ *    @brief        Enable specified EMAC interrupt
+ *
+ *    @param[in]    EMAC        The pointer of the specified EMAC module
+ *    @param[in]    u32eIntSel  Interrupt type select
+ *                              - \ref EMAC_INTEN_RXIEN_Msk    : Receive
+ *                              - \ref EMAC_INTEN_CRCEIEN_Msk  : CRC Error
+ *                              - \ref EMAC_INTEN_RXOVIEN_Msk  : Receive FIFO Overflow
+ *                              - \ref EMAC_INTEN_LPIEN_Msk    : Long Packet
+ *                              - \ref EMAC_INTEN_RXGDIEN_Msk  : Receive Good
+ *                              - \ref EMAC_INTEN_ALIEIEN_Msk  : Alignment Error
+ *                              - \ref EMAC_INTEN_RPIEN_Msk    : Runt Packet
+ *                              - \ref EMAC_INTEN_MPCOVIEN_Msk : Miss Packet Counter Overrun
+ *                              - \ref EMAC_INTEN_MFLEIEN_Msk  : Maximum Frame Length Exceed
+ *                              - \ref EMAC_INTEN_DENIEN_Msk   : DMA Early Notification
+ *                              - \ref EMAC_INTEN_RDUIEN_Msk   : Receive Descriptor Unavailable
+ *                              - \ref EMAC_INTEN_RXBEIEN_Msk  : Receive Bus Error
+ *                              - \ref EMAC_INTEN_CFRIEN_Msk   : Control Frame Receive
+ *                              - \ref EMAC_INTEN_WOLIEN_Msk   : Wake on LAN Interrupt
+ *                              - \ref EMAC_INTEN_TXIEN_Msk    : Transmit
+ *                              - \ref EMAC_INTEN_TXUDIEN_Msk  : Transmit FIFO Underflow
+ *                              - \ref EMAC_INTEN_TXCPIEN_Msk  : Transmit Completion
+ *                              - \ref EMAC_INTEN_EXDEFIEN_Msk : Defer Exceed
+ *                              - \ref EMAC_INTEN_NCSIEN_Msk   : No Carrier Sense
+ *                              - \ref EMAC_INTEN_TXABTIEN_Msk : Transmit Abort
+ *                              - \ref EMAC_INTEN_LCIEN_Msk    : Late Collision
+ *                              - \ref EMAC_INTEN_TDUIEN_Msk   : Transmit Descriptor Unavailable
+ *                              - \ref EMAC_INTEN_TXBEIEN_Msk  : Transmit Bus Error
+ *                              - \ref EMAC_INTEN_TSALMIEN_Msk : Time Stamp Alarm
+ *
+ *    @return       None
+ *
+ *    @details      This macro enable specified EMAC interrupt.
+ *    \hideinitializer
+ */
+#define EMAC_ENABLE_INT(EMAC, u32eIntSel)    ((EMAC)->INTEN |= (u32eIntSel))
+
+/**
+ *    @brief        Disable specified EMAC interrupt
+ *
+ *    @param[in]    emac        The pointer of the specified EMAC module
+ *    @param[in]    u32eIntSel  Interrupt type select
+ *                              - \ref EMAC_INTEN_RXIEN_Msk    : Receive
+ *                              - \ref EMAC_INTEN_CRCEIEN_Msk  : CRC Error
+ *                              - \ref EMAC_INTEN_RXOVIEN_Msk  : Receive FIFO Overflow
+ *                              - \ref EMAC_INTEN_LPIEN_Msk    : Long Packet
+ *                              - \ref EMAC_INTEN_RXGDIEN_Msk  : Receive Good
+ *                              - \ref EMAC_INTEN_ALIEIEN_Msk  : Alignment Error
+ *                              - \ref EMAC_INTEN_RPIEN_Msk    : Runt Packet
+ *                              - \ref EMAC_INTEN_MPCOVIEN_Msk : Miss Packet Counter Overrun
+ *                              - \ref EMAC_INTEN_MFLEIEN_Msk  : Maximum Frame Length Exceed
+ *                              - \ref EMAC_INTEN_DENIEN_Msk   : DMA Early Notification
+ *                              - \ref EMAC_INTEN_RDUIEN_Msk   : Receive Descriptor Unavailable
+ *                              - \ref EMAC_INTEN_RXBEIEN_Msk  : Receive Bus Error
+ *                              - \ref EMAC_INTEN_CFRIEN_Msk   : Control Frame Receive
+ *                              - \ref EMAC_INTEN_WOLIEN_Msk   : Wake on LAN Interrupt
+ *                              - \ref EMAC_INTEN_TXIEN_Msk    : Transmit
+ *                              - \ref EMAC_INTEN_TXUDIEN_Msk  : Transmit FIFO Underflow
+ *                              - \ref EMAC_INTEN_TXCPIEN_Msk  : Transmit Completion
+ *                              - \ref EMAC_INTEN_EXDEFIEN_Msk : Defer Exceed
+ *                              - \ref EMAC_INTEN_NCSIEN_Msk   : No Carrier Sense
+ *                              - \ref EMAC_INTEN_TXABTIEN_Msk : Transmit Abort
+ *                              - \ref EMAC_INTEN_LCIEN_Msk    : Late Collision
+ *                              - \ref EMAC_INTEN_TDUIEN_Msk   : Transmit Descriptor Unavailable
+ *                              - \ref EMAC_INTEN_TXBEIEN_Msk  : Transmit Bus Error
+ *                              - \ref EMAC_INTEN_TSALMIEN_Msk : Time Stamp Alarm
+ *
+ *    @return       None
+ *
+ *    @details      This macro disable specified EMAC interrupt.
+ *    \hideinitializer
+ */
+#define EMAC_DISABLE_INT(EMAC, u32eIntSel)    ((EMAC)->INTEN &= ~ (u32eIntSel))
+
+/**
+ *    @brief        Get specified interrupt flag/status
+ *
+ *    @param[in]    emac            The pointer of the specified EMAC module
+ *    @param[in]    u32eIntTypeFlag Interrupt Type Flag, should be
+ *                                  - \ref EMAC_INTSTS_RXIF_Msk : Receive
+ *                                  - \ref EMAC_INTSTS_CRCEIF_Msk : CRC Error
+ *                                  - \ref EMAC_INTSTS_RXOVIF_Msk : Receive FIFO Overflow
+ *                                  - \ref EMAC_INTSTS_LPIF_Msk : Long Packet
+ *                                  - \ref EMAC_INTSTS_RXGDIF_Msk : Receive Good
+ *                                  - \ref EMAC_INTSTS_ALIEIF_Msk : Alignment Error
+ *                                  - \ref EMAC_INTSTS_RPIF_Msk : Runt Packet
+ *                                  - \ref EMAC_INTSTS_MPCOVIF_Msk : Missed Packet Counter
+ *                                  - \ref EMAC_INTSTS_MFLEIF_Msk : Maximum Frame Length Exceed
+ *                                  - \ref EMAC_INTSTS_DENIF_Msk : DMA Early Notification
+ *                                  - \ref EMAC_INTSTS_RDUIF_Msk : Receive Descriptor Unavailable
+ *                                  - \ref EMAC_INTSTS_RXBEIF_Msk : Receive Bus Error
+ *                                  - \ref EMAC_INTSTS_CFRIF_Msk : Control Frame Receive
+ *                                  - \ref EMAC_INTSTS_WOLIF_Msk : Wake on LAN
+ *                                  - \ref EMAC_INTSTS_TXIF_Msk : Transmit
+ *                                  - \ref EMAC_INTSTS_TXUDIF_Msk : Transmit FIFO Underflow
+ *                                  - \ref EMAC_INTSTS_TXCPIF_Msk : Transmit Completion
+ *                                  - \ref EMAC_INTSTS_EXDEFIF_Msk : Defer Exceed
+ *                                  - \ref EMAC_INTSTS_NCSIF_Msk : No Carrier Sense
+ *                                  - \ref EMAC_INTSTS_TXABTIF_Msk : Transmit Abort
+ *                                  - \ref EMAC_INTSTS_LCIF_Msk : Late Collision
+ *                                  - \ref EMAC_INTSTS_TDUIF_Msk : Transmit Descriptor Unavailable
+ *                                  - \ref EMAC_INTSTS_TXBEIF_Msk : Transmit Bus Error
+ *                                  - \ref EMAC_INTSTS_TSALMIF_Msk : Time Stamp Alarm
+ *
+ *    @return       None
+ *
+ *    @details      This macro get specified interrupt flag or interrupt indicator status.
+ *    \hideinitializer
+ */
+#define EMAC_GET_INT_FLAG(EMAC, u32eIntTypeFlag)    (((EMAC)->INTSTS & (u32eIntTypeFlag))?1:0)
+
+/**
+ *    @brief        Clear specified interrupt flag/status
+ *
+ *    @param[in]    emac            The pointer of the specified EMAC module
+ *    @param[in]    u32eIntTypeFlag Interrupt Type Flag, should be
+ *                                  - \ref EMAC_INTSTS_RXIF_Msk : Receive
+ *                                  - \ref EMAC_INTSTS_CRCEIF_Msk : CRC Error
+ *                                  - \ref EMAC_INTSTS_RXOVIF_Msk : Receive FIFO Overflow
+ *                                  - \ref EMAC_INTSTS_LPIF_Msk : Long Packet
+ *                                  - \ref EMAC_INTSTS_RXGDIF_Msk : Receive Good
+ *                                  - \ref EMAC_INTSTS_ALIEIF_Msk : Alignment Error
+ *                                  - \ref EMAC_INTSTS_RPIF_Msk : Runt Packet
+ *                                  - \ref EMAC_INTSTS_MPCOVIF_Msk : Missed Packet Counter
+ *                                  - \ref EMAC_INTSTS_MFLEIF_Msk : Maximum Frame Length Exceed
+ *                                  - \ref EMAC_INTSTS_DENIF_Msk : DMA Early Notification
+ *                                  - \ref EMAC_INTSTS_RDUIF_Msk : Receive Descriptor Unavailable
+ *                                  - \ref EMAC_INTSTS_RXBEIF_Msk : Receive Bus Error
+ *                                  - \ref EMAC_INTSTS_CFRIF_Msk : Control Frame Receive
+ *                                  - \ref EMAC_INTSTS_WOLIF_Msk : Wake on LAN
+ *                                  - \ref EMAC_INTSTS_TXIF_Msk : Transmit
+ *                                  - \ref EMAC_INTSTS_TXUDIF_Msk : Transmit FIFO Underflow
+ *                                  - \ref EMAC_INTSTS_TXCPIF_Msk : Transmit Completion
+ *                                  - \ref EMAC_INTSTS_EXDEFIF_Msk : Defer Exceed
+ *                                  - \ref EMAC_INTSTS_NCSIF_Msk : No Carrier Sense
+ *                                  - \ref EMAC_INTSTS_TXABTIF_Msk : Transmit Abort
+ *                                  - \ref EMAC_INTSTS_LCIF_Msk : Late Collision
+ *                                  - \ref EMAC_INTSTS_TDUIF_Msk : Transmit Descriptor Unavailable
+ *                                  - \ref EMAC_INTSTS_TXBEIF_Msk : Transmit Bus Error
+ *                                  - \ref EMAC_INTSTS_TSALMIF_Msk : Time Stamp Alarm
+ *
+ *    @retval       0 The specified interrupt is not happened.
+ *                  1 The specified interrupt is happened.
+ *
+ *    @details      This macro clear specified interrupt flag or interrupt indicator status.
+ *    \hideinitializer
+ */
+#define EMAC_CLEAR_INT_FLAG(EMAC, u32eIntTypeFlag)    ((EMAC)->INTSTS |= (u32eIntTypeFlag))
+#define EMAC_CLEAR_ALL_INT_FLAG(EMAC)                 ((EMAC)->INTSTS |= (EMAC)->INTSTS)
+
+
+void EMAC_Open(EMAC_MEMMGR_T *psMemMgr, uint8_t *pu8MacAddr);
+void EMAC_Close(EMAC_T *EMAC);
+void EMAC_SetMacAddr(EMAC_T *EMAC, uint8_t *pu8MacAddr);
+void EMAC_EnableCamEntry(EMAC_T *EMAC, uint32_t u32Entry, uint8_t pu8MacAddr[]);
+void EMAC_DisableCamEntry(EMAC_T *EMAC, uint32_t u32Entry);
+
+uint32_t EMAC_RecvPkt(EMAC_MEMMGR_T *psMemMgr, uint8_t *pu8Data, uint32_t *pu32Size);
+uint32_t EMAC_RecvPktTS(EMAC_MEMMGR_T *psMemMgr, uint8_t *pu8Data, uint32_t *pu32Size, uint32_t *pu32Sec, uint32_t *pu32Nsec);
+void EMAC_RecvPktDone(EMAC_MEMMGR_T *psMemMgr);
+
+uint32_t EMAC_SendPkt(EMAC_MEMMGR_T *psMemMgr, uint8_t *pu8Data, uint32_t u32Size);
+uint32_t EMAC_SendPktDone(EMAC_MEMMGR_T *psMemMgr);
+uint32_t EMAC_SendPktDoneTS(EMAC_MEMMGR_T *psMemMgr, uint32_t *pu32Sec, uint32_t *pu32Nsec);
+
+void EMAC_EnableTS(EMAC_T *EMAC, uint32_t u32Sec, uint32_t u32Nsec);
+void EMAC_DisableTS(EMAC_T *EMAC);
+void EMAC_GetTime(EMAC_T *EMAC, uint32_t *pu32Sec, uint32_t *pu32Nsec);
+void EMAC_SetTime(EMAC_T *EMAC, uint32_t u32Sec, uint32_t u32Nsec);
+void EMAC_UpdateTime(EMAC_T *EMAC, uint32_t u32Neg, uint32_t u32Sec, uint32_t u32Nsec);
+void EMAC_EnableAlarm(EMAC_T *EMAC, uint32_t u32Sec, uint32_t u32Nsec);
+void EMAC_DisableAlarm(EMAC_T *EMAC);
+
+uint32_t EMAC_CheckLinkStatus(EMAC_T *EMAC);
+
+void EMAC_Reset(EMAC_T *EMAC);
+void EMAC_PhyInit(EMAC_T *EMAC);
+int32_t EMAC_FillCamEntry(EMAC_T *EMAC, uint8_t pu8MacAddr[]);
+uint8_t *EMAC_ClaimFreeTXBuf(EMAC_MEMMGR_T *psMemMgr);
+uint32_t EMAC_GetAvailRXBufSize(EMAC_MEMMGR_T *psMemMgr, uint8_t **ppuDataBuf);
+uint32_t EMAC_SendPktWoCopy(EMAC_MEMMGR_T *psMemMgr, uint32_t u32Size);
+void EMAC_RecvPktDoneWoRxTrigger(EMAC_MEMMGR_T *psMemMgr);
+
+/*@}*/ /* end of group EMAC_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group EMAC_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NU_EMAC_H__ */
+
+/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/

+ 869 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_etimer.h

@@ -0,0 +1,869 @@
+/**************************************************************************//**
+ * @file     etimer.h
+ * @brief    ETIMER driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_ETIMER_H__
+#define __NU_ETIMER_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "nuc980.h"
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup ETIMER_Driver ETIMER Driver
+  @{
+*/
+
+/** @addtogroup ETIMER_EXPORTED_CONSTANTS ETIMER Exported Constants
+  @{
+*/
+
+#define ETIMER_ONESHOT_MODE                      (0UL)          /*!< Timer working in one shot mode   */
+#define ETIMER_PERIODIC_MODE                     (1UL << 4)     /*!< Timer working in periodic mode   */
+#define ETIMER_TOGGLE_MODE                       (2UL << 4)     /*!< Timer working in toggle mode     */
+#define ETIMER_CONTINUOUS_MODE                   (3UL << 4)     /*!< Timer working in continuous mode */
+
+#define ETIMER_CAPTURE_FREE_COUNTING_MODE        (0UL)          /*!< Free counting mode    */
+#define ETIMER_CAPTURE_TRIGGER_COUNTING_MODE     (1UL << 20)    /*!< Trigger counting mode */
+#define ETIMER_CAPTURE_COUNTER_RESET_MODE        (1UL << 17)    /*!< Counter reset mode    */
+
+#define ETIMER_CAPTURE_FALLING_EDGE              (0UL)          /*!< Falling edge trigger timer capture */
+#define ETIMER_CAPTURE_RISING_EDGE               (1UL << 18)    /*!< Rising edge trigger timer capture  */
+#define ETIMER_CAPTURE_FALLING_THEN_RISING_EDGE  (2UL << 18)    /*!< Falling edge then rising edge trigger timer capture */
+#define ETIMER_CAPTURE_RISING_THEN_FALLING_EDGE  (3UL << 18)    /*!< Rising edge then falling edge trigger timer capture */
+
+#define TIMER_TIMEOUT_TRIGGER                    (0UL)          /*!< Timer timeout trigger other modules */
+#define TIMER_CAPTURE_TRIGGER                    (1UL << 11)    /*!< Timer capture trigger other modules */
+
+#define TIMER_COUNTER_RISING_EDGE                (1UL << 13)    /*!< Counter increase on rising edge  */
+#define TIMER_COUNTER_FALLING_EDGE               (0UL)          /*!< Counter increase on falling edge */
+
+/*@}*/ /* end of group ETIMER_EXPORTED_CONSTANTS */
+
+/** @addtogroup ETIMER_EXPORTED_FUNCTIONS ETIMER Exported Functions
+  @{
+*/
+
+/**
+  * @brief This macro is used to set new Timer compared value
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @param[in] u32Value  Timer compare value. Valid values are between 2 to 0xFFFFFF
+  * @return None
+  * \hideinitializer
+  */
+#define ETIMER_SET_CMP_VALUE(timer, u32Value) \
+    do{\
+        if((timer) == 0) {\
+            outpw(REG_ETMR0_CMPR, u32Value);\
+        } else if((timer) == 1) {\
+            outpw(REG_ETMR1_CMPR, u32Value);\
+        } else if((timer) == 2) {\
+            outpw(REG_ETMR2_CMPR, u32Value);\
+        } else if((timer) == 3) {\
+            outpw(REG_ETMR3_CMPR, u32Value);\
+        } else if((timer) == 4) {\
+            outpw(REG_ETMR4_CMPR, u32Value);\
+        } else {\
+            outpw(REG_ETMR5_CMPR, u32Value);\
+        }\
+    }while(0)
+
+/**
+  * @brief This macro is used to set new Timer prescale value
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @param[in] u32Value  Timer prescale value. Valid values are between 0 to 0xFF
+  * @return None
+  * @note Clock input is divided by (prescale + 1) before it is fed into timer
+  * \hideinitializer
+  */
+#define ETIMER_SET_PRESCALE_VALUE(timer, u32Value) \
+    do{\
+        if((timer) == 0) {\
+            outpw(REG_ETMR0_PRECNT, u32Value);\
+        } else if((timer) == 1) {\
+            outpw(REG_ETMR1_PRECNT, u32Value);\
+        } else if((timer) == 2) {\
+            outpw(REG_ETMR2_PRECNT, u32Value);\
+        } else if((timer) == 3) {\
+            outpw(REG_ETMR3_PRECNT, u32Value);\
+        } else if((timer) == 4) {\
+            outpw(REG_ETMR4_PRECNT, u32Value);\
+        } else {\
+            outpw(REG_ETMR5_PRECNT, u32Value);\
+        }\
+    }while(0)
+
+/**
+* @brief      Select Timer operating mode
+*
+* @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
+* @param[in]  u32OpMode   Operation mode. Possible options are
+*                         - \ref ETIMER_ONESHOT_MODE
+*                         - \ref ETIMER_PERIODIC_MODE
+*                         - \ref ETIMER_TOGGLE_MODE
+*                         - \ref ETIMER_CONTINUOUS_MODE
+*
+* @return     None
+* \hideinitializer
+*/
+#define ETIMER_SET_OPMODE(timer, u32OpMode)   \
+            do{\
+        if((timer) == 0) {\
+            outpw(REG_ETMR0_CTL, (inpw(REG_ETMR0_CTL)&~0x30) | u32OpMode);\
+        } else if((timer) == 1) {\
+            outpw(REG_ETMR1_CTL, (inpw(REG_ETMR1_CTL)&~0x30) | u32OpMode);\
+        } else if((timer) == 2) {\
+            outpw(REG_ETMR2_CTL, (inpw(REG_ETMR2_CTL)&~0x30) | u32OpMode);\
+        } else if((timer) == 3) {\
+            outpw(REG_ETMR3_CTL, (inpw(REG_ETMR3_CTL)&~0x30) | u32OpMode);\
+        } else if((timer) == 4) {\
+            outpw(REG_ETMR4_CTL, (inpw(REG_ETMR4_CTL)&~0x30) | u32OpMode);\
+        } else {\
+            outpw(REG_ETMR5_CTL, (inpw(REG_ETMR5_CTL)&~0x30) | u32OpMode);\
+        }\
+    }while(0)
+
+/**
+  * @brief This macro is used to check if specify Timer is inactive or active
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return timer is activate or inactivate
+  * @retval 0 Timer 24-bit up counter is inactive
+  * @retval 1 Timer 24-bit up counter is active
+  * \hideinitializer
+  */
+static __inline int ETIMER_Is_Active(UINT timer)
+{
+    int reg;
+
+    if (timer == 0)
+    {
+        reg = inpw(REG_ETMR0_CTL);
+    }
+    else if (timer == 1)
+    {
+        reg = inpw(REG_ETMR1_CTL);
+    }
+    else if (timer == 2)
+    {
+        reg = inpw(REG_ETMR2_CTL);
+    }
+    else if (timer == 3)
+    {
+        reg = inpw(REG_ETMR3_CTL);
+    }
+    else if (timer == 4)
+    {
+        reg = inpw(REG_ETMR4_CTL);
+    }
+    else
+    {
+        reg = inpw(REG_ETMR5_CTL);
+    }
+    return (reg & 0x80) ? 1 : 0;
+}
+
+/**
+  * @brief This function is used to start Timer counting
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_Start(UINT timer)
+{
+
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_CTL, inpw(REG_ETMR0_CTL) | 1);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_CTL, inpw(REG_ETMR1_CTL) | 1);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_CTL, inpw(REG_ETMR2_CTL) | 1);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_CTL, inpw(REG_ETMR3_CTL) | 1);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_CTL, inpw(REG_ETMR4_CTL) | 1);
+    }
+    else
+    {
+        outpw(REG_ETMR5_CTL, inpw(REG_ETMR5_CTL) | 1);
+    }
+}
+
+/**
+  * @brief This function is used to stop Timer counting
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_Stop(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_CTL, inpw(REG_ETMR0_CTL) & ~1);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_CTL, inpw(REG_ETMR1_CTL) & ~1);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_CTL, inpw(REG_ETMR2_CTL) & ~1);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_CTL, inpw(REG_ETMR3_CTL) & ~1);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_CTL, inpw(REG_ETMR4_CTL) & ~1);
+    }
+    else
+    {
+        outpw(REG_ETMR5_CTL, inpw(REG_ETMR5_CTL) & ~1);
+    }
+}
+
+/**
+  * @brief This function is used to enable the Timer wake-up function
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  * @note  To wake the system from power down mode, timer clock source must be ether LXT or LIRC
+  */
+static __inline void ETIMER_EnableWakeup(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_CTL, inpw(REG_ETMR0_CTL) | 4);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_CTL, inpw(REG_ETMR1_CTL) | 4);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_CTL, inpw(REG_ETMR2_CTL) | 4);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_CTL, inpw(REG_ETMR3_CTL) | 4);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_CTL, inpw(REG_ETMR4_CTL) | 4);
+    }
+    else
+    {
+        outpw(REG_ETMR5_CTL, inpw(REG_ETMR5_CTL) | 4);
+    }
+}
+
+/**
+  * @brief This function is used to disable the Timer wake-up function
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_DisableWakeup(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_CTL, inpw(REG_ETMR0_CTL) & ~4);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_CTL, inpw(REG_ETMR1_CTL) & ~4);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_CTL, inpw(REG_ETMR2_CTL) & ~4);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_CTL, inpw(REG_ETMR3_CTL) & ~4);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_CTL, inpw(REG_ETMR4_CTL) & ~4);
+    }
+    else
+    {
+        outpw(REG_ETMR5_CTL, inpw(REG_ETMR5_CTL) & ~4);
+    }
+}
+
+
+/**
+  * @brief This function is used to enable the capture pin detection de-bounce function.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_EnableCaptureDebounce(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_CTL, inpw(REG_ETMR0_CTL) | 0x400000);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_CTL, inpw(REG_ETMR1_CTL) | 0x400000);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_CTL, inpw(REG_ETMR2_CTL) | 0x400000);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_CTL, inpw(REG_ETMR3_CTL) | 0x400000);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_CTL, inpw(REG_ETMR4_CTL) | 0x400000);
+    }
+    else
+    {
+        outpw(REG_ETMR5_CTL, inpw(REG_ETMR5_CTL) | 0x400000);
+    }
+}
+
+/**
+  * @brief This function is used to disable the capture pin detection de-bounce function.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_DisableCaptureDebounce(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_CTL, inpw(REG_ETMR0_CTL) & ~0x400000);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_CTL, inpw(REG_ETMR1_CTL) & ~0x400000);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_CTL, inpw(REG_ETMR2_CTL) & ~0x400000);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_CTL, inpw(REG_ETMR3_CTL) & ~0x400000);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_CTL, inpw(REG_ETMR4_CTL) & ~0x400000);
+    }
+    else
+    {
+        outpw(REG_ETMR5_CTL, inpw(REG_ETMR5_CTL) & ~0x400000);
+    }
+}
+
+
+/**
+  * @brief This function is used to enable the Timer time-out interrupt function.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_EnableInt(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_IER, inpw(REG_ETMR0_IER) | 1);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_IER, inpw(REG_ETMR1_IER) | 1);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_IER, inpw(REG_ETMR2_IER) | 1);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_IER, inpw(REG_ETMR3_IER) | 1);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_IER, inpw(REG_ETMR4_IER) | 1);
+    }
+    else
+    {
+        outpw(REG_ETMR5_IER, inpw(REG_ETMR5_IER) | 1);
+    }
+}
+
+/**
+  * @brief This function is used to disable the Timer time-out interrupt function.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_DisableInt(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_IER, inpw(REG_ETMR0_IER) & ~1);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_IER, inpw(REG_ETMR1_IER) & ~1);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_IER, inpw(REG_ETMR2_IER) & ~1);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_IER, inpw(REG_ETMR3_IER) & ~1);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_IER, inpw(REG_ETMR4_IER) & ~1);
+    }
+    else
+    {
+        outpw(REG_ETMR5_IER, inpw(REG_ETMR5_IER) & ~1);
+    }
+}
+
+/**
+  * @brief This function is used to enable the Timer capture trigger interrupt function.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_EnableCaptureInt(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_IER, inpw(REG_ETMR0_IER) | 2);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_IER, inpw(REG_ETMR1_IER) | 2);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_IER, inpw(REG_ETMR2_IER) | 2);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_IER, inpw(REG_ETMR3_IER) | 2);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_IER, inpw(REG_ETMR4_IER) | 2);
+    }
+    else
+    {
+        outpw(REG_ETMR5_IER, inpw(REG_ETMR5_IER) | 2);
+    }
+}
+
+/**
+  * @brief This function is used to disable the Timer capture trigger interrupt function.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_DisableCaptureInt(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_IER, inpw(REG_ETMR0_IER) & ~2);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_IER, inpw(REG_ETMR1_IER) & ~2);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_IER, inpw(REG_ETMR2_IER) & ~2);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_IER, inpw(REG_ETMR3_IER) & ~2);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_IER, inpw(REG_ETMR4_IER) & ~2);
+    }
+    else
+    {
+        outpw(REG_ETMR5_IER, inpw(REG_ETMR5_IER) & ~2);
+    }
+}
+
+/**
+  * @brief This function indicates Timer time-out interrupt occurred or not.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return Timer time-out interrupt occurred or not
+  * @retval 0 Timer time-out interrupt did not occur
+  * @retval 1 Timer time-out interrupt occurred
+  */
+static __inline UINT ETIMER_GetIntFlag(UINT timer)
+{
+    int reg;
+
+    if (timer == 0)
+    {
+        reg = inpw(REG_ETMR0_ISR);
+    }
+    else if (timer == 1)
+    {
+        reg = inpw(REG_ETMR1_ISR);
+    }
+    else if (timer == 2)
+    {
+        reg = inpw(REG_ETMR2_ISR);
+    }
+    else if (timer == 3)
+    {
+        reg = inpw(REG_ETMR3_ISR);
+    }
+    else if (timer == 4)
+    {
+        reg = inpw(REG_ETMR4_ISR);
+    }
+    else
+    {
+        reg = inpw(REG_ETMR5_ISR);
+    }
+    return reg & 1;
+}
+
+/**
+  * @brief This function clears the Timer time-out interrupt flag.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_ClearIntFlag(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_ISR, 1);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_ISR, 1);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_ISR, 1);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_ISR, 1);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_ISR, 1);
+    }
+    else
+    {
+        outpw(REG_ETMR5_ISR, 1);
+    }
+}
+
+/**
+  * @brief This function indicates Timer capture interrupt occurred or not.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return Timer capture interrupt occurred or not
+  * @retval 0 Timer capture interrupt did not occur
+  * @retval 1 Timer capture interrupt occurred
+  */
+static __inline UINT ETIMER_GetCaptureIntFlag(UINT timer)
+{
+    int reg;
+
+    if (timer == 0)
+    {
+        reg = inpw(REG_ETMR0_ISR);
+    }
+    else if (timer == 1)
+    {
+        reg = inpw(REG_ETMR1_ISR);
+    }
+    else if (timer == 2)
+    {
+        reg = inpw(REG_ETMR2_ISR);
+    }
+    else if (timer == 3)
+    {
+        reg = inpw(REG_ETMR3_ISR);
+    }
+    else if (timer == 4)
+    {
+        reg = inpw(REG_ETMR4_ISR);
+    }
+    else
+    {
+        reg = inpw(REG_ETMR5_ISR);
+    }
+    return (reg & 2) >> 1;
+}
+
+/**
+  * @brief This function clears the Timer capture interrupt flag.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_ClearCaptureIntFlag(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_ISR, 2);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_ISR, 2);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_ISR, 2);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_ISR, 2);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_ISR, 2);
+    }
+    else
+    {
+        outpw(REG_ETMR5_ISR, 2);
+    }
+}
+
+/**
+  * @brief This function indicates Timer has waked up system or not.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return Timer has waked up system or not
+  * @retval 0 Timer did not wake up system
+  * @retval 1 Timer wake up system
+  */
+static __inline UINT ETIMER_GetWakeupFlag(UINT timer)
+{
+    int reg;
+
+    if (timer == 0)
+    {
+        reg = inpw(REG_ETMR0_ISR);
+    }
+    else if (timer == 1)
+    {
+        reg = inpw(REG_ETMR1_ISR);
+    }
+    else if (timer == 2)
+    {
+        reg = inpw(REG_ETMR2_ISR);
+    }
+    else if (timer == 3)
+    {
+        reg = inpw(REG_ETMR3_ISR);
+    }
+    else if (timer == 4)
+    {
+        reg = inpw(REG_ETMR4_ISR);
+    }
+    else
+    {
+        reg = inpw(REG_ETMR5_ISR);
+    }
+    return (reg & 0x10) >> 4;
+}
+
+/**
+  * @brief This function clears the Timer wakeup interrupt flag.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return None
+  */
+static __inline void ETIMER_ClearWakeupFlag(UINT timer)
+{
+    if (timer == 0)
+    {
+        outpw(REG_ETMR0_ISR, 0x10);
+    }
+    else if (timer == 1)
+    {
+        outpw(REG_ETMR1_ISR, 0x10);
+    }
+    else if (timer == 2)
+    {
+        outpw(REG_ETMR2_ISR, 0x10);
+    }
+    else if (timer == 3)
+    {
+        outpw(REG_ETMR3_ISR, 0x10);
+    }
+    else if (timer == 4)
+    {
+        outpw(REG_ETMR4_ISR, 0x10);
+    }
+    else
+    {
+        outpw(REG_ETMR5_ISR, 0x10);
+    }
+}
+
+/**
+  * @brief This function gets the Timer compare value.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return Timer compare data value
+  */
+static __inline UINT ETIMER_GetCompareData(UINT timer)
+{
+
+    if (timer == 0)
+    {
+        return inpw(REG_ETMR0_CMPR);
+    }
+    else if (timer == 1)
+    {
+        return inpw(REG_ETMR1_CMPR);
+    }
+    else if (timer == 2)
+    {
+        return inpw(REG_ETMR2_CMPR);
+    }
+    else if (timer == 3)
+    {
+        return inpw(REG_ETMR3_CMPR);
+    }
+    else if (timer == 4)
+    {
+        return inpw(REG_ETMR4_CMPR);
+    }
+    else
+    {
+        return inpw(REG_ETMR5_CMPR);
+    }
+}
+
+/**
+  * @brief This function gets the Timer capture data.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return Timer capture data value
+  */
+static __inline UINT ETIMER_GetCaptureData(UINT timer)
+{
+
+    if (timer == 0)
+    {
+        return inpw(REG_ETMR0_TCAP);
+    }
+    else if (timer == 1)
+    {
+        return inpw(REG_ETMR1_TCAP);
+    }
+    else if (timer == 2)
+    {
+        return inpw(REG_ETMR2_TCAP);
+    }
+    else if (timer == 3)
+    {
+        return inpw(REG_ETMR3_TCAP);
+    }
+    else if (timer == 4)
+    {
+        return inpw(REG_ETMR4_TCAP);
+    }
+    else
+    {
+        return inpw(REG_ETMR5_TCAP);
+    }
+}
+
+/**
+  * @brief This function reports the current timer counter value.
+  * @param[in] timer ETIMER number. Range from 0 ~ 5
+  * @return Timer counter value
+  */
+static __inline UINT ETIMER_GetCounter(UINT timer)
+{
+    if (timer == 0)
+    {
+        return inpw(REG_ETMR0_DR);
+    }
+    else if (timer == 1)
+    {
+        return inpw(REG_ETMR1_DR);
+    }
+    else if (timer == 2)
+    {
+        return inpw(REG_ETMR2_DR);
+    }
+    else if (timer == 3)
+    {
+        return inpw(REG_ETMR3_DR);
+    }
+    else if (timer == 4)
+    {
+        return inpw(REG_ETMR4_DR);
+    }
+    else
+    {
+        return inpw(REG_ETMR5_DR);
+    }
+}
+
+static __inline UINT ETIMER_ClearCounter(UINT timer)
+{
+    if (timer == 0)
+    {
+        return outpw(REG_ETMR0_DR, 0);
+    }
+    else if (timer == 1)
+    {
+        return outpw(REG_ETMR1_DR, 0);
+    }
+    else if (timer == 2)
+    {
+        return outpw(REG_ETMR2_DR, 0);
+    }
+    else if (timer == 3)
+    {
+        return outpw(REG_ETMR3_DR, 0);
+    }
+    else if (timer == 4)
+    {
+        return outpw(REG_ETMR4_DR, 0);
+    }
+    else
+    {
+        return outpw(REG_ETMR5_DR, 0);
+    }
+}
+
+UINT ETIMER_Open(UINT timer, UINT u32Mode, UINT u32Freq);
+void ETIMER_Close(UINT timer);
+void ETIMER_Delay(UINT timer, UINT u32Usec);
+void ETIMER_EnableCapture(UINT timer, UINT u32CapMode, UINT u32Edge);
+void ETIMER_DisableCapture(UINT timer);
+void ETIMER_EnableEventCounter(UINT timer, uint32_t u32Edge);
+void ETIMER_DisableEventCounter(UINT timer);
+UINT ETIMER_GetModuleClock(UINT timer);
+
+/*@}*/ /* end of group ETIMER_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group ETIMER_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_ETIMER_H__

+ 835 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_gpio.h

@@ -0,0 +1,835 @@
+/**************************************************************************//**
+ * @file     GPIO.h
+ * @brief    GPIO driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ ******************************************************************************/
+#ifndef __NU_GPIO_H__
+#define __NU_GPIO_H__
+
+#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              */
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+   @addtogroup REGISTER Control Register
+   @{
+*/
+
+/**
+    @addtogroup GPIO General Purpose Input/Output Controller(GPIO)
+    Memory Mapped Structure for GPIO Controller
+@{ */
+
+
+typedef struct
+{
+
+    /**
+     * @var GPIO_T::MODE
+     * Offset: 0x00/0x40/0x80/0xC0/0x100/0x140/0x180/0x1C0  Port A-H I/O Mode Control
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[2n+1:2n]|MODEn    |Port A-H I/O Pin[n] Mode Control
+     * |        |          |Determine each I/O mode of Px.n pins.
+     * |        |          |00 = Px.n is in Input mode.
+     * |        |          |01 = Px.n is in Push-pull Output mode.
+     * |        |          |10 = Px.n is in Open-drain Output mode.
+     * |        |          |11 = Px.n is in Quasi-bidirectional mode.
+     * |        |          |Note1: The initial value of this field is defined by CIOINI (CONFIG0 [10]).
+     * |        |          |If CIOINI is set to 0, the default value is 0xFFFF_FFFF and all pins will be quasi-bidirectional mode after chip powered on.
+     * |        |          |If CIOINI is set to 1, the default value is 0x0000_0000 and all pins will be input mode after chip powered on.
+     * |        |          |Note2:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::DINOFF
+     * Offset: 0x04/0x44/0x84/0xC4/0x104/0x144/0x184/0x1C4  Port A-H Digital Input Path Disable Control
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n+16]  |DINOFFn   |Port A-H Pin[n] Digital Input Path Disable Control
+     * |        |          |Each of these bits is used to control if the digital input path of corresponding Px.n pin is disabled.
+     * |        |          |If input is analog signal, users can disable Px.n digital input path to avoid input current leakage.
+     * |        |          |0 = Px.n digital input path Enabled.
+     * |        |          |1 = Px.n digital input path Disabled (digital input tied to low).
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::DOUT
+     * Offset: 0x08/0x48/0x88/0xC8/0x108/0x148/0x188/0x1C8  Port A-H Data Output Value
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |DOUTn     |Port A-H Pin[n] Output Value
+     * |        |          |Each of these bits controls the status of a Px.n pin when the Px.n is configured as Push-pull output, Open-drain output or Quasi-bidirectional mode.
+     * |        |          |0 = Px.n will drive Low if the Px.n pin is configured as Push-pull output, Open-drain output or Quasi-bidirectional mode.
+     * |        |          |1 = Px.n will drive High if the Px.n pin is configured as Push-pull output or Quasi-bidirectional mode.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::DATMSK
+     * Offset: 0x0C/0x4C/0x8C/0xCC/0x10C/0x14C/0x18C/0x1CC  Port A-H Data Output Write Mask
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |DATMSKn    |Port A-H Pin[n] Data Output Write Mask
+     * |        |          |These bits are used to protect the corresponding DOUT (Px_DOUT[n]) bit.
+     * |        |          |When the DATMSK (Px_DATMSK[n]) bit is set to 1, the corresponding DOUT (Px_DOUT[n]) bit is protected.
+     * |        |          |If the write signal is masked, writing data to the protect bit is ignored.
+     * |        |          |0 = Corresponding DOUT (Px_DOUT[n]) bit can be updated.
+     * |        |          |1 = Corresponding DOUT (Px_DOUT[n]) bit protected.
+     * |        |          |Note1: This function only protects the corresponding DOUT (Px_DOUT[n]) bit, and will not protect the corresponding PDIO (Pxn_PDIO[n]) bit.
+     * |        |          |Note2:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::PIN
+     * Offset: 0x10/0x50/0x90/0xD0/0x110/0x150/0x190/0x1D0  Port A-H Pin Value
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |PINn      |Port A-H Pin[n] Pin Value
+     * |        |          |Each bit of the register reflects the actual status of the respective Px.n pin.
+     * |        |          |If the bit is 1, it indicates the corresponding pin status is high; else the pin status is low.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::DBEN
+     * Offset: 0x14/0x54/0x94/0xD4/0x114/0x154/0x194/0x1D4  Port A-H De-Bounce Enable Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |DBENn     |Port A-H Pin[n] Input Signal De-Bounce Enable Bit
+     * |        |          |The DBEN[n] bit is used to enable the de-bounce function for each corresponding bit.
+     * |        |          |If the input signal pulse width cannot be sampled by continuous two de-bounce sample cycle, the input signal transition is seen as the signal bounce and will not trigger the interrupt.
+     * |        |          |The de-bounce clock source is controlled by DBCLKSRC (GPIO_DBCTL [4]), one de-bounce sample cycle period is controlled by DBCLKSEL (GPIO_DBCTL [3:0]).
+     * |        |          |0 = Px.n de-bounce function Disabled.
+     * |        |          |1 = Px.n de-bounce function Enabled.
+     * |        |          |The de-bounce function is valid only for edge triggered interrupt.
+     * |        |          |If the interrupt mode is level triggered, the de-bounce enable bit is ignored.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::INTTYPE
+     * Offset: 0x18/0x58/0x98/0xD8/0x118/0x158/0x198/0x1D8  Port A-H Interrupt Trigger Type Control
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |TYPEn     |Port A-H Pin[n] Edge or Level Detection Interrupt Trigger Type Control
+     * |        |          |TYPE (Px_INTTYPE[n]) bit is used to control the triggered interrupt is by level trigger or by edge trigger.
+     * |        |          |If the interrupt is by edge trigger, the trigger source can be controlled by de-bounce.
+     * |        |          |If the interrupt is by level trigger, the input source is sampled by one HCLK clock and generates the interrupt.
+     * |        |          |0 = Edge trigger interrupt.
+     * |        |          |1 = Level trigger interrupt.
+     * |        |          |If the pin is set as the level trigger interrupt, only one level can be set on the registers RHIEN (Px_INTEN[n+16])/FLIEN (Px_INTEN[n]).
+     * |        |          |If both levels to trigger interrupt are set, the setting is ignored and no interrupt will occur.
+     * |        |          |The de-bounce function is valid only for edge triggered interrupt.
+     * |        |          |If the interrupt mode is level triggered, the de-bounce enable bit is ignored.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::INTEN
+     * Offset: 0x1C/0x5C/0x9C/0xDC/0x11C/0x15C/0x19C/0x1DC  Port A-H Interrupt Enable Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |FLIENn    |Port A-H Pin[n] Falling Edge or Low Level Interrupt Trigger Type Enable Bit
+     * |        |          |The FLIEN (Px_INTEN[n]) bit is used to enable the interrupt for each of the corresponding input Px.n pin.
+     * |        |          |Set bit to 1 also enable the pin wake-up function.
+     * |        |          |When setting the FLIEN (Px_INTEN[n]) bit to 1 :
+     * |        |          |If the interrupt is level trigger (TYPE (Px_INTTYPE[n]) bit is set to 1), the input Px.n pin will generate the interrupt while this pin state is at low level.
+     * |        |          |If the interrupt is edge trigger(TYPE (Px_INTTYPE[n]) bit is set to 0), the input Px.n pin will generate the interrupt while this pin state changed from high to low.
+     * |        |          |0 = Px.n level low or high to low interrupt Disabled.
+     * |        |          |1 = Px.n level low or high to low interrupt Enabled.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * |[n+16]  |RHIENn    |Port A-H Pin[n] Rising Edge or High Level Interrupt Trigger Type Enable Bit
+     * |        |          |The RHIEN (Px_INTEN[n+16]) bit is used to enable the interrupt for each of the corresponding input Px.n pin
+     * |        |          |Set bit to 1 also enable the pin wake-up function.
+     * |        |          |When setting the RHIEN (Px_INTEN[n+16]) bit to 1 :
+     * |        |          |If the interrupt is level trigger (TYPE (Px_INTTYPE[n]) bit is set to 1), the input Px.n pin will generate the interrupt while this pin state is at high level.
+     * |        |          |If the interrupt is edge trigger (TYPE (Px_INTTYPE[n]) bit is set to 0), the input Px.n pin will generate the interrupt while this pin state changed from low to high.
+     * |        |          |0 = Px.n level high or low to high interrupt Disabled.
+     * |        |          |1 = Px.n level high or low to high interrupt Enabled.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::INTSRC
+     * Offset: 0x20/0x60/0xA0/0xE0/0x120/0x160/0x1A0/0x1E0  Port A-H Interrupt Source Flag
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |INTSRCn   |Port A-H Pin[n] Interrupt Source Flag
+     * |        |          |Write Operation :
+     * |        |          |0 = No action.
+     * |        |          |1 = Clear the corresponding pending interrupt.
+     * |        |          |Read Operation :
+     * |        |          |0 = No interrupt at Px.n.
+     * |        |          |1 = Px.n generates an interrupt.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::SMTEN
+     * Offset: 0x24/0x64/0xA4/0xE4/0x124/0x164/0x1A4/0x1E4  Port A-H Input Schmitt Trigger Enable Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[n]     |SMTENn    |Port A-H Pin[n] Input Schmitt Trigger Enable Bit
+     * |        |          |0 = Px.n input Schmitt trigger function Disabled.
+     * |        |          |1 = Px.n input Schmitt trigger function Enabled.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::SLEWCTL
+     * Offset: 0x28/0x68/0xA8/0xE8/0x128/0x168/0x1A8/0x1E8  Port A-H High Slew Rate Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[2n+1:2n]|HSRENn    |Port A-H Pin[n] High Slew Rate Control
+     * |        |          |00 = Px.n output with normal slew rate mode (maximum 40 MHz at 2.7V).
+     * |        |          |01 = Px.n output with high slew rate mode (maximum 80 MHz at 2.7V).
+     * |        |          |10 = Px.n output with fast slew rate mode (maximum 100 MHz at 2.7V.
+     * |        |          |11 = Reserved.
+     * |        |          |Note:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     * @var GPIO_T::PUSEL
+     * Offset: 0x30/0x70/0xB0/0xF0/0x130/0x170/0x1B0/0x1F0  Port A-H Pull-up and Pull-down Selection Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[2n+1:2n]|PUSELn    |Port A-H Pin[n] Pull-up and Pull-down Enable Register
+     * |        |          |Determine each I/O Pull-up/pull-down of Px.n pins.
+     * |        |          |00 = Px.n pull-up and pull-up disable.
+     * |        |          |01 = Px.n pull-up enable.
+     * |        |          |10 = Px.n pull-down enable.
+     * |        |          |11 = Px.n pull-up and pull-up disable.
+     * |        |          |Note1:
+     * |        |          |Basically, the pull-up control and pull-down control has following behavior limitation
+     * |        |          |The independent pull-up control register only valid when MODEn set as tri-state and open-drain mode
+     * |        |          |The independent pull-down control register only valid when MODEn set as tri-state mode
+     * |        |          |When both pull-up pull-down is set as 1 at tri-state mode, keep I/O in tri-state mode
+     * |        |          |Note2:
+     * |        |          |Max. n=15 for port A/B/E/G.
+     * |        |          |Max. n=14 for port C/D.
+     * |        |          |Max. n=11 for port F/H.
+     */
+
+    __IO uint32_t MODE;          /* Offset: 0x00/0x40/0x80/0xC0/0x100/0x140/0x180/0x1C0  Port A-H I/O Mode Control                       */
+    __IO uint32_t DINOFF;        /* Offset: 0x04/0x44/0x84/0xC4/0x104/0x144/0x184/0x1C4  Port A-H Digital Input Path Disable Control     */
+    __IO uint32_t DOUT;          /* Offset: 0x08/0x48/0x88/0xC8/0x108/0x148/0x188/0x1C8  Port A-H Data Output Value                      */
+    __IO uint32_t DATMSK;        /* Offset: 0x0C/0x4C/0x8C/0xCC/0x10C/0x14C/0x18C/0x1CC  Port A-H Data Output Write Mask                 */
+    __I  uint32_t PIN;           /* Offset: 0x10/0x50/0x90/0xD0/0x110/0x150/0x190/0x1D0  Port A-H Pin Value                              */
+    __IO uint32_t DBEN;          /* Offset: 0x14/0x54/0x94/0xD4/0x114/0x154/0x194/0x1D4  Port A-H De-Bounce Enable Control Register      */
+    __IO uint32_t INTTYPE;       /* Offset: 0x18/0x58/0x98/0xD8/0x118/0x158/0x198/0x1D8  Port A-H Interrupt Trigger Type Control         */
+    __IO uint32_t INTEN;         /* Offset: 0x1C/0x5C/0x9C/0xDC/0x11C/0x15C/0x19C/0x1DC  Port A-H Interrupt Enable Control Register      */
+    __IO uint32_t INTSRC;        /* Offset: 0x20/0x60/0xA0/0xE0/0x120/0x160/0x1A0/0x1E0  Port A-H Interrupt Source Flag                  */
+    __IO uint32_t SMTEN;         /* Offset: 0x24/0x64/0xA4/0xE4/0x124/0x164/0x1A4/0x1E4  Port A-H Input Schmitt Trigger Enable Register  */
+    __IO uint32_t SLEWCTL;       /* Offset: 0x28/0x68/0xA8/0xE8/0x128/0x168/0x1A8/0x1E8  Port A-H High Slew Rate Control Register        */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE0[1];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t PUSEL;         /* Offset: 0x30/0x70/0xB0/0xF0/0x130/0x170/0x1B0/0x1F0  Port A-H Pull-up and Pull-down Enable Register  */
+
+} GPIO_T;
+
+typedef struct
+{
+
+    /**
+     * @var GPIO_DBCTL_T::DBCTL
+     * Offset: 0x440  Interrupt De-bounce Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[3:0]   |DBCLKSEL  |De-Bounce Sampling Cycle Selection
+     * |        |          |0000 = Sample interrupt input once per 1 clocks.
+     * |        |          |0001 = Sample interrupt input once per 2 clocks.
+     * |        |          |0010 = Sample interrupt input once per 4 clocks.
+     * |        |          |0011 = Sample interrupt input once per 8 clocks.
+     * |        |          |0100 = Sample interrupt input once per 16 clocks.
+     * |        |          |0101 = Sample interrupt input once per 32 clocks.
+     * |        |          |0110 = Sample interrupt input once per 64 clocks.
+     * |        |          |0111 = Sample interrupt input once per 128 clocks.
+     * |        |          |1000 = Sample interrupt input once per 256 clocks.
+     * |        |          |1001 = Sample interrupt input once per 2*256 clocks.
+     * |        |          |1010 = Sample interrupt input once per 4*256 clocks.
+     * |        |          |1011 = Sample interrupt input once per 8*256 clocks.
+     * |        |          |1100 = Sample interrupt input once per 16*256 clocks.
+     * |        |          |1101 = Sample interrupt input once per 32*256 clocks.
+     * |        |          |1110 = Sample interrupt input once per 64*256 clocks.
+     * |        |          |1111 = Sample interrupt input once per 128*256 clocks.
+     * |[4]     |DBCLKSRC  |De-Bounce Counter Clock Source Selection
+     * |        |          |0 = De-bounce counter clock source is the HCLK.
+     * |        |          |1 = De-bounce counter clock source is the 10 kHz internal low speed RC oscillator (LIRC).
+     * |[5]     |ICLKON    |Interrupt Clock On Mode
+     * |        |          |0 = Edge detection circuit is active only if I/O pin corresponding RHIEN (Px_INTEN[n+16])/FLIEN (Px_INTEN[n]) bit is set to 1.
+     * |        |          |1 = All I/O pins edge detection circuit is always active after reset.
+     * |        |          |Note: It is recommended to disable this bit to save system power if no special application concern.
+     */
+
+    __IO uint32_t DBCTL;         /* Offset: 0x440  Interrupt De-bounce Control Register                              */
+
+} GPIO_DBCTL_T;
+
+/**
+    @addtogroup GPIO_CONST GPIO Bit Field Definition
+    Constant Definitions for GPIO Controller
+@{ */
+
+#define GPIO_DBCTL_DBCLKSEL_Pos          (0)                                               /*!< GPIO_T::DBCTL: DBCLKSEL Position          */
+#define GPIO_DBCTL_DBCLKSEL_Msk          (0xFul << GPIO_DBCTL_DBCLKSEL_Pos)                /*!< GPIO_T::DBCTL: DBCLKSEL Mask              */
+
+#define GPIO_DBCTL_DBCLKSRC_Pos          (4)                                               /*!< GPIO_T::DBCTL: DBCLKSRC Position          */
+#define GPIO_DBCTL_DBCLKSRC_Msk          (1ul << GPIO_DBCTL_DBCLKSRC_Pos)                  /*!< GPIO_T::DBCTL: DBCLKSRC Mask              */
+
+#define GPIO_DBCTL_ICLKON_Pos            (5)                                               /*!< GPIO_T::DBCTL: ICLKON Position            */
+#define GPIO_DBCTL_ICLKON_Msk            (1ul << GPIO_DBCTL_ICLKON_Pos)                    /*!< GPIO_T::DBCTL: ICLKON Mask                */
+
+/**@}*/ /* GPIO_CONST */
+/**@}*/ /* end of GPIO register group */
+/**@}*/ /* end of REGISTER group */
+
+/** @addtogroup PERIPHERAL_DECLARATION Peripheral Pointer
+  The Declaration of Peripherals
+  @{
+ */
+
+#define GPIO_DBCTL_BASE       (0xB0004440ul)
+#define PA                    ((GPIO_T *)  PA_BA)
+#define PB                    ((GPIO_T *)  PB_BA)
+#define PC                    ((GPIO_T *)  PC_BA)
+#define PD                    ((GPIO_T *)  PD_BA)
+#define PE                    ((GPIO_T *)  PE_BA)
+#define PF                    ((GPIO_T *)  PF_BA)
+#define PG                    ((GPIO_T *)  PG_BA)
+#define GPIOA                 ((GPIO_T *)  PA_BA)
+#define GPIOB                 ((GPIO_T *)  PB_BA)
+#define GPIOC                 ((GPIO_T *)  PC_BA)
+#define GPIOD                 ((GPIO_T *)  PD_BA)
+#define GPIOE                 ((GPIO_T *)  PE_BA)
+#define GPIOF                 ((GPIO_T *)  PF_BA)
+#define GPIOG                 ((GPIO_T *)  PG_BA)
+#define GPIO                  ((GPIO_DBCTL_T *) GPIO_DBCTL_BASE)
+#define GPIO_PIN_DATA_BASE    (0xB0004800ul)
+/*@}*/ /* end of group ERIPHERAL_DECLARATION */
+
+
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup GPIO_Driver GPIO Driver
+  @{
+*/
+
+/** @addtogroup GPIO_EXPORTED_CONSTANTS GPIO Exported Constants
+  @{
+*/
+
+
+#define GPIO_PIN_MAX            16UL /*!< Specify Maximum Pins of Each GPIO Port \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  GPIO_MODE Constant Definitions                                                                         */
+/*---------------------------------------------------------------------------------------------------------*/
+#define GPIO_MODE_INPUT          0x0UL /*!< Input Mode \hideinitializer */
+#define GPIO_MODE_OUTPUT         0x1UL /*!< Output Mode \hideinitializer */
+#define GPIO_MODE_OPEN_DRAIN     0x2UL /*!< Open-Drain Mode \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  GPIO Interrupt Type Constant Definitions                                                               */
+/*---------------------------------------------------------------------------------------------------------*/
+#define GPIO_INT_RISING         0x00010000UL /*!< Interrupt enable by Input Rising Edge \hideinitializer */
+#define GPIO_INT_FALLING        0x00000001UL /*!< Interrupt enable by Input Falling Edge \hideinitializer */
+#define GPIO_INT_BOTH_EDGE      0x00010001UL /*!< Interrupt enable by both Rising Edge and Falling Edge \hideinitializer */
+#define GPIO_INT_HIGH           0x01010000UL /*!< Interrupt enable by Level-High \hideinitializer */
+#define GPIO_INT_LOW            0x01000001UL /*!< Interrupt enable by Level-Level \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  GPIO_INTTYPE Constant Definitions                                                                      */
+/*---------------------------------------------------------------------------------------------------------*/
+#define GPIO_INTTYPE_EDGE           0UL /*!< GPIO_INTTYPE Setting for Edge Trigger Mode \hideinitializer */
+#define GPIO_INTTYPE_LEVEL          1UL /*!< GPIO_INTTYPE Setting for Edge Level Mode \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  GPIO Slew Rate Type Constant Definitions                                                               */
+/*---------------------------------------------------------------------------------------------------------*/
+#define GPIO_SLEWCTL_NORMAL         0x0UL           /*!< GPIO slew setting for nornal Mode \hideinitializer */
+#define GPIO_SLEWCTL_HIGH           0x1UL           /*!< GPIO slew setting for high Mode \hideinitializer */
+#define GPIO_SLEWCTL_FAST           0x2UL           /*!< GPIO slew setting for fast Mode \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  GPIO Pull-up And Pull-down Type Constant Definitions                                                   */
+/*---------------------------------------------------------------------------------------------------------*/
+#define GPIO_PUSEL_DISABLE          0x0UL           /*!< GPIO PUSEL setting for Disable Mode \hideinitializer */
+#define GPIO_PUSEL_PULL_UP          0x1UL           /*!< GPIO PUSEL setting for Pull-up Mode \hideinitializer */
+#define GPIO_PUSEL_PULL_DOWN        0x2UL           /*!< GPIO PUSEL setting for Pull-down Mode \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  GPIO External interrupt Constant Definitions                                                           */
+/*---------------------------------------------------------------------------------------------------------*/
+#define GPIO_MFP_PA0MFP_EINT0   outpw(REG_SYS_GPA_MFPL, ((inpw(REG_SYS_GPA_MFPL) & 0xFFFFFFF0) | 0x00000005)) /*!< PA0 MFP setting for EINT0  \hideinitializer */
+#define GPIO_MFP_PA13MFP_EINT0  outpw(REG_SYS_GPA_MFPH, ((inpw(REG_SYS_GPA_MFPH) & 0xFF0FFFFF) | 0x00D00000)) /*!< PA13 MFP setting for EINT0  \hideinitializer */
+#define GPIO_MFP_PA1MFP_EINT1   outpw(REG_SYS_GPA_MFPL, ((inpw(REG_SYS_GPA_MFPL) & 0xFFFFFF0F) | 0x000000D0)) /*!< PA1 MFP setting for EINT1  \hideinitializer */
+#define GPIO_MFP_PA14MFP_EINT1  outpw(REG_SYS_GPA_MFPH, ((inpw(REG_SYS_GPA_MFPH) & 0xF0FFFFFF) | 0x08000000)) /*!< PA14 MFP setting for EINT1  \hideinitializer */
+#define GPIO_MFP_PD0MFP_EINT2   outpw(REG_SYS_GPD_MFPL, ((inpw(REG_SYS_GPD_MFPL) & 0xFFFFFFF0) | 0x00000004)) /*!< PD0 MFP setting for EINT2  \hideinitializer */
+#define GPIO_MFP_PE10MFP_EINT2  outpw(REG_SYS_GPE_MFPH, ((inpw(REG_SYS_GPE_MFPH) & 0xFFFFF0FF) | 0x00000500)) /*!< PE10 MFP setting for EINT2  \hideinitializer */
+#define GPIO_MFP_PB3MFP_EINT2   outpw(REG_SYS_GPB_MFPL, ((inpw(REG_SYS_GPB_MFPL) & 0xFFFF0FFF) | 0x00003000)) /*!< PB3 MFP setting for EINT2  \hideinitializer */
+#define GPIO_MFP_PB13MFP_EINT2  outpw(REG_SYS_GPB_MFPH, ((inpw(REG_SYS_GPB_MFPH) & 0xFF0FFFFF) | 0x00200000)) /*!< PB13 MFP setting for EINT2  \hideinitializer */
+#define GPIO_MFP_PD1MFP_EINT3   outpw(REG_SYS_GPD_MFPL, ((inpw(REG_SYS_GPD_MFPL) & 0xFFFFFF0F) | 0x00000040)) /*!< PD1 MFP setting for EINT3  \hideinitializer */
+#define GPIO_MFP_PE12MFP_EINT3  outpw(REG_SYS_GPE_MFPH, ((inpw(REG_SYS_GPE_MFPH) & 0xFFF0FFFF) | 0x00050000)) /*!< PE12 MFP setting for EINT3  \hideinitializer */
+#define GPIO_MFP_PG15MFP_EINT3  outpw(REG_SYS_GPG_MFPH, ((inpw(REG_SYS_GPG_MFPH) & 0x0FFFFFFF) | 0x40000000)) /*!< PG15 MFP setting for EINT3  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  GPIO_DBCTL Constant Definitions                                                                          */
+/*---------------------------------------------------------------------------------------------------------*/
+#define GPIO_DBCTL_ICLK_ON            0x00000020UL /*!< GPIO_DBCTL setting for all IO pins edge detection circuit is always active after reset \hideinitializer */
+#define GPIO_DBCTL_ICLK_OFF           0x00000000UL /*!< GPIO_DBCTL setting for edge detection circuit is active only if IO pin corresponding GPIOx_IEN bit is set to 1 \hideinitializer */
+
+#define GPIO_DBCTL_DBCLKSRC_LIRC      0x00000010UL /*!< GPIO_DBCTL setting for de-bounce counter clock source is the internal 10 kHz \hideinitializer */
+#define GPIO_DBCTL_DBCLKSRC_HCLK      0x00000000UL /*!< GPIO_DBCTL setting for de-bounce counter clock source is the HCLK \hideinitializer */
+
+#define GPIO_DBCTL_DBCLKSEL_1         0x00000000UL /*!< GPIO_DBCTL setting for sampling cycle = 1 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_2         0x00000001UL /*!< GPIO_DBCTL setting for sampling cycle = 2 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_4         0x00000002UL /*!< GPIO_DBCTL setting for sampling cycle = 4 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_8         0x00000003UL /*!< GPIO_DBCTL setting for sampling cycle = 8 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_16        0x00000004UL /*!< GPIO_DBCTL setting for sampling cycle = 16 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_32        0x00000005UL /*!< GPIO_DBCTL setting for sampling cycle = 32 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_64        0x00000006UL /*!< GPIO_DBCTL setting for sampling cycle = 64 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_128       0x00000007UL /*!< GPIO_DBCTL setting for sampling cycle = 128 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_256       0x00000008UL /*!< GPIO_DBCTL setting for sampling cycle = 256 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_512       0x00000009UL /*!< GPIO_DBCTL setting for sampling cycle = 512 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_1024      0x0000000AUL /*!< GPIO_DBCTL setting for sampling cycle = 1024 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_2048      0x0000000BUL /*!< GPIO_DBCTL setting for sampling cycle = 2048 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_4096      0x0000000CUL /*!< GPIO_DBCTL setting for sampling cycle = 4096 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_8192      0x0000000DUL /*!< GPIO_DBCTL setting for sampling cycle = 8192 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_16384     0x0000000EUL /*!< GPIO_DBCTL setting for sampling cycle = 16384 clocks \hideinitializer */
+#define GPIO_DBCTL_DBCLKSEL_32768     0x0000000FUL /*!< GPIO_DBCTL setting for sampling cycle = 32768 clocks \hideinitializer */
+
+
+/* Define GPIO Pin Data Input/Output. It could be used to control each I/O pin by pin address mapping.
+   Example 1:
+
+       PA0 = 1;
+
+   It is used to set GPIO PA.0 to high;
+
+   Example 2:
+
+       if (PA0)
+           PA0 = 0;
+
+   If GPIO PA.0 pin status is high, then set GPIO PA.0 data output to low.
+ */
+#define GPIO_PIN_DATA(port, pin)    (*((volatile uint32_t *)((GPIO_PIN_DATA_BASE+(0x40*(port))) + ((pin)<<2)))) /*!< Pin Data Input/Output \hideinitializer */
+#define PA0             GPIO_PIN_DATA(0, 0 ) /*!< Specify PA.0 Pin Data Input/Output \hideinitializer */
+#define PA1             GPIO_PIN_DATA(0, 1 ) /*!< Specify PA.1 Pin Data Input/Output \hideinitializer */
+#define PA2             GPIO_PIN_DATA(0, 2 ) /*!< Specify PA.2 Pin Data Input/Output \hideinitializer */
+#define PA3             GPIO_PIN_DATA(0, 3 ) /*!< Specify PA.3 Pin Data Input/Output \hideinitializer */
+#define PA4             GPIO_PIN_DATA(0, 4 ) /*!< Specify PA.4 Pin Data Input/Output \hideinitializer */
+#define PA5             GPIO_PIN_DATA(0, 5 ) /*!< Specify PA.5 Pin Data Input/Output \hideinitializer */
+#define PA6             GPIO_PIN_DATA(0, 6 ) /*!< Specify PA.6 Pin Data Input/Output \hideinitializer */
+#define PA7             GPIO_PIN_DATA(0, 7 ) /*!< Specify PA.7 Pin Data Input/Output \hideinitializer */
+#define PA8             GPIO_PIN_DATA(0, 8 ) /*!< Specify PA.8 Pin Data Input/Output \hideinitializer */
+#define PA9             GPIO_PIN_DATA(0, 9 ) /*!< Specify PA.9 Pin Data Input/Output \hideinitializer */
+#define PA10            GPIO_PIN_DATA(0, 10) /*!< Specify PA.10 Pin Data Input/Output \hideinitializer */
+#define PA11            GPIO_PIN_DATA(0, 11) /*!< Specify PA.11 Pin Data Input/Output \hideinitializer */
+#define PA12            GPIO_PIN_DATA(0, 12) /*!< Specify PA.12 Pin Data Input/Output \hideinitializer */
+#define PA13            GPIO_PIN_DATA(0, 13) /*!< Specify PA.13 Pin Data Input/Output \hideinitializer */
+#define PA14            GPIO_PIN_DATA(0, 14) /*!< Specify PA.14 Pin Data Input/Output \hideinitializer */
+#define PA15            GPIO_PIN_DATA(0, 15) /*!< Specify PA.15 Pin Data Input/Output \hideinitializer */
+#define PB0             GPIO_PIN_DATA(1, 0 ) /*!< Specify PB.0 Pin Data Input/Output \hideinitializer */
+#define PB1             GPIO_PIN_DATA(1, 1 ) /*!< Specify PB.1 Pin Data Input/Output \hideinitializer */
+#define PB2             GPIO_PIN_DATA(1, 2 ) /*!< Specify PB.2 Pin Data Input/Output \hideinitializer */
+#define PB3             GPIO_PIN_DATA(1, 3 ) /*!< Specify PB.3 Pin Data Input/Output \hideinitializer */
+#define PB4             GPIO_PIN_DATA(1, 4 ) /*!< Specify PB.4 Pin Data Input/Output \hideinitializer */
+#define PB5             GPIO_PIN_DATA(1, 5 ) /*!< Specify PB.5 Pin Data Input/Output \hideinitializer */
+#define PB6             GPIO_PIN_DATA(1, 6 ) /*!< Specify PB.6 Pin Data Input/Output \hideinitializer */
+#define PB7             GPIO_PIN_DATA(1, 7 ) /*!< Specify PB.7 Pin Data Input/Output \hideinitializer */
+#define PB8             GPIO_PIN_DATA(1, 8 ) /*!< Specify PB.8 Pin Data Input/Output \hideinitializer */
+#define PB9             GPIO_PIN_DATA(1, 9 ) /*!< Specify PB.9 Pin Data Input/Output \hideinitializer */
+#define PB10            GPIO_PIN_DATA(1, 10) /*!< Specify PB.10 Pin Data Input/Output \hideinitializer */
+#define PB11            GPIO_PIN_DATA(1, 11) /*!< Specify PB.11 Pin Data Input/Output \hideinitializer */
+#define PB12            GPIO_PIN_DATA(1, 12) /*!< Specify PB.12 Pin Data Input/Output \hideinitializer */
+#define PB13            GPIO_PIN_DATA(1, 13) /*!< Specify PB.13 Pin Data Input/Output \hideinitializer */
+#define PB14            GPIO_PIN_DATA(1, 14) /*!< Specify PB.14 Pin Data Input/Output \hideinitializer */
+#define PB15            GPIO_PIN_DATA(1, 15) /*!< Specify PB.15 Pin Data Input/Output \hideinitializer */
+#define PC0             GPIO_PIN_DATA(2, 0 ) /*!< Specify PC.0 Pin Data Input/Output \hideinitializer */
+#define PC1             GPIO_PIN_DATA(2, 1 ) /*!< Specify PC.1 Pin Data Input/Output \hideinitializer */
+#define PC2             GPIO_PIN_DATA(2, 2 ) /*!< Specify PC.2 Pin Data Input/Output \hideinitializer */
+#define PC3             GPIO_PIN_DATA(2, 3 ) /*!< Specify PC.3 Pin Data Input/Output \hideinitializer */
+#define PC4             GPIO_PIN_DATA(2, 4 ) /*!< Specify PC.4 Pin Data Input/Output \hideinitializer */
+#define PC5             GPIO_PIN_DATA(2, 5 ) /*!< Specify PC.5 Pin Data Input/Output \hideinitializer */
+#define PC6             GPIO_PIN_DATA(2, 6 ) /*!< Specify PC.6 Pin Data Input/Output \hideinitializer */
+#define PC7             GPIO_PIN_DATA(2, 7 ) /*!< Specify PC.7 Pin Data Input/Output \hideinitializer */
+#define PC8             GPIO_PIN_DATA(2, 8 ) /*!< Specify PC.8 Pin Data Input/Output \hideinitializer */
+#define PC9             GPIO_PIN_DATA(2, 9 ) /*!< Specify PC.9 Pin Data Input/Output \hideinitializer */
+#define PC10            GPIO_PIN_DATA(2, 10) /*!< Specify PC.10 Pin Data Input/Output \hideinitializer */
+#define PC11            GPIO_PIN_DATA(2, 11) /*!< Specify PC.11 Pin Data Input/Output \hideinitializer */
+#define PC12            GPIO_PIN_DATA(2, 12) /*!< Specify PC.12 Pin Data Input/Output \hideinitializer */
+#define PC13            GPIO_PIN_DATA(2, 13) /*!< Specify PC.13 Pin Data Input/Output \hideinitializer */
+#define PC14            GPIO_PIN_DATA(2, 14) /*!< Specify PC.14 Pin Data Input/Output \hideinitializer */
+#define PC15            GPIO_PIN_DATA(2, 15) /*!< Specify PC.15 Pin Data Input/Output \hideinitializer */
+#define PD0             GPIO_PIN_DATA(3, 0 ) /*!< Specify PD.0 Pin Data Input/Output \hideinitializer */
+#define PD1             GPIO_PIN_DATA(3, 1 ) /*!< Specify PD.1 Pin Data Input/Output \hideinitializer */
+#define PD2             GPIO_PIN_DATA(3, 2 ) /*!< Specify PD.2 Pin Data Input/Output \hideinitializer */
+#define PD3             GPIO_PIN_DATA(3, 3 ) /*!< Specify PD.3 Pin Data Input/Output \hideinitializer */
+#define PD4             GPIO_PIN_DATA(3, 4 ) /*!< Specify PD.4 Pin Data Input/Output \hideinitializer */
+#define PD5             GPIO_PIN_DATA(3, 5 ) /*!< Specify PD.5 Pin Data Input/Output \hideinitializer */
+#define PD6             GPIO_PIN_DATA(3, 6 ) /*!< Specify PD.6 Pin Data Input/Output \hideinitializer */
+#define PD7             GPIO_PIN_DATA(3, 7 ) /*!< Specify PD.7 Pin Data Input/Output \hideinitializer */
+#define PD8             GPIO_PIN_DATA(3, 8 ) /*!< Specify PD.8 Pin Data Input/Output \hideinitializer */
+#define PD9             GPIO_PIN_DATA(3, 9 ) /*!< Specify PD.9 Pin Data Input/Output \hideinitializer */
+#define PD10            GPIO_PIN_DATA(3, 10) /*!< Specify PD.10 Pin Data Input/Output \hideinitializer */
+#define PD11            GPIO_PIN_DATA(3, 11) /*!< Specify PD.11 Pin Data Input/Output \hideinitializer */
+#define PD12            GPIO_PIN_DATA(3, 12) /*!< Specify PD.12 Pin Data Input/Output \hideinitializer */
+#define PD13            GPIO_PIN_DATA(3, 13) /*!< Specify PD.13 Pin Data Input/Output \hideinitializer */
+#define PD14            GPIO_PIN_DATA(3, 14) /*!< Specify PD.14 Pin Data Input/Output \hideinitializer */
+#define PE0             GPIO_PIN_DATA(4, 0 ) /*!< Specify PE.0 Pin Data Input/Output \hideinitializer */
+#define PE1             GPIO_PIN_DATA(4, 1 ) /*!< Specify PE.1 Pin Data Input/Output \hideinitializer */
+#define PE2             GPIO_PIN_DATA(4, 2 ) /*!< Specify PE.2 Pin Data Input/Output \hideinitializer */
+#define PE3             GPIO_PIN_DATA(4, 3 ) /*!< Specify PE.3 Pin Data Input/Output \hideinitializer */
+#define PE4             GPIO_PIN_DATA(4, 4 ) /*!< Specify PE.4 Pin Data Input/Output \hideinitializer */
+#define PE5             GPIO_PIN_DATA(4, 5 ) /*!< Specify PE.5 Pin Data Input/Output \hideinitializer */
+#define PE6             GPIO_PIN_DATA(4, 6 ) /*!< Specify PE.6 Pin Data Input/Output \hideinitializer */
+#define PE7             GPIO_PIN_DATA(4, 7 ) /*!< Specify PE.7 Pin Data Input/Output \hideinitializer */
+#define PE8             GPIO_PIN_DATA(4, 8 ) /*!< Specify PE.8 Pin Data Input/Output \hideinitializer */
+#define PE9             GPIO_PIN_DATA(4, 9 ) /*!< Specify PE.9 Pin Data Input/Output \hideinitializer */
+#define PE10            GPIO_PIN_DATA(4, 10) /*!< Specify PE.10 Pin Data Input/Output \hideinitializer */
+#define PE11            GPIO_PIN_DATA(4, 11) /*!< Specify PE.11 Pin Data Input/Output \hideinitializer */
+#define PE12            GPIO_PIN_DATA(4, 12) /*!< Specify PE.12 Pin Data Input/Output \hideinitializer */
+#define PE13            GPIO_PIN_DATA(4, 13) /*!< Specify PE.13 Pin Data Input/Output \hideinitializer */
+#define PE14            GPIO_PIN_DATA(4, 14) /*!< Specify PE.14 Pin Data Input/Output \hideinitializer */
+#define PE15            GPIO_PIN_DATA(4, 15) /*!< Specify PE.15 Pin Data Input/Output \hideinitializer */
+#define PF0             GPIO_PIN_DATA(5, 0 ) /*!< Specify PF.0 Pin Data Input/Output \hideinitializer */
+#define PF1             GPIO_PIN_DATA(5, 1 ) /*!< Specify PF.1 Pin Data Input/Output \hideinitializer */
+#define PF2             GPIO_PIN_DATA(5, 2 ) /*!< Specify PF.2 Pin Data Input/Output \hideinitializer */
+#define PF3             GPIO_PIN_DATA(5, 3 ) /*!< Specify PF.3 Pin Data Input/Output \hideinitializer */
+#define PF4             GPIO_PIN_DATA(5, 4 ) /*!< Specify PF.4 Pin Data Input/Output \hideinitializer */
+#define PF5             GPIO_PIN_DATA(5, 5 ) /*!< Specify PF.5 Pin Data Input/Output \hideinitializer */
+#define PF6             GPIO_PIN_DATA(5, 6 ) /*!< Specify PF.6 Pin Data Input/Output \hideinitializer */
+#define PF7             GPIO_PIN_DATA(5, 7 ) /*!< Specify PF.7 Pin Data Input/Output \hideinitializer */
+#define PF8             GPIO_PIN_DATA(5, 8 ) /*!< Specify PF.8 Pin Data Input/Output \hideinitializer */
+#define PF9             GPIO_PIN_DATA(5, 9 ) /*!< Specify PF.9 Pin Data Input/Output \hideinitializer */
+#define PF10            GPIO_PIN_DATA(5, 10) /*!< Specify PF.10 Pin Data Input/Output \hideinitializer */
+#define PF11            GPIO_PIN_DATA(5, 11) /*!< Specify PF.11 Pin Data Input/Output \hideinitializer */
+#define PG0             GPIO_PIN_DATA(6, 0 ) /*!< Specify PG.0 Pin Data Input/Output \hideinitializer */
+#define PG1             GPIO_PIN_DATA(6, 1 ) /*!< Specify PG.1 Pin Data Input/Output \hideinitializer */
+#define PG2             GPIO_PIN_DATA(6, 2 ) /*!< Specify PG.2 Pin Data Input/Output \hideinitializer */
+#define PG3             GPIO_PIN_DATA(6, 3 ) /*!< Specify PG.3 Pin Data Input/Output \hideinitializer */
+#define PG4             GPIO_PIN_DATA(6, 4 ) /*!< Specify PG.4 Pin Data Input/Output \hideinitializer */
+#define PG5             GPIO_PIN_DATA(6, 5 ) /*!< Specify PG.5 Pin Data Input/Output \hideinitializer */
+#define PG6             GPIO_PIN_DATA(6, 6 ) /*!< Specify PG.6 Pin Data Input/Output \hideinitializer */
+#define PG7             GPIO_PIN_DATA(6, 7 ) /*!< Specify PG.7 Pin Data Input/Output \hideinitializer */
+#define PG8             GPIO_PIN_DATA(6, 8 ) /*!< Specify PG.8 Pin Data Input/Output \hideinitializer */
+#define PG9             GPIO_PIN_DATA(6, 9 ) /*!< Specify PG.9 Pin Data Input/Output \hideinitializer */
+#define PG10            GPIO_PIN_DATA(6, 10) /*!< Specify PG.10 Pin Data Input/Output \hideinitializer */
+#define PG11            GPIO_PIN_DATA(6, 11) /*!< Specify PG.11 Pin Data Input/Output \hideinitializer */
+#define PG12            GPIO_PIN_DATA(6, 12) /*!< Specify PG.12 Pin Data Input/Output \hideinitializer */
+#define PG13            GPIO_PIN_DATA(6, 13) /*!< Specify PG.13 Pin Data Input/Output \hideinitializer */
+#define PG14            GPIO_PIN_DATA(6, 14) /*!< Specify PG.14 Pin Data Input/Output \hideinitializer */
+#define PG15            GPIO_PIN_DATA(6, 15) /*!< Specify PG.15 Pin Data Input/Output \hideinitializer */
+#define PH0             GPIO_PIN_DATA(7, 0 ) /*!< Specify PH.0 Pin Data Input/Output \hideinitializer */
+#define PH1             GPIO_PIN_DATA(7, 1 ) /*!< Specify PH.1 Pin Data Input/Output \hideinitializer */
+#define PH2             GPIO_PIN_DATA(7, 2 ) /*!< Specify PH.2 Pin Data Input/Output \hideinitializer */
+#define PH3             GPIO_PIN_DATA(7, 3 ) /*!< Specify PH.3 Pin Data Input/Output \hideinitializer */
+#define PH4             GPIO_PIN_DATA(7, 4 ) /*!< Specify PH.4 Pin Data Input/Output \hideinitializer */
+#define PH5             GPIO_PIN_DATA(7, 5 ) /*!< Specify PH.5 Pin Data Input/Output \hideinitializer */
+#define PH6             GPIO_PIN_DATA(7, 6 ) /*!< Specify PH.6 Pin Data Input/Output \hideinitializer */
+#define PH7             GPIO_PIN_DATA(7, 7 ) /*!< Specify PH.7 Pin Data Input/Output \hideinitializer */
+#define PH8             GPIO_PIN_DATA(7, 8 ) /*!< Specify PH.8 Pin Data Input/Output \hideinitializer */
+#define PH9             GPIO_PIN_DATA(7, 9 ) /*!< Specify PH.9 Pin Data Input/Output \hideinitializer */
+#define PH10            GPIO_PIN_DATA(7, 10) /*!< Specify PH.10 Pin Data Input/Output \hideinitializer */
+#define PH11            GPIO_PIN_DATA(7, 11) /*!< Specify PH.11 Pin Data Input/Output \hideinitializer */
+
+
+/*@}*/ /* end of group GPIO_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup GPIO_EXPORTED_FUNCTIONS GPIO Exported Functions
+  @{
+*/
+
+/**
+ * @brief       Clear GPIO Pin Interrupt Flag
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ *
+ * @return      None
+ *
+ * @details     Clear the interrupt status of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_CLR_INT_FLAG(port, u32PinMask)         ((port)->INTSRC = (u32PinMask))
+
+/**
+ * @brief       Disable Pin De-bounce Function
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ *
+ * @return      None
+ *
+ * @details     Disable the interrupt de-bounce function of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_DISABLE_DEBOUNCE(port, u32PinMask)     ((port)->DBEN &= ~(u32PinMask))
+
+/**
+ * @brief       Enable Pin De-bounce Function
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ * @return      None
+ *
+ * @details     Enable the interrupt de-bounce function of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_ENABLE_DEBOUNCE(port, u32PinMask)      ((port)->DBEN |= (u32PinMask))
+
+/**
+ * @brief       Disable I/O Digital Input Path
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ *
+ * @return      None
+ *
+ * @details     Disable I/O digital input path of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_DISABLE_DIGITAL_PATH(port, u32PinMask) ((port)->DINOFF |= ((u32PinMask)<<16))
+
+/**
+ * @brief       Enable I/O Digital Input Path
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ *
+ * @return      None
+ *
+ * @details     Enable I/O digital input path of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_ENABLE_DIGITAL_PATH(port, u32PinMask)  ((port)->DINOFF &= ~((u32PinMask)<<16))
+
+/**
+ * @brief       Disable I/O DOUT mask
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ *
+ * @return      None
+ *
+ * @details     Disable I/O DOUT mask of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_DISABLE_DOUT_MASK(port, u32PinMask)    ((port)->DATMSK &= ~(u32PinMask))
+
+/**
+ * @brief       Enable I/O DOUT mask
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ *
+ * @return      None
+ *
+ * @details     Enable I/O DOUT mask of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_ENABLE_DOUT_MASK(port, u32PinMask) ((port)->DATMSK |= (u32PinMask))
+
+/**
+ * @brief       Get GPIO Pin Interrupt Flag
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
+ *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be BIT0 ~ BIT13 for PE GPIO port.
+ *                          It could be BIT0 ~ BIT11 for PG GPIO port.
+ *
+ * @retval      0           No interrupt at specified GPIO pin
+ * @retval      1           The specified GPIO pin generate an interrupt
+ *
+ * @details     Get the interrupt status of specified GPIO pin.
+ * \hideinitializer
+ */
+#define GPIO_GET_INT_FLAG(port, u32PinMask)     ((port)->INTSRC & (u32PinMask))
+
+/**
+ * @brief       Set De-bounce Sampling Cycle Time
+ *
+ * @param[in]   u32ClkSrc   The de-bounce counter clock source. It could be GPIO_DBCTL_DBCLKSRC_HCLK or GPIO_DBCTL_DBCLKSRC_LIRC.
+ * @param[in]   u32ClkSel   The de-bounce sampling cycle selection. It could be
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_1
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_2
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_4
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_8
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_16
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_32
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_64
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_128
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_256
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_512
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_1024
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_2048
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_4096
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_8192
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_16384
+ *                            - \ref GPIO_DBCTL_DBCLKSEL_32768
+ *
+ * @return      None
+ *
+ * @details     Set the interrupt de-bounce sampling cycle time based on the debounce counter clock source. \n
+ *              Example: _GPIO_SET_DEBOUNCE_TIME(GPIO_DBCTL_DBCLKSRC_LIRC, GPIO_DBCTL_DBCLKSEL_4). \n
+ *              It's meaning the De-debounce counter clock source is internal 10 KHz and sampling cycle selection is 4. \n
+ *              Then the target de-bounce sampling cycle time is (4)*(1/(10*1000)) s = 4*0.0001 s = 400 us,
+ *              and system will sampling interrupt input once per 00 us.
+ * \hideinitializer
+ */
+#define GPIO_SET_DEBOUNCE_TIME(u32ClkSrc, u32ClkSel)    (GPIO->DBCTL = (GPIO_DBCTL_ICLKON_Msk | (u32ClkSrc) | (u32ClkSel)))
+
+/**
+ * @brief       Get GPIO Port IN Data
+ *
+* @param[in]    port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ *
+ * @return      The specified port data
+ *
+ * @details     Get the PIN register of specified GPIO port.
+ * \hideinitializer
+ */
+#define GPIO_GET_IN_DATA(port)  ((port)->PIN)
+
+/**
+ * @brief       Set GPIO Port OUT Data
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32Data     GPIO port data.
+ *
+ * @return      None
+ *
+ * @details     Set the Data into specified GPIO port.
+ * \hideinitializer
+ */
+#define GPIO_SET_OUT_DATA(port, u32Data)    ((port)->DOUT = (u32Data))
+
+/**
+ * @brief       Toggle Specified GPIO pin
+ *
+ * @param[in]   u32Pin      Pxy
+ *
+ * @return      None
+ *
+ * @details     Toggle the specified GPIO pint.
+ * \hideinitializer
+ */
+#define GPIO_TOGGLE(u32Pin) ((u32Pin) ^= 1)
+
+
+/**
+ * @brief       Enable External GPIO interrupt
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32Pin      The pin of specified GPIO port.
+ *                          It could be 0 ~ 15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be 0 ~ 13 for PE GPIO port.
+ *                          It could be 0 ~ 11 for PG GPIO port.
+ * @param[in]   u32IntAttribs   The interrupt attribute of specified GPIO pin. It could be \n
+ *                              GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.
+ *
+ * @return      None
+ *
+ * @details     This function is used to enable specified GPIO pin interrupt.
+ * \hideinitializer
+ */
+#define GPIO_EnableEINT     GPIO_EnableInt
+
+/**
+ * @brief       Disable External GPIO interrupt
+ *
+ * @param[in]   port        GPIO port. It could be It could be PA, PB, PC, PD, PE, PF, PG or PH.
+ * @param[in]   u32Pin      The pin of specified GPIO port.
+ *                          It could be 0 ~ 15 for PA, PB, PC, PD, PF and PH GPIO port.
+ *                          It could be 0 ~ 13 for PE GPIO port.
+ *                          It could be 0 ~ 11 for PG GPIO port.
+ *
+ * @return      None
+ *
+ * @details     This function is used to enable specified GPIO pin interrupt.
+ * \hideinitializer
+ */
+#define GPIO_DisableEINT    GPIO_DisableInt
+
+
+void GPIO_SetMode(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode);
+void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs);
+void GPIO_DisableInt(GPIO_T *port, uint32_t u32Pin);
+void GPIO_SetSlewCtl(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode);
+void GPIO_SetPullCtl(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode);
+
+
+/*@}*/ /* end of group GPIO_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group GPIO_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __GPIO_H__ */

+ 541 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_i2c.h

@@ -0,0 +1,541 @@
+/****************************************************************************//**
+ * @file     i2c.h
+ * @version  V1.00
+ * @brief    NUC980 series I2C driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+#ifndef __NU_I2C_H__
+#define __NU_I2C_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "nuc980.h"
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup I2C_Driver I2C Driver
+  @{
+*/
+
+/** @addtogroup I2C_EXPORTED_CONSTANTS I2C Exported Constants
+  @{
+*/
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  I2C_CTL constant definitions.                                                                            */
+/*---------------------------------------------------------------------------------------------------------*/
+#define I2C_CTL_STA_SI            0x28UL /*!< I2C_CTL setting for I2C control bits. It would set STA and SI bits          \hideinitializer */
+#define I2C_CTL_STA_SI_AA         0x2CUL /*!< I2C_CTL setting for I2C control bits. It would set STA, SI and AA bits      \hideinitializer */
+#define I2C_CTL_STO_SI            0x18UL /*!< I2C_CTL setting for I2C control bits. It would set STO and SI bits          \hideinitializer */
+#define I2C_CTL_STO_SI_AA         0x1CUL /*!< I2C_CTL setting for I2C control bits. It would set STO, SI and AA bits      \hideinitializer */
+#define I2C_CTL_SI                0x08UL /*!< I2C_CTL setting for I2C control bits. It would set SI bit                   \hideinitializer */
+#define I2C_CTL_SI_AA             0x0CUL /*!< I2C_CTL setting for I2C control bits. It would set SI and AA bits           \hideinitializer */
+#define I2C_CTL_STA               0x20UL /*!< I2C_CTL setting for I2C control bits. It would set STA bit                  \hideinitializer */
+#define I2C_CTL_STO               0x10UL /*!< I2C_CTL setting for I2C control bits. It would set STO bit                  \hideinitializer */
+#define I2C_CTL_AA                0x04UL /*!< I2C_CTL setting for I2C control bits. It would set AA bit                   \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  I2C GCMode constant definitions.                                                                       */
+/*---------------------------------------------------------------------------------------------------------*/
+#define I2C_GCMODE_ENABLE           1    /*!< Enable  I2C GC Mode                                                         \hideinitializer */
+#define I2C_GCMODE_DISABLE          0    /*!< Disable I2C GC Mode                                                         \hideinitializer */
+
+/*@}*/ /* end of group I2C_EXPORTED_CONSTANTS */
+
+typedef struct
+{
+    volatile uint32_t CTL0;                  /*!< [0x0000] I2C Control Register 0                                           */
+    volatile uint32_t ADDR0;                 /*!< [0x0004] I2C Slave Address Register0                                      */
+    volatile uint32_t DAT;                   /*!< [0x0008] I2C Data Register                                                */
+    volatile uint32_t STATUS0;               /*!< [0x000c] I2C Status Register 0                                            */
+    volatile uint32_t CLKDIV;                /*!< [0x0010] I2C Clock Divided Register                                       */
+    volatile uint32_t TOCTL;                 /*!< [0x0014] I2C Time-out Control Register                                    */
+    volatile uint32_t ADDR1;                 /*!< [0x0018] I2C Slave Address Register1                                      */
+    volatile uint32_t ADDR2;                 /*!< [0x001c] I2C Slave Address Register2                                      */
+    volatile uint32_t ADDR3;                 /*!< [0x0020] I2C Slave Address Register3                                      */
+    volatile uint32_t ADDRMSK0;              /*!< [0x0024] I2C Slave Address Mask Register0                                 */
+    volatile uint32_t ADDRMSK1;              /*!< [0x0028] I2C Slave Address Mask Register1                                 */
+    volatile uint32_t ADDRMSK2;              /*!< [0x002c] I2C Slave Address Mask Register2                                 */
+    volatile uint32_t ADDRMSK3;              /*!< [0x0030] I2C Slave Address Mask Register3                                 */
+    volatile uint32_t RESERVE0[2];
+    volatile uint32_t WKCTL;                 /*!< [0x003c] I2C Wake-up Control Register                                     */
+    volatile uint32_t WKSTS;                 /*!< [0x0040] I2C Wake-up Status Register                                      */
+    volatile uint32_t CTL1;                  /*!< [0x0044] I2C Control Register 1                                           */
+    volatile uint32_t STATUS1;               /*!< [0x0048] I2C Status Register 1                                            */
+    volatile uint32_t TMCTL;                 /*!< [0x004c] I2C Timing Configure Control Register                            */
+    volatile uint32_t BUSCTL;                /*!< [0x0050] I2C Bus Management Control Register                              */
+    volatile uint32_t BUSTCTL;               /*!< [0x0054] I2C Bus Management Timer Control Register                        */
+    volatile uint32_t BUSSTS;                /*!< [0x0058] I2C Bus Management Status Register                               */
+    volatile uint32_t PKTSIZE;               /*!< [0x005c] I2C Packet Error Checking Byte Number Register                   */
+    volatile uint32_t PKTCRC;                /*!< [0x0060] I2C Packet Error Checking Byte Value Register                    */
+    volatile uint32_t BUSTOUT;               /*!< [0x0064] I2C Bus Management Timer Register                                */
+    volatile uint32_t CLKTOUT;               /*!< [0x0068] I2C Bus Management Clock Low Timer Register                      */
+
+} I2C_T;
+
+#define I2C_CTL0_AA_Pos                  (2)                                               /*!< I2C_T::CTL: AA Position                */
+#define I2C_CTL0_AA_Msk                  (0x1ul << I2C_CTL0_AA_Pos)                        /*!< I2C_T::CTL: AA Mask                    */
+
+#define I2C_CTL0_SI_Pos                  (3)                                               /*!< I2C_T::CTL: SI Position                */
+#define I2C_CTL0_SI_Msk                  (0x1ul << I2C_CTL0_SI_Pos)                        /*!< I2C_T::CTL: SI Mask                    */
+
+#define I2C_CTL0_STO_Pos                 (4)                                               /*!< I2C_T::CTL: STO Position               */
+#define I2C_CTL0_STO_Msk                 (0x1ul << I2C_CTL0_STO_Pos)                       /*!< I2C_T::CTL: STO Mask                   */
+
+#define I2C_CTL0_STA_Pos                 (5)                                               /*!< I2C_T::CTL: STA Position               */
+#define I2C_CTL0_STA_Msk                 (0x1ul << I2C_CTL0_STA_Pos)                       /*!< I2C_T::CTL: STA Mask                   */
+
+#define I2C_CTL0_I2CEN_Pos               (6)                                               /*!< I2C_T::CTL: I2CEN Position             */
+#define I2C_CTL0_I2CEN_Msk               (0x1ul << I2C_CTL0_I2CEN_Pos)                     /*!< I2C_T::CTL: I2CEN Mask                 */
+
+#define I2C_CTL0_INTEN_Pos               (7)                                               /*!< I2C_T::CTL: INTEN Position             */
+#define I2C_CTL0_INTEN_Msk               (0x1ul << I2C_CTL0_INTEN_Pos)                     /*!< I2C_T::CTL: INTEN Mask                 */
+
+#define I2C_ADDR0_GC_Pos                 (0)                                               /*!< I2C_T::ADDR0: GC Position              */
+#define I2C_ADDR0_GC_Msk                 (0x1ul << I2C_ADDR0_GC_Pos)                       /*!< I2C_T::ADDR0: GC Mask                  */
+
+#define I2C_ADDR0_ADDR_Pos               (1)                                               /*!< I2C_T::ADDR0: ADDR Position            */
+#define I2C_ADDR0_ADDR_Msk               (0x3fful << I2C_ADDR0_ADDR_Pos)                   /*!< I2C_T::ADDR0: ADDR Mask                */
+
+#define I2C_DAT_DAT_Pos                  (0)                                               /*!< I2C_T::DAT: DAT Position               */
+#define I2C_DAT_DAT_Msk                  (0xfful << I2C_DAT_DAT_Pos)                       /*!< I2C_T::DAT: DAT Mask                   */
+
+#define I2C_STATUS0_STATUS_Pos           (0)                                               /*!< I2C_T::STATUS: STATUS Position         */
+#define I2C_STATUS0_STATUS_Msk           (0xfful << I2C_STATUS_STATUS0_Pos)                /*!< I2C_T::STATUS: STATUS Mask             */
+
+#define I2C_CLKDIV_DIVIDER_Pos           (0)                                               /*!< I2C_T::CLKDIV: DIVIDER Position        */
+#define I2C_CLKDIV_DIVIDER_Msk           (0x3fful << I2C_CLKDIV_DIVIDER_Pos)               /*!< I2C_T::CLKDIV: DIVIDER Mask            */
+
+#define I2C_TOCTL_TOIF_Pos               (0)                                               /*!< I2C_T::TOCTL: TOIF Position            */
+#define I2C_TOCTL_TOIF_Msk               (0x1ul << I2C_TOCTL_TOIF_Pos)                     /*!< I2C_T::TOCTL: TOIF Mask                */
+
+#define I2C_TOCTL_TOCDIV4_Pos            (1)                                               /*!< I2C_T::TOCTL: TOCDIV4 Position         */
+#define I2C_TOCTL_TOCDIV4_Msk            (0x1ul << I2C_TOCTL_TOCDIV4_Pos)                  /*!< I2C_T::TOCTL: TOCDIV4 Mask             */
+
+#define I2C_TOCTL_TOCEN_Pos              (2)                                               /*!< I2C_T::TOCTL: TOCEN Position           */
+#define I2C_TOCTL_TOCEN_Msk              (0x1ul << I2C_TOCTL_TOCEN_Pos)                    /*!< I2C_T::TOCTL: TOCEN Mask               */
+
+#define I2C_ADDR1_GC_Pos                 (0)                                               /*!< I2C_T::ADDR1: GC Position              */
+#define I2C_ADDR1_GC_Msk                 (0x1ul << I2C_ADDR1_GC_Pos)                       /*!< I2C_T::ADDR1: GC Mask                  */
+
+#define I2C_ADDR1_ADDR_Pos               (1)                                               /*!< I2C_T::ADDR1: ADDR Position            */
+#define I2C_ADDR1_ADDR_Msk               (0x3fful << I2C_ADDR1_ADDR_Pos)                   /*!< I2C_T::ADDR1: ADDR Mask                */
+
+#define I2C_ADDR2_GC_Pos                 (0)                                               /*!< I2C_T::ADDR2: GC Position              */
+#define I2C_ADDR2_GC_Msk                 (0x1ul << I2C_ADDR2_GC_Pos)                       /*!< I2C_T::ADDR2: GC Mask                  */
+
+#define I2C_ADDR2_ADDR_Pos               (1)                                               /*!< I2C_T::ADDR2: ADDR Position            */
+#define I2C_ADDR2_ADDR_Msk               (0x3fful << I2C_ADDR2_ADDR_Pos)                   /*!< I2C_T::ADDR2: ADDR Mask                */
+
+#define I2C_ADDR3_GC_Pos                 (0)                                               /*!< I2C_T::ADDR3: GC Position              */
+#define I2C_ADDR3_GC_Msk                 (0x1ul << I2C_ADDR3_GC_Pos)                       /*!< I2C_T::ADDR3: GC Mask                  */
+
+#define I2C_ADDR3_ADDR_Pos               (1)                                               /*!< I2C_T::ADDR3: ADDR Position            */
+#define I2C_ADDR3_ADDR_Msk               (0x3fful << I2C_ADDR3_ADDR_Pos)                   /*!< I2C_T::ADDR3: ADDR Mask                */
+
+#define I2C_ADDRMSK0_ADDRMSK_Pos         (1)                                               /*!< I2C_T::ADDRMSK0: ADDRMSK Position      */
+#define I2C_ADDRMSK0_ADDRMSK_Msk         (0x3fful << I2C_ADDRMSK0_ADDRMSK_Pos)             /*!< I2C_T::ADDRMSK0: ADDRMSK Mask          */
+
+#define I2C_ADDRMSK1_ADDRMSK_Pos         (1)                                               /*!< I2C_T::ADDRMSK1: ADDRMSK Position      */
+#define I2C_ADDRMSK1_ADDRMSK_Msk         (0x3fful << I2C_ADDRMSK1_ADDRMSK_Pos)             /*!< I2C_T::ADDRMSK1: ADDRMSK Mask          */
+
+#define I2C_ADDRMSK2_ADDRMSK_Pos         (1)                                               /*!< I2C_T::ADDRMSK2: ADDRMSK Position      */
+#define I2C_ADDRMSK2_ADDRMSK_Msk         (0x3fful << I2C_ADDRMSK2_ADDRMSK_Pos)             /*!< I2C_T::ADDRMSK2: ADDRMSK Mask          */
+
+#define I2C_ADDRMSK3_ADDRMSK_Pos         (1)                                               /*!< I2C_T::ADDRMSK3: ADDRMSK Position      */
+#define I2C_ADDRMSK3_ADDRMSK_Msk         (0x3fful << I2C_ADDRMSK3_ADDRMSK_Pos)             /*!< I2C_T::ADDRMSK3: ADDRMSK Mask          */
+
+#define I2C_WKCTL_WKEN_Pos               (0)                                               /*!< I2C_T::WKCTL: WKEN Position            */
+#define I2C_WKCTL_WKEN_Msk               (0x1ul << I2C_WKCTL_WKEN_Pos)                     /*!< I2C_T::WKCTL: WKEN Mask                */
+
+#define I2C_WKCTL_NHDBUSEN_Pos           (7)                                               /*!< I2C_T::WKCTL: NHDBUSEN Position        */
+#define I2C_WKCTL_NHDBUSEN_Msk           (0x1ul << I2C_WKCTL_NHDBUSEN_Pos)                 /*!< I2C_T::WKCTL: NHDBUSEN Mask            */
+
+#define I2C_WKSTS_WKIF_Pos               (0)                                               /*!< I2C_T::WKSTS: WKIF Position            */
+#define I2C_WKSTS_WKIF_Msk               (0x1ul << I2C_WKSTS_WKIF_Pos)                     /*!< I2C_T::WKSTS: WKIF Mask                */
+
+#define I2C_WKSTS_WKAKDONE_Pos           (1)                                               /*!< I2C_T::WKSTS: WKAKDONE Position        */
+#define I2C_WKSTS_WKAKDONE_Msk           (0x1ul << I2C_WKSTS_WKAKDONE_Pos)                 /*!< I2C_T::WKSTS: WKAKDONE Mask            */
+
+#define I2C_WKSTS_WRSTSWK_Pos            (2)                                               /*!< I2C_T::WKSTS: WRSTSWK Position         */
+#define I2C_WKSTS_WRSTSWK_Msk            (0x1ul << I2C_WKSTS_WRSTSWK_Pos)                  /*!< I2C_T::WKSTS: WRSTSWK Mask             */
+
+#define I2C_CTL1_TXPDMAEN_Pos            (0)                                               /*!< I2C_T::CTL1: TXPDMAEN Position         */
+#define I2C_CTL1_TXPDMAEN_Msk            (0x1ul << I2C_CTL1_TXPDMAEN_Pos)                  /*!< I2C_T::CTL1: TXPDMAEN Mask             */
+
+#define I2C_CTL1_RXPDMAEN_Pos            (1)                                               /*!< I2C_T::CTL1: RXPDMAEN Position         */
+#define I2C_CTL1_RXPDMAEN_Msk            (0x1ul << I2C_CTL1_RXPDMAEN_Pos)                  /*!< I2C_T::CTL1: RXPDMAEN Mask             */
+
+#define I2C_CTL1_PDMARST_Pos             (2)                                               /*!< I2C_T::CTL1: PDMARST Position          */
+#define I2C_CTL1_PDMARST_Msk             (0x1ul << I2C_CTL1_PDMARST_Pos)                   /*!< I2C_T::CTL1: PDMARST Mask              */
+
+#define I2C_CTL1_PDMASTR_Pos             (8)                                               /*!< I2C_T::CTL1: PDMASTR Position          */
+#define I2C_CTL1_PDMASTR_Msk             (0x1ul << I2C_CTL1_PDMASTR_Pos)                   /*!< I2C_T::CTL1: PDMASTR Mask              */
+
+#define I2C_CTL1_ADDR10EN_Pos            (9)                                               /*!< I2C_T::CTL1: ADDR10EN Position         */
+#define I2C_CTL1_ADDR10EN_Msk            (0x1ul << I2C_CTL1_ADDR10EN_Pos)                  /*!< I2C_T::CTL1: ADDR10EN Mask             */
+
+#define I2C_STATUS1_ADMAT0_Pos           (0)                                               /*!< I2C_T::STATUS1: ADMAT0 Position        */
+#define I2C_STATUS1_ADMAT0_Msk           (0x1ul << I2C_STATUS1_ADMAT0_Pos)                 /*!< I2C_T::STATUS1: ADMAT0 Mask            */
+
+#define I2C_STATUS1_ADMAT1_Pos           (1)                                               /*!< I2C_T::STATUS1: ADMAT1 Position        */
+#define I2C_STATUS1_ADMAT1_Msk           (0x1ul << I2C_STATUS1_ADMAT1_Pos)                 /*!< I2C_T::STATUS1: ADMAT1 Mask            */
+
+#define I2C_STATUS1_ADMAT2_Pos           (2)                                               /*!< I2C_T::STATUS1: ADMAT2 Position        */
+#define I2C_STATUS1_ADMAT2_Msk           (0x1ul << I2C_STATUS1_ADMAT2_Pos)                 /*!< I2C_T::STATUS1: ADMAT2 Mask            */
+
+#define I2C_STATUS1_ADMAT3_Pos           (3)                                               /*!< I2C_T::STATUS1: ADMAT3 Position        */
+#define I2C_STATUS1_ADMAT3_Msk           (0x1ul << I2C_STATUS1_ADMAT3_Pos)                 /*!< I2C_T::STATUS1: ADMAT3 Mask            */
+
+#define I2C_STATUS1_ONBUSY_Pos           (8)                                               /*!< I2C_T::STATUS1: ONBUSY Position        */
+#define I2C_STATUS1_ONBUSY_Msk           (0x1ul << I2C_STATUS1_ONBUSY_Pos)                 /*!< I2C_T::STATUS1: ONBUSY Mask            */
+
+#define I2C_TMCTL_STCTL_Pos              (0)                                               /*!< I2C_T::TMCTL: STCTL Position           */
+#define I2C_TMCTL_STCTL_Msk              (0x1fful << I2C_TMCTL_STCTL_Pos)                  /*!< I2C_T::TMCTL: STCTL Mask               */
+
+#define I2C_TMCTL_HTCTL_Pos              (16)                                              /*!< I2C_T::TMCTL: HTCTL Position           */
+#define I2C_TMCTL_HTCTL_Msk              (0x1fful << I2C_TMCTL_HTCTL_Pos)                  /*!< I2C_T::TMCTL: HTCTL Mask               */
+
+#define I2C_BUSCTL_ACKMEN_Pos            (0)                                               /*!< I2C_T::BUSCTL: ACKMEN Position         */
+#define I2C_BUSCTL_ACKMEN_Msk            (0x1ul << I2C_BUSCTL_ACKMEN_Pos)                  /*!< I2C_T::BUSCTL: ACKMEN Mask             */
+
+#define I2C_BUSCTL_PECEN_Pos             (1)                                               /*!< I2C_T::BUSCTL: PECEN Position          */
+#define I2C_BUSCTL_PECEN_Msk             (0x1ul << I2C_BUSCTL_PECEN_Pos)                   /*!< I2C_T::BUSCTL: PECEN Mask              */
+
+#define I2C_BUSCTL_BMDEN_Pos             (2)                                               /*!< I2C_T::BUSCTL: BMDEN Position          */
+#define I2C_BUSCTL_BMDEN_Msk             (0x1ul << I2C_BUSCTL_BMDEN_Pos)                   /*!< I2C_T::BUSCTL: BMDEN Mask              */
+
+#define I2C_BUSCTL_BMHEN_Pos             (3)                                               /*!< I2C_T::BUSCTL: BMHEN Position          */
+#define I2C_BUSCTL_BMHEN_Msk             (0x1ul << I2C_BUSCTL_BMHEN_Pos)                   /*!< I2C_T::BUSCTL: BMHEN Mask              */
+
+#define I2C_BUSCTL_ALERTEN_Pos           (4)                                               /*!< I2C_T::BUSCTL: ALERTEN Position        */
+#define I2C_BUSCTL_ALERTEN_Msk           (0x1ul << I2C_BUSCTL_ALERTEN_Pos)                 /*!< I2C_T::BUSCTL: ALERTEN Mask            */
+
+#define I2C_BUSCTL_SCTLOSTS_Pos          (5)                                               /*!< I2C_T::BUSCTL: SCTLOSTS Position       */
+#define I2C_BUSCTL_SCTLOSTS_Msk          (0x1ul << I2C_BUSCTL_SCTLOSTS_Pos)                /*!< I2C_T::BUSCTL: SCTLOSTS Mask           */
+
+#define I2C_BUSCTL_SCTLOEN_Pos           (6)                                               /*!< I2C_T::BUSCTL: SCTLOEN Position        */
+#define I2C_BUSCTL_SCTLOEN_Msk           (0x1ul << I2C_BUSCTL_SCTLOEN_Pos)                 /*!< I2C_T::BUSCTL: SCTLOEN Mask            */
+
+#define I2C_BUSCTL_BUSEN_Pos             (7)                                               /*!< I2C_T::BUSCTL: BUSEN Position          */
+#define I2C_BUSCTL_BUSEN_Msk             (0x1ul << I2C_BUSCTL_BUSEN_Pos)                   /*!< I2C_T::BUSCTL: BUSEN Mask              */
+
+#define I2C_BUSCTL_PECTXEN_Pos           (8)                                               /*!< I2C_T::BUSCTL: PECTXEN Position        */
+#define I2C_BUSCTL_PECTXEN_Msk           (0x1ul << I2C_BUSCTL_PECTXEN_Pos)                 /*!< I2C_T::BUSCTL: PECTXEN Mask            */
+
+#define I2C_BUSCTL_TIDLE_Pos             (9)                                               /*!< I2C_T::BUSCTL: TIDLE Position          */
+#define I2C_BUSCTL_TIDLE_Msk             (0x1ul << I2C_BUSCTL_TIDLE_Pos)                   /*!< I2C_T::BUSCTL: TIDLE Mask              */
+
+#define I2C_BUSCTL_PECCLR_Pos            (10)                                              /*!< I2C_T::BUSCTL: PECCLR Position         */
+#define I2C_BUSCTL_PECCLR_Msk            (0x1ul << I2C_BUSCTL_PECCLR_Pos)                  /*!< I2C_T::BUSCTL: PECCLR Mask             */
+
+#define I2C_BUSCTL_ACKM9SI_Pos           (11)                                              /*!< I2C_T::BUSCTL: ACKM9SI Position        */
+#define I2C_BUSCTL_ACKM9SI_Msk           (0x1ul << I2C_BUSCTL_ACKM9SI_Pos)                 /*!< I2C_T::BUSCTL: ACKM9SI Mask            */
+
+#define I2C_BUSCTL_BCDIEN_Pos            (12)                                              /*!< I2C_T::BUSCTL: BCDIEN Position         */
+#define I2C_BUSCTL_BCDIEN_Msk            (0x1ul << I2C_BUSCTL_BCDIEN_Pos)                  /*!< I2C_T::BUSCTL: BCDIEN Mask             */
+
+#define I2C_BUSCTL_PECDIEN_Pos           (13)                                              /*!< I2C_T::BUSCTL: PECDIEN Position        */
+#define I2C_BUSCTL_PECDIEN_Msk           (0x1ul << I2C_BUSCTL_PECDIEN_Pos)                 /*!< I2C_T::BUSCTL: PECDIEN Mask            */
+
+#define I2C_BUSTCTL_BUSTOEN_Pos          (0)                                               /*!< I2C_T::BUSTCTL: BUSTOEN Position       */
+#define I2C_BUSTCTL_BUSTOEN_Msk          (0x1ul << I2C_BUSTCTL_BUSTOEN_Pos)                /*!< I2C_T::BUSTCTL: BUSTOEN Mask           */
+
+#define I2C_BUSTCTL_CLKTOEN_Pos          (1)                                               /*!< I2C_T::BUSTCTL: CLKTOEN Position       */
+#define I2C_BUSTCTL_CLKTOEN_Msk          (0x1ul << I2C_BUSTCTL_CLKTOEN_Pos)                /*!< I2C_T::BUSTCTL: CLKTOEN Mask           */
+
+#define I2C_BUSTCTL_BUSTOIEN_Pos         (2)                                               /*!< I2C_T::BUSTCTL: BUSTOIEN Position      */
+#define I2C_BUSTCTL_BUSTOIEN_Msk         (0x1ul << I2C_BUSTCTL_BUSTOIEN_Pos)               /*!< I2C_T::BUSTCTL: BUSTOIEN Mask          */
+
+#define I2C_BUSTCTL_CLKTOIEN_Pos         (3)                                               /*!< I2C_T::BUSTCTL: CLKTOIEN Position      */
+#define I2C_BUSTCTL_CLKTOIEN_Msk         (0x1ul << I2C_BUSTCTL_CLKTOIEN_Pos)               /*!< I2C_T::BUSTCTL: CLKTOIEN Mask          */
+
+#define I2C_BUSTCTL_TORSTEN_Pos          (4)                                               /*!< I2C_T::BUSTCTL: TORSTEN Position       */
+#define I2C_BUSTCTL_TORSTEN_Msk          (0x1ul << I2C_BUSTCTL_TORSTEN_Pos)                /*!< I2C_T::BUSTCTL: TORSTEN Mask           */
+
+#define I2C_BUSSTS_BUSY_Pos              (0)                                               /*!< I2C_T::BUSSTS: BUSY Position           */
+#define I2C_BUSSTS_BUSY_Msk              (0x1ul << I2C_BUSSTS_BUSY_Pos)                    /*!< I2C_T::BUSSTS: BUSY Mask               */
+
+#define I2C_BUSSTS_BCDONE_Pos            (1)                                               /*!< I2C_T::BUSSTS: BCDONE Position         */
+#define I2C_BUSSTS_BCDONE_Msk            (0x1ul << I2C_BUSSTS_BCDONE_Pos)                  /*!< I2C_T::BUSSTS: BCDONE Mask             */
+
+#define I2C_BUSSTS_PECERR_Pos            (2)                                               /*!< I2C_T::BUSSTS: PECERR Position         */
+#define I2C_BUSSTS_PECERR_Msk            (0x1ul << I2C_BUSSTS_PECERR_Pos)                  /*!< I2C_T::BUSSTS: PECERR Mask             */
+
+#define I2C_BUSSTS_ALERT_Pos             (3)                                               /*!< I2C_T::BUSSTS: ALERT Position          */
+#define I2C_BUSSTS_ALERT_Msk             (0x1ul << I2C_BUSSTS_ALERT_Pos)                   /*!< I2C_T::BUSSTS: ALERT Mask              */
+
+#define I2C_BUSSTS_SCTLDIN_Pos           (4)                                               /*!< I2C_T::BUSSTS: SCTLDIN Position        */
+#define I2C_BUSSTS_SCTLDIN_Msk           (0x1ul << I2C_BUSSTS_SCTLDIN_Pos)                 /*!< I2C_T::BUSSTS: SCTLDIN Mask            */
+
+#define I2C_BUSSTS_BUSTO_Pos             (5)                                               /*!< I2C_T::BUSSTS: BUSTO Position          */
+#define I2C_BUSSTS_BUSTO_Msk             (0x1ul << I2C_BUSSTS_BUSTO_Pos)                   /*!< I2C_T::BUSSTS: BUSTO Mask              */
+
+#define I2C_BUSSTS_CLKTO_Pos             (6)                                               /*!< I2C_T::BUSSTS: CLKTO Position          */
+#define I2C_BUSSTS_CLKTO_Msk             (0x1ul << I2C_BUSSTS_CLKTO_Pos)                   /*!< I2C_T::BUSSTS: CLKTO Mask              */
+
+#define I2C_BUSSTS_PECDONE_Pos           (7)                                               /*!< I2C_T::BUSSTS: PECDONE Position        */
+#define I2C_BUSSTS_PECDONE_Msk           (0x1ul << I2C_BUSSTS_PECDONE_Pos)                 /*!< I2C_T::BUSSTS: PECDONE Mask            */
+
+#define I2C_PKTSIZE_PLDSIZE_Pos          (0)                                               /*!< I2C_T::PKTSIZE: PLDSIZE Position       */
+#define I2C_PKTSIZE_PLDSIZE_Msk          (0x1fful << I2C_PKTSIZE_PLDSIZE_Pos)              /*!< I2C_T::PKTSIZE: PLDSIZE Mask           */
+
+#define I2C_PKTCRC_PECCRC_Pos            (0)                                               /*!< I2C_T::PKTCRC: PECCRC Position         */
+#define I2C_PKTCRC_PECCRC_Msk            (0xfful << I2C_PKTCRC_PECCRC_Pos)                 /*!< I2C_T::PKTCRC: PECCRC Mask             */
+
+#define I2C_BUSTOUT_BUSTO_Pos            (0)                                               /*!< I2C_T::BUSTOUT: BUSTO Position         */
+#define I2C_BUSTOUT_BUSTO_Msk            (0xfful << I2C_BUSTOUT_BUSTO_Pos)                 /*!< I2C_T::BUSTOUT: BUSTO Mask             */
+
+#define I2C_CLKTOUT_CLKTO_Pos            (0)                                               /*!< I2C_T::CLKTOUT: CLKTO Position         */
+#define I2C_CLKTOUT_CLKTO_Msk            (0xfful << I2C_CLKTOUT_CLKTO_Pos)                 /*!< I2C_T::CLKTOUT: CLKTO Mask             */
+
+
+#define I2C0                 ((I2C_T *)   I2C0_BA)
+#define I2C1                 ((I2C_T *)   I2C1_BA)
+#define I2C2                 ((I2C_T *)   I2C2_BA)
+#define I2C3                 ((I2C_T *)   I2C3_BA)
+
+
+
+
+
+
+
+
+
+
+
+
+
+/** @addtogroup I2C_EXPORTED_FUNCTIONS I2C Exported Functions
+  @{
+*/
+/**
+ *    @brief        The macro is used to set I2C bus condition at One Time
+ *
+ *    @param[in]    i2c        Specify I2C port
+ *    @param[in]    u8Ctrl     A byte writes to I2C control register
+ *
+ *    @return       None
+ *
+ *    @details      Set I2C_CTL register to control I2C bus conditions of START, STOP, SI, ACK.
+ *    \hideinitializer
+ */
+#define I2C_SET_CONTROL_REG(i2c, u8Ctrl) ((i2c)->CTL0 = ((i2c)->CTL0 & ~0x3c) | (u8Ctrl))
+
+/**
+ *    @brief        The macro is used to set START condition of I2C Bus
+ *
+ *    @param[in]    i2c        Specify I2C port
+ *
+ *    @return       None
+ *
+ *    @details      Set the I2C bus START condition in I2C_CTL register.
+ *    \hideinitializer
+ */
+#define I2C_START(i2c)  ((i2c)->CTL0 = ((i2c)->CTL0 & ~I2C_CTL0_SI_Msk) | I2C_CTL0_STA_Msk)
+
+/**
+ *    @brief        The macro is used to wait I2C bus status get ready
+ *
+ *    @param[in]    i2c        Specify I2C port
+ *
+ *    @return       None
+ *
+ *    @details      When a new status is presented of I2C bus, the SI flag will be set in I2C_CTL register.
+ *    \hideinitializer
+ */
+#define I2C_WAIT_READY(i2c)     while(!((i2c)->CTL0 & I2C_CTL0_SI_Msk))
+
+/**
+ *    @brief        The macro is used to Read I2C Bus Data Register
+ *
+ *    @param[in]    i2c        Specify I2C port
+ *
+ *    @return       A byte of I2C data register
+ *
+ *    @details      I2C controller read data from bus and save it in I2CDAT register.
+ *    \hideinitializer
+ */
+#define I2C_GET_DATA(i2c)   ((i2c)->DAT)
+
+/**
+ *    @brief        Write a Data to I2C Data Register
+ *
+ *    @param[in]    i2c         Specify I2C port
+ *    @param[in]    u8Data      A byte that writes to data register
+ *
+ *    @return       None
+ *
+ *    @details      When write a data to I2C_DAT register, the I2C controller will shift it to I2C bus.
+ *    \hideinitializer
+ */
+#define I2C_SET_DATA(i2c, u8Data) ((i2c)->DAT = (u8Data))
+
+/**
+ *    @brief        Get I2C Bus status code
+ *
+ *    @param[in]    i2c        Specify I2C port
+ *
+ *    @return       I2C status code
+ *
+ *    @details      To get this status code to monitor I2C bus event.
+ *    \hideinitializer
+ */
+#define I2C_GET_STATUS(i2c) ((i2c)->STATUS0)
+
+/**
+ *    @brief        Get Time-out flag from I2C Bus
+ *
+ *    @param[in]    i2c     Specify I2C port
+ *
+ *    @retval       0       I2C Bus time-out is not happened
+ *    @retval       1       I2C Bus time-out is happened
+ *
+ *    @details      When I2C bus occurs time-out event, the time-out flag will be set.
+ *    \hideinitializer
+ */
+#define I2C_GET_TIMEOUT_FLAG(i2c)   ( ((i2c)->TOCTL & I2C_TOCTL_TOIF_Msk) == I2C_TOCTL_TOIF_Msk ? 1:0 )
+
+/**
+ *    @brief        To get wake-up flag from I2C Bus
+ *
+ *    @param[in]    i2c     Specify I2C port
+ *
+ *    @retval       0       Chip is not woken-up from power-down mode
+ *    @retval       1       Chip is woken-up from power-down mode
+ *
+ *    @details      I2C bus occurs wake-up event, wake-up flag will be set.
+ *    \hideinitializer
+ */
+#define I2C_GET_WAKEUP_FLAG(i2c) ( ((i2c)->WKSTS & I2C_WKSTS_WKIF_Msk) == I2C_WKSTS_WKIF_Msk ? 1:0  )
+
+/**
+ *    @brief        To clear wake-up flag
+ *
+ *    @param[in]    i2c     Specify I2C port
+ *
+ *    @return       None
+ *
+ *    @details      If wake-up flag is set, use this macro to clear it.
+ *    \hideinitializer
+ */
+#define I2C_CLEAR_WAKEUP_FLAG(i2c)  ((i2c)->WKSTS = I2C_WKSTS_WKIF_Msk)
+
+/**
+  * @brief      Enable RX PDMA function.
+  * @param[in]  i2c The pointer of the specified I2C module.
+  * @return     None.
+  * @details    Set RXPDMAEN bit of I2C_CTL1 register to enable RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define I2C_ENABLE_RX_PDMA(i2c)   ((i2c)->CTL1 |= I2C_CTL1_RXPDMAEN_Msk)
+
+/**
+  * @brief      Enable TX PDMA function.
+  * @param[in]  i2c The pointer of the specified I2C module.
+  * @return     None.
+  * @details    Set TXPDMAEN bit of I2C_CTL1 register to enable TX PDMA transfer function.
+  * \hideinitializer
+  */
+#define I2C_ENABLE_TX_PDMA(i2c)   ((i2c)->CTL1 |= I2C_CTL1_TXPDMAEN_Msk)
+
+/**
+  * @brief      Disable RX PDMA transfer.
+  * @param[in]  i2c The pointer of the specified I2C module.
+  * @return     None.
+  * @details    Clear RXPDMAEN bit of I2C_CTL1 register to disable RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define I2C_DISABLE_RX_PDMA(i2c)   ((i2c)->CTL1 &= ~I2C_CTL1_RXPDMAEN_Msk)
+
+/**
+  * @brief      Disable TX PDMA transfer.
+  * @param[in]  i2c The pointer of the specified I2C module.
+  * @return     None.
+  * @details    Clear TXPDMAEN bit of I2C_CTL1 register to disable TX PDMA transfer function.
+  * \hideinitializer
+  */
+#define I2C_DISABLE_TX_PDMA(i2c)   ((i2c)->CTL1 &= ~I2C_CTL1_TXPDMAEN_Msk)
+
+/**
+  * @brief      Enable PDMA stretch function.
+  * @param[in]  i2c The pointer of the specified I2C module.
+  * @return     None.
+  * @details    Enable this function is to stretch bus by hardware after PDMA transfer is done if SI is not cleared.
+  * \hideinitializer
+  */
+#define I2C_ENABLE_PDMA_STRETCH(i2c)   ((i2c)->CTL1 |= I2C_CTL1_PDMASTR_Msk)
+
+/**
+  * @brief      Disable PDMA stretch function.
+  * @param[in]  i2c The pointer of the specified I2C module.
+  * @return     None.
+  * @details    I2C will send STOP after PDMA transfers done automatically.
+  * \hideinitializer
+  */
+#define I2C_DISABLE_PDMA_STRETCH(i2c)   ((i2c)->CTL1 &= ~I2C_CTL1_PDMASTR_Msk)
+
+/**
+  * @brief      Reset PDMA function.
+  * @param[in]  i2c The pointer of the specified I2C module.
+  * @return     None.
+  * @details    I2C PDMA engine will be reset after this function is called.
+  * \hideinitializer
+  */
+#define I2C_DISABLE_RST_PDMA(i2c)   ((i2c)->CTL1 |= I2C_CTL1_PDMARST_Msk)
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* inline functions                                                                                        */
+/*---------------------------------------------------------------------------------------------------------*/
+
+/* Declare these inline functions here to avoid MISRA C 2004 rule 8.1 error */
+void I2C_STOP(I2C_T *i2c);
+
+void I2C_ClearTimeoutFlag(I2C_T *i2c);
+void I2C_Close(I2C_T *i2c);
+void I2C_Trigger(I2C_T *i2c, uint8_t u8Start, uint8_t u8Stop, uint8_t u8Si, uint8_t u8Ack);
+void I2C_DisableInt(I2C_T *i2c);
+void I2C_EnableInt(I2C_T *i2c);
+uint32_t I2C_GetBusClockFreq(I2C_T *i2c);
+uint32_t I2C_GetIntFlag(I2C_T *i2c);
+uint32_t I2C_GetStatus(I2C_T *i2c);
+uint32_t I2C_Open(I2C_T *i2c, uint32_t u32BusClock);
+uint8_t I2C_GetData(I2C_T *i2c);
+void I2C_SetSlaveAddr(I2C_T *i2c, uint8_t u8SlaveNo, uint8_t u8SlaveAddr, uint8_t u8GCMode);
+void I2C_SetSlaveAddrMask(I2C_T *i2c, uint8_t u8SlaveNo, uint8_t u8SlaveAddrMask);
+uint32_t I2C_SetBusClockFreq(I2C_T *i2c, uint32_t u32BusClock);
+void I2C_EnableTimeout(I2C_T *i2c, uint8_t u8LongTimeout);
+void I2C_DisableTimeout(I2C_T *i2c);
+void I2C_EnableWakeup(I2C_T *i2c);
+void I2C_DisableWakeup(I2C_T *i2c);
+void I2C_SetData(I2C_T *i2c, uint8_t u8Data);
+uint8_t I2C_WriteByte(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t data);
+uint32_t I2C_WriteMultiBytes(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t data[], uint32_t u32wLen);
+uint8_t I2C_WriteByteOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t data);
+uint32_t I2C_WriteMultiBytesOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t data[], uint32_t u32wLen);
+uint8_t I2C_WriteByteTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t data);
+uint32_t I2C_WriteMultiBytesTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t data[], uint32_t u32wLen);
+uint8_t I2C_ReadByte(I2C_T *i2c, uint8_t u8SlaveAddr);
+uint32_t I2C_ReadMultiBytes(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t rdata[], uint32_t u32rLen);
+uint8_t I2C_ReadByteOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr);
+uint32_t I2C_ReadMultiBytesOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t rdata[], uint32_t u32rLen);
+uint8_t I2C_ReadByteTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr);
+uint32_t I2C_ReadMultiBytesTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t rdata[], uint32_t u32rLen);
+
+/*@}*/ /* end of group I2C_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group I2C_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+
+#endif
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

+ 133 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_i2s.h

@@ -0,0 +1,133 @@
+/**************************************************************************//**
+* @file     i2s.h
+* @version  V1.00
+* $Revision: 2 $
+* $Date: 18/08/05 2:12p $
+* @brief    I2S driver header file
+*
+* @note
+ * SPDX-License-Identifier: Apache-2.0
+* Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+
+#ifndef __NU_I2S_H__
+#define __NU_I2S_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup I2S_Driver I2S Driver
+  @{
+*/
+
+/** @addtogroup I2S_EXPORTED_CONSTANTS I2S Exported Constants
+  @{
+*/
+
+#define I2S_ERR_BUSY    -1 /*!< Interface is busy  */
+#define I2S_ERR_IO      -2 /*!< IO contril error  */
+
+#define I2S_DISABLE     0  /*!< Enable I2S  */
+#define I2S_ENABLE      1  /*!< Disable I2S  */
+
+#define I2S_PLAY        0  /*!< Play I2S audio */
+#define I2S_REC         1  /*!< Reocrd I2S audio  */
+
+#define PCM_PLAY        0  /*!< Play PCM audio  */
+#define PCM_REC         1  /*!< Record PCM audio  */
+
+#define I2S_SET_PLAY                0   /*!< Start or stop to play  */
+#define I2S_START_PLAY  0  /*!< Start to play  */
+#define I2S_STOP_PLAY   1  /*!< Stop to play  */
+
+#define I2S_SET_RECORD              1   /*!< Start or stop to record  */
+#define I2S_START_REC   0  /*!< Start to record  */
+#define I2S_STOP_REC    1  /*!< Stop to record  */
+
+#define I2S_SELECT_BLOCK            2   /*!< Select block function */
+#define I2S_BLOCK_I2S   0  /*!< Select I2S function  */
+#define I2S_BLOCK_PCM   1  /*!< Select PCM function  */
+
+#define I2S_SELECT_BIT              3  /*!< Select data bit width  */
+#define I2S_BIT_WIDTH_8   0  /*!< 8-bit  */
+#define I2S_BIT_WIDTH_16  1  /*!< 16-bit  */
+#define I2S_BIT_WIDTH_24  2  /*!< 24-bit  */
+
+#define I2S_SET_PLAY_DMA_INT_SEL    4   /*!< Select play DMA interrupt request  */
+#define I2S_SET_REC_DMA_INT_SEL     5   /*!< Select record DMA interrupt request  */
+#define I2S_DMA_INT_END        0  /*!< End of buffer  */
+#define I2S_DMA_INT_HALF       1  /*!< Half of buffer  */
+#define I2S_DMA_INT_QUARTER    2  /*!< Quarter of buffer  */
+#define I2S_DMA_INT_EIGHTH     3  /*!< Eighth of buffer  */
+
+#define I2S_SET_ZEROCROSS           6  /*!< Enable or disable zero cross function  */
+#define I2S_SET_DMACOUNTER          7  /*!< Enable or disable DMA counter function  */
+
+#define I2S_SET_CHANNEL             8   /*!< Set channel number  */
+#define I2S_CHANNEL_P_I2S_ONE         2  /*!< I2S one channel  */
+#define I2S_CHANNEL_P_I2S_TWO         3  /*!< I2S two channels  */
+#define I2S_CHANNEL_P_PCM_TWO         3  /*!< PCM two slots  */
+#define I2S_CHANNEL_P_PCM_TWO_SLOT1   0  /*!< PCM two slots with all slot1 data  */
+#define I2S_CHANNEL_P_PCM_TWO_SLOT0   1  /*!< PCM two slots with all slot0 data  */
+#define I2S_CHANNEL_P_PCM_ONE_SLOT0   2  /*!< PCM one slot with all slot0 data  */
+
+#define I2S_CHANNEL_R_I2S_LEFT_PCM_SLOT0   1 /*!< I2S left channel or PCM slot0  */
+#define I2S_CHANNEL_R_I2S_RIGHT_PCM_SLOT1  2 /*!< I2S right channel or PCM slot1  */
+#define I2S_CHANNEL_R_I2S_TWO              3 /*!< I2S two channels  */
+
+#define I2S_SET_MODE                9   /*!< Select master or slave mode  */
+#define I2S_MODE_MASTER  0  /*!< master mode  */
+#define I2S_MODE_SLAVE   1  /*!< slave mode  */
+
+#define I2S_SET_SPLITDATA           10  /*!< Enable or disable split data function */
+#define I2S_SET_DMA_ADDRESS         11  /*!< Set DMA address  */
+#define I2S_SET_DMA_LENGTH          12  /*!< Set DMA length  */
+#define I2S_GET_DMA_CUR_ADDRESS     13  /*!< Get current DMA address  */
+
+#define I2S_SET_I2S_FORMAT          14  /*!< Select I2S format  */
+#define I2S_FORMAT_I2S  0  /*!< I2S format  */
+#define I2S_FORMAT_MSB  1  /*!< MSB foramt */
+
+#define I2S_SET_I2S_CALLBACKFUN     15  /*!< Install play or record call-back function */
+
+#define I2S_SET_PCMSLOT             16  /*!< Set PCM interface start position of slot */
+#define PCM_SLOT1_IN        0  /*!< Slot-1 in position */
+#define PCM_SLOT1_OUT       1  /*!< Slot-1 out position */
+#define PCM_SLOT2_IN        2  /*!< Slot-2 in position */
+#define PCM_SLOT2_OUT       3  /*!< Slot-2 out position */
+
+#define I2S_SET_PCM_FS_PERIOD       17  /*!< Set PCM FS pulse period */
+
+/*@}*/ /* end of group ARM9_I2S_EXPORTED_CONSTANTS */
+
+/** @addtogroup ARM9_I2S_EXPORTED_FUNCTIONS I2S Exported Functions
+  @{
+*/
+
+int32_t i2sOpen(void);
+void i2sClose(void);
+void i2sInit(void);
+int32_t i2sIoctl(uint32_t cmd, uint32_t arg0, uint32_t arg1);
+void i2sSetSampleRate(uint32_t u32SourceClockRate, uint32_t u32SampleRate, uint32_t u32DataBit, uint32_t u32Channel);
+void i2sSetMCLKFrequency(uint32_t u32SourceClockRate, uint32_t u32SampleRate);
+void i2sSetPCMBCLKFrequency(uint32_t u32SourceClockRate, uint32_t u32Rate);
+
+/*@}*/ /* end of group I2S_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group I2S_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_I2S_H__
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

+ 1249 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_pdma.h

@@ -0,0 +1,1249 @@
+/**************************************************************************//**
+ * @file     pdma.h
+ * @brief    PDMA driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_PDMA_H__
+#define __NU_PDMA_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+   @addtogroup REGISTER Control Register
+   @{
+*/
+
+/**
+    @addtogroup PDMA Peripheral Direct Memory Access Controller(PDMA)
+    Memory Mapped Structure for PDMA Controller
+@{ */
+
+
+typedef struct
+{
+
+    /**
+     * @var DSCT_T::CTL
+     * Offset: 0x00  Descriptor Table Control Register of PDMA Channel n.
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[1:0]   |OPMODE    |PDMA Operation Mode Selection
+     * |        |          |00 = Idle state: Channel is stopped or this table is complete, when PDMA finish channel table task, OPMODE will be cleared to idle state automatically.
+     * |        |          |01 = Basic mode: The descriptor table only has one task
+     * |        |          |When this task is finished, the PDMA_INTSTS[n] will be asserted.
+     * |        |          |10 = Scatter-Gather mode: When operating in this mode, user must give the next descriptor table address in PDMA_DSCT_NEXT register; PDMA controller will ignore this task, then load the next task to execute.
+     * |        |          |11 = Reserved.
+     * |        |          |Note: Before filling transfer task in the Descriptor Table, user must check if the descriptor table is complete.
+     * |[2]     |TXTYPE    |Transfer Type
+     * |        |          |0 = Burst transfer type.
+     * |        |          |1 = Single transfer type.
+     * |[6:4]   |BURSIZE   |Burst Size
+     * |        |          |This field is used for peripheral to determine the burst size or used for determine the re-arbitration size.
+     * |        |          |000 = 128 Transfers.
+     * |        |          |001 = 64 Transfers.
+     * |        |          |010 = 32 Transfers.
+     * |        |          |011 = 16 Transfers.
+     * |        |          |100 = 8 Transfers.
+     * |        |          |101 = 4 Transfers.
+     * |        |          |110 = 2 Transfers.
+     * |        |          |111 = 1 Transfers.
+     * |        |          |Note: This field is only useful in burst transfer type.
+     * |[7]     |TBINTDIS  |Table Interrupt Disable Bit
+     * |        |          |This field can be used to decide whether to enable table interrupt or not
+     * |        |          |If the TBINTDIS bit is enabled when PDMA controller finishes transfer task, it will not generates transfer done interrupt.
+     * |        |          |0 = Table interrupt Enabled.
+     * |        |          |1 = Table interrupt Disabled.
+     * |[9:8]   |SAINC     |Source Address Increment
+     * |        |          |This field is used to set the source address increment size.
+     * |        |          |11 = No increment (fixed address).
+     * |        |          |Others = Increment and size is depended on TXWIDTH selection.
+     * |[11:10] |DAINC     |Destination Address Increment
+     * |        |          |This field is used to set the destination address increment size.
+     * |        |          |11 = No increment (fixed address).
+     * |        |          |Others = Increment and size is depended on TXWIDTH selection.
+     * |[13:12] |TXWIDTH   |Transfer Width Selection
+     * |        |          |This field is used for transfer width.
+     * |        |          |00 = One byte (8 bit) is transferred for every operation.
+     * |        |          |01= One half-word (16 bit) is transferred for every operation.
+     * |        |          |10 = One word (32-bit) is transferred for every operation.
+     * |        |          |11 = Reserved.
+     * |        |          |Note: The PDMA transfer source address (PDMA_DSCT_SA) and PDMA transfer destination address (PDMA_DSCT_DA) should be alignment under the TXWIDTH selection
+     * |[14]    |TXACK     |Transfer Acknowledge Selection
+     * |        |          |0 = transfer ack when transfer done.
+     * |        |          |1 = transfer ack when PDMA get transfer data.
+     * |[15]    |STRIDEEN |Stride Mode Enable Bit
+     * |        |          |0 = Stride transfer mode Disabled.
+     * |        |          |1 = Stride transfer mode Enabled.
+     * |[31:16] |TXCNT     |Transfer Count
+     * |        |          |The TXCNT represents the required number of PDMA transfer, the real transfer count is (TXCNT + 1); The maximum transfer count is 65536 , every transfer may be byte, half-word or word that is dependent on TXWIDTH field.
+     * |        |          |Note: When PDMA finish each transfer data, this field will be decrease immediately.
+     * @var DSCT_T::SA
+     * Offset: 0x04  Source Address Register of PDMA Channel n
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |SA        |PDMA Transfer Source Address Register
+     * |        |          |This field indicates a 32-bit source address of PDMA controller.
+     * @var DSCT_T::DA
+     * Offset: 0x08  Destination Address Register of PDMA Channel n
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |DA        |PDMA Transfer Destination Address Register
+     * |        |          |This field indicates a 32-bit destination address of PDMA controller.
+     * @var DSCT_T::NEXT
+     * Offset: 0x0C  Next Scatter-Gather Descriptor Table Offset Address of PDMA Channel n
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |EXENEXT   |PDMA Execution Next Descriptor Table Offset
+     * |        |          |This field indicates the offset of next descriptor table address of current execution descriptor table in system memory.
+     * |        |          |Note: write operation is useless in this field.
+     * |[31:16] |NEXT      |PDMA Next Descriptor Table Offset.
+     * |        |          |This field indicates the offset of the next descriptor table address in system memory.
+     * |        |          |Write Operation:
+     * |        |          |If the system memory based address is 0x2000_0000 (PDMA_SCATBA), and the next descriptor table is start from 0x2000_0100, then this field must fill in 0x0100.
+     * |        |          |Read Operation:
+     * |        |          |When operating in scatter-gather mode, the last two bits NEXT[1:0] will become reserved, and indicate the first next address of system memory.
+     * |        |          |Note1: The descriptor table address must be word boundary.
+     * |        |          |Note2: Before filled transfer task in the descriptor table, user must check if the descriptor table is complete.
+     */
+    __IO uint32_t CTL;             /*!< [0x0000] Descriptor Table Control Register of PDMA Channel n.             */
+    __IO uint32_t SA;              /*!< [0x0004] Source Address Register of PDMA Channel n                        */
+    __IO uint32_t DA;              /*!< [0x0008] Destination Address Register of PDMA Channel n                   */
+    __IO uint32_t NEXT;            /*!< [0x000c] First Scatter-Gather Descriptor Table Offset Address of PDMA Channel n */
+} DSCT_T;
+
+
+typedef struct
+{
+    /**
+     * @var STRIDE_T::STCR
+     * Offset: 0x500  Stride Transfer Count Register of PDMA Channel n
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |STC       |PDMA Stride Transfer Count
+     * |        |          |The 16-bit register defines the stride transfer count of each row.
+     * @var STRIDE_T::ASOCR
+     * Offset: 0x504  Address Stride Offset Register of PDMA Channel n
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |SASOL     |VDMA Source Address Stride Offset Length
+     * |        |          |The 16-bit register defines the source address stride transfer offset count of each row.
+     * |[31:16] |DASOL     |VDMA Destination Address Stride Offset Length
+     * |        |          |The 16-bit register defines the destination address stride transfer offset count of each row.
+     */
+    __IO uint32_t STCR;           /*!< [0x0500] Stride Transfer Count Register of PDMA Channel 0                 */
+    __IO uint32_t ASOCR;          /*!< [0x0504] Address Stride Offset Register of PDMA Channel 0                 */
+} STRIDE_T;
+
+typedef struct
+{
+
+
+    /**
+     * @var PDMA_T::CURSCAT
+     * Offset: 0x100  Current Scatter-Gather Descriptor Table Address of PDMA Channel n
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |CURADDR   |PDMA Current Description Address Register (Read Only)
+     * |        |          |This field indicates a 32-bit current external description address of PDMA controller.
+     * |        |          |Note: This field is read only and only used for Scatter-Gather mode to indicate the current external description address.
+     * @var PDMA_T::CHCTL
+     * Offset: 0x400  PDMA Channel Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |CHENn     |PDMA Channel Enable Bit
+     * |        |          |Set this bit to 1 to enable PDMAn operation. Channel cannot be active if it is not set as enabled.
+     * |        |          |0 = PDMA channel [n] Disabled.
+     * |        |          |1 = PDMA channel [n] Enabled.
+     * |        |          |Note: Set corresponding bit of PDMA_PAUSE or PDMA_CHRST register will also clear this bit.
+     * @var PDMA_T::PAUSE
+     * Offset: 0x404  PDMA Transfer Stop Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |PAUSEn    |PDMA Transfer Pause Control Register (Write Only)
+     * |        |          |User can set PAUSEn bit field to pause the PDMA transfer
+     * |        |          |When user sets PAUSEn bit, the PDMA controller will pause the on-going transfer, then clear the channel enable bit CHEN(PDMA_CHCTL [n], n=0,1..7) and clear request active flag
+     * |        |          |If re-enable the paused channel again, the remaining transfers will be processed.
+     * |        |          |0 = No effect.
+     * |        |          |1 = Pause PDMA channel n transfer.
+     * @var PDMA_T::SWREQ
+     * Offset: 0x408  PDMA Software Request Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |SWREQn    |PDMA Software Request Register (Write Only)
+     * |        |          |Set this bit to 1 to generate a software request to PDMA [n].
+     * |        |          |0 = No effect.
+     * |        |          |1 = Generate a software request.
+     * |        |          |Note1: User can read PDMA_TRGSTS register to know which channel is on active
+     * |        |          |Active flag may be triggered by software request or peripheral request.
+     * |        |          |Note2: If user does not enable corresponding PDMA channel, the software request will be ignored.
+     * @var PDMA_T::TRGSTS
+     * Offset: 0x40C  PDMA Channel Request Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |REQSTSn   |PDMA Channel Request Status (Read Only)
+     * |        |          |This flag indicates whether channel[n] have a request or not, no matter request from software or peripheral
+     * |        |          |When PDMA controller finishes channel transfer, this bit will be cleared automatically.
+     * |        |          |0 = PDMA Channel n has no request.
+     * |        |          |1 = PDMA Channel n has a request.
+     * |        |          |Note: If user pauses or resets each PDMA transfer by setting PDMA_PAUSE or PDMA_CHRST register respectively, this bit will be cleared automatically after finishing current transfer.
+     * @var PDMA_T::PRISET
+     * Offset: 0x410  PDMA Fixed Priority Setting Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |FPRISETn  |PDMA Fixed Priority Setting Register
+     * |        |          |Set this bit to 1 to enable fixed priority level.
+     * |        |          |Write Operation:
+     * |        |          |0 = No effect.
+     * |        |          |1 = Set PDMA channel [n] to fixed priority channel.
+     * |        |          |Read Operation:
+     * |        |          |0 = Corresponding PDMA channel is round-robin priority.
+     * |        |          |1 = Corresponding PDMA channel is fixed priority.
+     * |        |          |Note: This field only set to fixed priority, clear fixed priority use PDMA_PRICLR register.
+     * @var PDMA_T::PRICLR
+     * Offset: 0x414  PDMA Fixed Priority Clear Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |FPRICLRn  |PDMA Fixed Priority Clear Register (Write Only)
+     * |        |          |Set this bit to 1 to clear fixed priority level.
+     * |        |          |0 = No effect.
+     * |        |          |1 = Clear PDMA channel [n] fixed priority setting.
+     * |        |          |Note: User can read PDMA_PRISET register to know the channel priority.
+     * @var PDMA_T::INTEN
+     * Offset: 0x418  PDMA Interrupt Enable Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |INTENn    |PDMA Interrupt Enable Register
+     * |        |          |This field is used for enabling PDMA channel[n] interrupt.
+     * |        |          |0 = PDMA channel n interrupt Disabled.
+     * |        |          |1 = PDMA channel n interrupt Enabled.
+     * @var PDMA_T::INTSTS
+     * Offset: 0x41C  PDMA Interrupt Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |ABTIF     |PDMA Read/Write Target Abort Interrupt Flag (Read-only)
+     * |        |          |This bit indicates that PDMA has target abort error; Software can read PDMA_ABTSTS register to find which channel has target abort error.
+     * |        |          |0 = No AHB bus ERROR response received.
+     * |        |          |1 = AHB bus ERROR response received.
+     * |[1]     |TDIF      |Transfer Done Interrupt Flag (Read Only)
+     * |        |          |This bit indicates that PDMA controller has finished transmission; User can read PDMA_TDSTS register to indicate which channel finished transfer.
+     * |        |          |0 = Not finished yet.
+     * |        |          |1 = PDMA channel has finished transmission.
+     * |[2]     |ALIGNF    |Transfer Alignment Interrupt Flag (Read Only)
+     * |        |          |0 = PDMA channel source address and destination address both follow transfer width setting.
+     * |        |          |1 = PDMA channel source address or destination address is not follow transfer width setting.
+     * |[8]     |REQTOF0   |Request Time-out Flag for Channel 0
+     * |        |          |This flag indicates that PDMA controller has waited peripheral request for a period defined by PDMA_TOC0, user can write 1 to clear these bits.
+     * |        |          |0 = No request time-out.
+     * |        |          |1 = Peripheral request time-out.
+     * |[9]     |REQTOF1   |Request Time-out Flag for Channel 1
+     * |        |          |This flag indicates that PDMA controller has waited peripheral request for a period defined by PDMA_TOC1, user can write 1 to clear these bits.
+     * |        |          |0 = No request time-out.
+     * |        |          |1 = Peripheral request time-out.
+     * @var PDMA_T::ABTSTS
+     * Offset: 0x420  PDMA Channel Read/Write Target Abort Flag Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |ABTIFn    |PDMA Read/Write Target Abort Interrupt Status Flag
+     * |        |          |This bit indicates which PDMA controller has target abort error; User can write 1 to clear these bits.
+     * |        |          |0 = No AHB bus ERROR response received when channel n transfer.
+     * |        |          |1 = AHB bus ERROR response received when channel n transfer.
+     * @var PDMA_T::TDSTS
+     * Offset: 0x424  PDMA Channel Transfer Done Flag Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |TDIFn     |Transfer Done Flag Register
+     * |        |          |This bit indicates whether PDMA controller channel transfer has been finished or not, user can write 1 to clear these bits.
+     * |        |          |0 = PDMA channel transfer has not finished.
+     * |        |          |1 = PDMA channel has finished transmission.
+     * @var PDMA_T::ALIGN
+     * Offset: 0x428  PDMA Transfer Alignment Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |ALIGNn    |Transfer Alignment Flag Register
+     * |        |          |0 = PDMA channel source address and destination address both follow transfer width setting.
+     * |        |          |1 = PDMA channel source address or destination address is not follow transfer width setting.
+     * @var PDMA_T::TACTSTS
+     * Offset: 0x42C  PDMA Transfer Active Flag Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |TXACTFn   |Transfer on Active Flag Register (Read Only)
+     * |        |          |This bit indicates which PDMA channel is in active.
+     * |        |          |0 = PDMA channel is not finished.
+     * |        |          |1 = PDMA channel is active.
+     * @var PDMA_T::TOUTPSC
+     * Offset: 0x430  PDMA Time-out Prescaler Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[2:0]   |TOUTPSC0  |PDMA Channel 0 Time-out Clock Source Prescaler Bits
+     * |        |          |000 = PDMA channel 0 time-out clock source is HCLK/28.
+     * |        |          |001 = PDMA channel 0 time-out clock source is HCLK/29.
+     * |        |          |010 = PDMA channel 0 time-out clock source is HCLK/210.
+     * |        |          |011 = PDMA channel 0 time-out clock source is HCLK/211.
+     * |        |          |100 = PDMA channel 0 time-out clock source is HCLK/212.
+     * |        |          |101 = PDMA channel 0 time-out clock source is HCLK/213.
+     * |        |          |110 = PDMA channel 0 time-out clock source is HCLK/214.
+     * |        |          |111 = PDMA channel 0 time-out clock source is HCLK/215.
+     * |[6:4]   |TOUTPSC1  |PDMA Channel 1 Time-out Clock Source Prescaler Bits
+     * |        |          |000 = PDMA channel 1 time-out clock source is HCLK/28.
+     * |        |          |001 = PDMA channel 1 time-out clock source is HCLK/29.
+     * |        |          |010 = PDMA channel 1 time-out clock source is HCLK/210.
+     * |        |          |011 = PDMA channel 1 time-out clock source is HCLK/211.
+     * |        |          |100 = PDMA channel 1 time-out clock source is HCLK/212.
+     * |        |          |101 = PDMA channel 1 time-out clock source is HCLK/213.
+     * |        |          |110 = PDMA channel 1 time-out clock source is HCLK/214.
+     * |        |          |111 = PDMA channel 1 time-out clock source is HCLK/215.
+     * @var PDMA_T::TOUTEN
+     * Offset: 0x434  PDMA Time-out Enable Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[1:0]   |TOUTENn   |PDMA Time-out Enable Bits
+     * |        |          |0 = PDMA Channel n time-out function Disable.
+     * |        |          |1 = PDMA Channel n time-out function Enable.
+     * @var PDMA_T::TOUTIEN
+     * Offset: 0x438  PDMA Time-out Interrupt Enable Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[1:0]   |TOUTIENn  |PDMA Time-out Interrupt Enable Bits
+     * |        |          |0 = PDMA Channel n time-out interrupt Disable.
+     * |        |          |1 = PDMA Channel n time-out interrupt Enable.
+     * @var PDMA_T::SCATBA
+     * Offset: 0x43C  PDMA Scatter-Gather Descriptor Table Base Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:16] |SCATBA    |PDMA Scatter-gather Descriptor Table Address Register
+     * |        |          |In Scatter-Gather mode, this is the base address for calculating the next link - list address
+     * |        |          |The next link address equation is
+     * |        |          |Next Link Address = PDMA_SCATBA + PDMA_DSCT_NEXT.
+     * |        |          |Note: Only useful in Scatter-Gather mode.
+     * @var PDMA_T::TOC0_1
+     * Offset: 0x440  PDMA Time-out Counter Ch1 and Ch0 Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |TOC0      |Time-out Counter for Channel 0
+     * |        |          |This controls the period of time-out function for channel 0
+     * |        |          |The calculation unit is based on 10 kHz clock.
+     * |[31:16] |TOC1      |Time-out Counter for Channel 1
+     * |        |          |This controls the period of time-out function for channel 1
+     * |        |          |The calculation unit is based on 10 kHz clock.
+     * @var PDMA_T::CHRST
+     * Offset: 0x460  PDMA Channel Reset Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[15:0]  |CHnRST    |Channel N Reset
+     * |        |          |0 = corresponding channel n not reset.
+     * |        |          |1 = corresponding channel n is reset.
+     * @var PDMA_T::REQSEL0_3
+     * Offset: 0x480  PDMA Request Source Select Register 0
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[6:0]   |REQSRC0   |Channel 0 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 0
+     * |        |          |User can configure the peripheral by setting REQSRC0.
+     * |        |          |0 = Disable PDMA peripheral request.
+     * |        |          |1 = Reserved.
+     * |        |          |2 = Channel connects to USB_TX.
+     * |        |          |3 = Channel connects to USB_RX.
+     * |        |          |4 = Channel connects to UART0_TX.
+     * |        |          |5 = Channel connects to UART0_RX.
+     * |        |          |6 = Channel connects to UART1_TX.
+     * |        |          |7 = Channel connects to UART1_RX.
+     * |        |          |8 = Channel connects to UART2_TX.
+     * |        |          |9 = Channel connects to UART2_RX.
+     * |        |          |10=Channel connects to UART3_TX.
+     * |        |          |11 = Channel connects to UART3_RX.
+     * |        |          |12 = Channel connects to UART4_TX.
+     * |        |          |13 = Channel connects to UART4_RX.
+     * |        |          |14 = Channel connects to UART5_TX.
+     * |        |          |15 = Channel connects to UART5_RX.
+     * |        |          |16 = Channel connects to USCI0_TX.
+     * |        |          |17 = Channel connects to USCI0_RX.
+     * |        |          |18 = Channel connects to USCI1_TX.
+     * |        |          |19 = Channel connects to USCI1_RX.
+     * |        |          |20 = Channel connects to QSPI0_TX.
+     * |        |          |21 = Channel connects to QSPI0_RX.
+     * |        |          |22 = Channel connects to SPI0_TX.
+     * |        |          |23 = Channel connects to SPI0_RX.
+     * |        |          |24 = Channel connects to SPI1_TX.
+     * |        |          |25 = Channel connects to SPI1_RX.
+     * |        |          |26 = Channel connects to SPI2_TX.
+     * |        |          |27 = Channel connects to SPI2_RX.
+     * |        |          |28 = Channel connects to SPI3_TX.
+     * |        |          |29 = Channel connects to SPI3_RX.
+     * |        |          |30 = Reserved.
+     * |        |          |31 = Reserved.
+     * |        |          |32 = Channel connects to EPWM0_P1_RX.
+     * |        |          |33 = Channel connects to EPWM0_P2_RX.
+     * |        |          |34 = Channel connects to EPWM0_P3_RX.
+     * |        |          |35 = Channel connects to EPWM1_P1_RX.
+     * |        |          |36 = Channel connects to EPWM1_P2_RX.
+     * |        |          |37 = Channel connects to EPWM1_P3_RX.
+     * |        |          |38 = Channel connects to I2C0_TX.
+     * |        |          |39 = Channel connects to I2C0_RX.
+     * |        |          |40 = Channel connects to I2C1_TX.
+     * |        |          |41 = Channel connects to I2C1_RX.
+     * |        |          |42 = Channel connects to I2C2_TX.
+     * |        |          |43 = Channel connects to I2C2_RX.
+     * |        |          |44 = Channel connects to I2S0_TX.
+     * |        |          |45 = Channel connects to I2S0_RX.
+     * |        |          |46 = Channel connects to TMR0.
+     * |        |          |47 = Channel connects to TMR1.
+     * |        |          |48 = Channel connects to TMR2.
+     * |        |          |49 = Channel connects to TMR3.
+     * |        |          |50 = Channel connects to ADC_RX.
+     * |        |          |51 = Channel connects to DAC0_TX.
+     * |        |          |52 = Channel connects to DAC1_TX.
+     * |        |          |53 = Channel connects to EPWM0_CH0_TX.
+     * |        |          |54 = Channel connects to EPWM0_CH1_TX.
+     * |        |          |55 = Channel connects to EPWM0_CH2_TX.
+     * |        |          |56 = Channel connects to EPWM0_CH3_TX.
+     * |        |          |57 = Channel connects to EPWM0_CH4_TX.
+     * |        |          |58 = Channel connects to EPWM0_CH5_TX.
+     * |        |          |59 = Channel connects to EPWM1_CH0_TX.
+     * |        |          |60 = Channel connects to EPWM1_CH1_TX.
+     * |        |          |61 = Channel connects to EPWM1_CH2_TX.
+     * |        |          |62 = Channel connects to EPWM1_CH3_TX.
+     * |        |          |63 = Channel connects to EPWM1_CH4_TX.
+     * |        |          |64 = Channel connects to EPWM1_CH5_TX.
+     * |        |          |65 = Channel connects to ETMC_RX.
+     * |        |          |Others = Reserved.
+     * |        |          |Note 1: A peripheral can't assign to two channels at the same time.
+     * |        |          |Note 2: This field is useless when transfer between memory and memory.
+     * |[14:8]  |REQSRC1   |Channel 1 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 1
+     * |        |          |User can configure the peripheral setting by REQSRC1.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[22:16] |REQSRC2   |Channel 2 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 2
+     * |        |          |User can configure the peripheral setting by REQSRC2.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[30:24] |REQSRC3   |Channel 3 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 3
+     * |        |          |User can configure the peripheral setting by REQSRC3.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * @var PDMA_T::REQSEL4_7
+     * Offset: 0x484  PDMA Request Source Select Register 1
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[6:0]   |REQSRC4   |Channel 4 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 4
+     * |        |          |User can configure the peripheral setting by REQSRC4.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[14:8]  |REQSRC5   |Channel 5 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 5
+     * |        |          |User can configure the peripheral setting by REQSRC5.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[22:16] |REQSRC6   |Channel 6 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 6
+     * |        |          |User can configure the peripheral setting by REQSRC6.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[30:24] |REQSRC7   |Channel 7 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 7
+     * |        |          |User can configure the peripheral setting by REQSRC7.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * @var PDMA_T::REQSEL8_11
+     * Offset: 0x488  PDMA Request Source Select Register 2
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[6:0]   |REQSRC8   |Channel 8 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 8
+     * |        |          |User can configure the peripheral setting by REQSRC8.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[14:8]  |REQSRC9   |Channel 9 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 9
+     * |        |          |User can configure the peripheral setting by REQSRC9.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[22:16] |REQSRC10  |Channel 10 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 10
+     * |        |          |User can configure the peripheral setting by REQSRC10.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[30:24] |REQSRC11  |Channel 11 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 11
+     * |        |          |User can configure the peripheral setting by REQSRC11.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * @var PDMA_T::REQSEL12_15
+     * Offset: 0x48C  PDMA Request Source Select Register 3
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[6:0]   |REQSRC12  |Channel 12 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 12
+     * |        |          |User can configure the peripheral setting by REQSRC12.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[14:8]  |REQSRC13  |Channel 13 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 13
+     * |        |          |User can configure the peripheral setting by REQSRC13.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[22:16] |REQSRC14  |Channel 14 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 14
+     * |        |          |User can configure the peripheral setting by REQSRC14.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     * |[30:24] |REQSRC15  |Channel 15 Request Source Selection
+     * |        |          |This filed defines which peripheral is connected to PDMA channel 15
+     * |        |          |User can configure the peripheral setting by REQSRC15.
+     * |        |          |Note: The channel configuration is the same as REQSRC0 field
+     * |        |          |Please refer to the explanation of REQSRC0.
+     */
+    DSCT_T DSCT[16];
+    __I  uint32_t CURSCAT[16];              /*!< [0x0100] Current Scatter-Gather Descriptor Table Address of PDMA Channel n */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE1[176];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t CHCTL;                 /*!< [0x0400] PDMA Channel Control Register                                    */
+    __O  uint32_t PAUSE;                 /*!< [0x0404] PDMA Transfer Pause Control Register                              */
+    __O  uint32_t SWREQ;                 /*!< [0x0408] PDMA Software Request Register                                   */
+    __I  uint32_t TRGSTS;                /*!< [0x040c] PDMA Channel Request Status Register                             */
+    __IO uint32_t PRISET;                /*!< [0x0410] PDMA Fixed Priority Setting Register                             */
+    __O  uint32_t PRICLR;                /*!< [0x0414] PDMA Fixed Priority Clear Register                               */
+    __IO uint32_t INTEN;                 /*!< [0x0418] PDMA Interrupt Enable Register                                   */
+    __IO uint32_t INTSTS;                /*!< [0x041c] PDMA Interrupt Status Register                                   */
+    __IO uint32_t ABTSTS;                /*!< [0x0420] PDMA Channel Read/Write Target Abort Flag Register               */
+    __IO uint32_t TDSTS;                 /*!< [0x0424] PDMA Channel Transfer Done Flag Register                         */
+    __IO uint32_t ALIGN;                 /*!< [0x0428] PDMA Transfer Alignment Status Register                          */
+    __I  uint32_t TACTSTS;               /*!< [0x042c] PDMA Transfer Active Flag Register                               */
+    __IO uint32_t TOUTPSC;               /*!< [0x0430] PDMA Time-out Prescaler Register                                 */
+    __IO uint32_t TOUTEN;                /*!< [0x0434] PDMA Time-out Enable Register                                    */
+    __IO uint32_t TOUTIEN;               /*!< [0x0438] PDMA Time-out Interrupt Enable Register                          */
+    __IO uint32_t SCATBA;                /*!< [0x043c] PDMA Scatter-Gather Descriptor Table Base Address Register       */
+    __IO uint32_t TOC0_1;                /*!< [0x0440] PDMA Time-out Counter Ch1 and Ch0 Register                       */
+    __IO uint32_t TOC2_3;                /*!< [0x0444] PDMA Time-out Counter Ch1 and Ch0 Register                       */
+    __IO uint32_t TOC4_5;                /*!< [0x0448] PDMA Time-out Counter Ch1 and Ch0 Register                       */
+    __IO uint32_t TOC6_7;                /*!< [0x044c] PDMA Time-out Counter Ch1 and Ch0 Register                       */
+    __IO uint32_t TOC8_9;                /*!< [0x0450] PDMA Time-out Counter Ch1 and Ch0 Register                       */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE2[3];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t CHRST;                 /*!< [0x0460] PDMA Channel Reset Register                                      */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE5[3];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t TOUTPSC2;              /*!< [0x0470] PPDMA Time-out Prescaler Register                                */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE3[3];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t REQSEL0_3;             /*!< [0x0480] PDMA Request Source Select Register 0                            */
+    __IO uint32_t REQSEL4_7;             /*!< [0x0484] PDMA Request Source Select Register 1                            */
+    __IO uint32_t REQSEL8_11;            /*!< [0x0488] PDMA Request Source Select Register 2                            */
+    __IO uint32_t REQSEL12_15;           /*!< [0x048c] PDMA Request Source Select Register 3                            */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE4[28];
+    /// @endcond //HIDDEN_SYMBOLS
+    STRIDE_T     STRIDE[6];
+} PDMA_T;
+
+/**
+    @addtogroup PDMA_CONST PDMA Bit Field Definition
+    Constant Definitions for PDMA Controller
+@{ */
+
+#define PDMA_DSCT_CTL_OPMODE_Pos        (0)                                               /*!< PDMA_T::DSCT_CTL: OPMODE Position     */
+#define PDMA_DSCT_CTL_OPMODE_Msk        (0x3ul << PDMA_DSCT_CTL_OPMODE_Pos)               /*!< PDMA_T::DSCT_CTL: OPMODE Mask         */
+
+#define PDMA_DSCT_CTL_TXTYPE_Pos        (2)                                               /*!< PDMA_T::DSCT_CTL: TXTYPE Position     */
+#define PDMA_DSCT_CTL_TXTYPE_Msk        (0x1ul << PDMA_DSCT_CTL_TXTYPE_Pos)               /*!< PDMA_T::DSCT_CTL: TXTYPE Mask         */
+
+#define PDMA_DSCT_CTL_BURSIZE_Pos       (4)                                               /*!< PDMA_T::DSCT_CTL: BURSIZE Position    */
+#define PDMA_DSCT_CTL_BURSIZE_Msk       (0x7ul << PDMA_DSCT_CTL_BURSIZE_Pos)              /*!< PDMA_T::DSCT_CTL: BURSIZE Mask        */
+
+#define PDMA_DSCT_CTL_TBINTDIS_Pos      (7)                                               /*!< PDMA_T::DSCT_CTL: TBINTDIS Position      */
+#define PDMA_DSCT_CTL_TBINTDIS_Msk      (0x1ul << PDMA_DSCT_CTL_TBINTDIS_Pos)             /*!< PDMA_T::DSCT_CTL: TBINTDIS Mask          */
+
+#define PDMA_DSCT_CTL_SAINC_Pos         (8)                                               /*!< PDMA_T::DSCT_CTL: SAINC Position      */
+#define PDMA_DSCT_CTL_SAINC_Msk         (0x3ul << PDMA_DSCT_CTL_SAINC_Pos)                /*!< PDMA_T::DSCT_CTL: SAINC Mask          */
+
+#define PDMA_DSCT_CTL_DAINC_Pos         (10)                                              /*!< PDMA_T::DSCT_CTL: DAINC Position      */
+#define PDMA_DSCT_CTL_DAINC_Msk         (0x3ul << PDMA_DSCT_CTL_DAINC_Pos)                /*!< PDMA_T::DSCT_CTL: DAINC Mask          */
+
+#define PDMA_DSCT_CTL_TXWIDTH_Pos       (12)                                              /*!< PDMA_T::DSCT_CTL: TXWIDTH Position    */
+#define PDMA_DSCT_CTL_TXWIDTH_Msk       (0x3ul << PDMA_DSCT_CTL_TXWIDTH_Pos)              /*!< PDMA_T::DSCT_CTL: TXWIDTH Mask        */
+
+#define PDMA_DSCT_CTL_TXACK_Pos         (14)                                              /*!< PDMA_T::DSCT_CTL: TXACK Position      */
+#define PDMA_DSCT_CTL_TXACK_Msk         (0x1ul << PDMA_DSCT_CTL_TXACK_Pos)                /*!< PDMA_T::DSCT_CTL: TXACK Mask          */
+
+#define PDMA_DSCT_CTL_STRIDEEN_Pos     (15)                                               /*!< PDMA_T::DSCT_CTL: STRIDEEN Position  */
+#define PDMA_DSCT_CTL_STRIDEEN_Msk     (0x1ul << PDMA_DSCT_CTL_STRIDEEN_Pos)              /*!< PDMA_T::DSCT_CTL: STRIDEEN Mask      */
+
+#define PDMA_DSCT_CTL_TXCNT_Pos         (16)                                              /*!< PDMA_T::DSCT_CTL: TXCNT Position      */
+#define PDMA_DSCT_CTL_TXCNT_Msk         (0xfffful << PDMA_DSCT_CTL_TXCNT_Pos)             /*!< PDMA_T::DSCT_CTL: TXCNT Mask          */
+
+#define PDMA_DSCT_SA_SA_Pos             (0)                                               /*!< PDMA_T::DSCT_SA: SA Position          */
+#define PDMA_DSCT_SA_SA_Msk             (0xfffffffful << PDMA_DSCT_SA_SA_Pos)             /*!< PDMA_T::DSCT_SA: SA Mask              */
+
+#define PDMA_DSCT_DA_DA_Pos             (0)                                               /*!< PDMA_T::DSCT_DA: DA Position          */
+#define PDMA_DSCT_DA_DA_Msk             (0xfffffffful << PDMA_DSCT_DA_DA_Pos)             /*!< PDMA_T::DSCT_DA: DA Mask              */
+
+#define PDMA_DSCT_NEXT_NEXT_Pos         (0)                                               /*!< PDMA_T::DSCT_NEXT: NEXT Position      */
+#define PDMA_DSCT_NEXT_NEXT_Msk         (0xfffful << PDMA_DSCT_NEXT_NEXT_Pos)             /*!< PDMA_T::DSCT_NEXT: NEXT Mask          */
+
+#define PDMA_DSCT_NEXT_EXENEXT_Pos      (16)                                              /*!< PDMA_T::DSCT_FIRST: NEXT Position     */
+#define PDMA_DSCT_NEXT_EXENEXT_Msk      (0xfffful << PDMA_DSCT_NEXT_EXENEXT_Pos)           /*!< PDMA_T::DSCT_FIRST: NEXT Mask         */
+
+#define PDMA_CURSCAT_CURADDR_Pos        (0)                                               /*!< PDMA_T::CURSCAT: CURADDR Position     */
+#define PDMA_CURSCAT_CURADDR_Msk        (0xfffffffful << PDMA_CURSCAT_CURADDR_Pos)        /*!< PDMA_T::CURSCAT: CURADDR Mask         */
+
+#define PDMA_CHCTL_CHENn_Pos            (0)                                               /*!< PDMA_T::CHCTL: CHENn Position          */
+#define PDMA_CHCTL_CHENn_Msk            (0xfffful << PDMA_CHCTL_CHENn_Pos)                /*!< PDMA_T::CHCTL: CHENn Mask              */
+
+#define PDMA_PAUSE_PAUSEn_Pos           (0)                                               /*!< PDMA_T::PAUSE: PAUSEn Position           */
+#define PDMA_PAUSE_PAUSEn_Msk           (0xfffful << PDMA_PAUSE_PAUSEn_Pos)              /*!< PDMA_T::PAUSE: PAUSEn Mask               */
+
+#define PDMA_SWREQ_SWREQn_Pos            (0)                                               /*!< PDMA_T::SWREQ: SWREQn Position         */
+#define PDMA_SWREQ_SWREQn_Msk            (0xfffful << PDMA_SWREQ_SWREQn_Pos)               /*!< PDMA_T::SWREQ: SWREQn Mask             */
+
+#define PDMA_TRGSTS_REQSTSn_Pos          (0)                                               /*!< PDMA_T::TRGSTS: REQSTSn Position       */
+#define PDMA_TRGSTS_REQSTSn_Msk          (0xfffful << PDMA_TRGSTS_REQSTSn_Pos)             /*!< PDMA_T::TRGSTS: REQSTSn Mask           */
+
+#define PDMA_PRISET_FPRISETn_Pos         (0)                                               /*!< PDMA_T::PRISET: FPRISETn Position      */
+#define PDMA_PRISET_FPRISETn_Msk         (0xfffful << PDMA_PRISET_FPRISETn_Pos)            /*!< PDMA_T::PRISET: FPRISETn Mask          */
+
+#define PDMA_PRICLR_FPRICLRn_Pos         (0)                                               /*!< PDMA_T::PRICLR: FPRICLRn Position      */
+#define PDMA_PRICLR_FPRICLRn_Msk         (0xfffful << PDMA_PRICLR_FPRICLRn_Pos)            /*!< PDMA_T::PRICLR: FPRICLRn Mask          */
+
+#define PDMA_INTEN_INTENn_Pos            (0)                                               /*!< PDMA_T::INTEN: INTENn Position         */
+#define PDMA_INTEN_INTENn_Msk            (0xfffful << PDMA_INTEN_INTENn_Pos)               /*!< PDMA_T::INTEN: INTENn Mask             */
+
+#define PDMA_INTSTS_ABTIF_Pos            (0)                                               /*!< PDMA_T::INTSTS: ABTIF Position         */
+#define PDMA_INTSTS_ABTIF_Msk            (0x1ul << PDMA_INTSTS_ABTIF_Pos)                  /*!< PDMA_T::INTSTS: ABTIF Mask             */
+
+#define PDMA_INTSTS_TDIF_Pos             (1)                                               /*!< PDMA_T::INTSTS: TDIF Position          */
+#define PDMA_INTSTS_TDIF_Msk             (0x1ul << PDMA_INTSTS_TDIF_Pos)                   /*!< PDMA_T::INTSTS: TDIF Mask              */
+
+#define PDMA_INTSTS_ALIGNF_Pos           (2)                                               /*!< PDMA_T::INTSTS: ALIGNF Position        */
+#define PDMA_INTSTS_ALIGNF_Msk           (0x1ul << PDMA_INTSTS_ALIGNF_Pos)                 /*!< PDMA_T::INTSTS: ALIGNF Mask            */
+
+#define PDMA_INTSTS_REQTOF0_Pos          (8)                                               /*!< PDMA_T::INTSTS: REQTOF0 Position       */
+#define PDMA_INTSTS_REQTOF0_Msk          (0x1ul << PDMA_INTSTS_REQTOF0_Pos)                /*!< PDMA_T::INTSTS: REQTOF0 Mask           */
+#define PDMA_INTSTS_REQTOFn_Msk          (0x3FFul << PDMA_INTSTS_REQTOF0_Pos)              /*!< PDMA_T::INTSTS: REQTOFX Mask           */
+
+#define PDMA_INTSTS_REQTOF1_Pos          (9)                                               /*!< PDMA_T::INTSTS: REQTOF1 Position       */
+#define PDMA_INTSTS_REQTOF1_Msk          (0x1ul << PDMA_INTSTS_REQTOF1_Pos)                /*!< PDMA_T::INTSTS: REQTOF1 Mask           */
+
+#define PDMA_INTSTS_REQTOF2_Pos          (10)                                              /*!< PDMA_T::INTSTS: REQTOF2 Position       */
+#define PDMA_INTSTS_REQTOF2_Msk          (0x1ul << PDMA_INTSTS_REQTOF2_Pos)                /*!< PDMA_T::INTSTS: REQTOF2 Mask           */
+
+#define PDMA_INTSTS_REQTOF3_Pos          (11)                                              /*!< PDMA_T::INTSTS: REQTOF3 Position       */
+#define PDMA_INTSTS_REQTOF3_Msk          (0x1ul << PDMA_INTSTS_REQTOF3_Pos)                /*!< PDMA_T::INTSTS: REQTOF3 Mask           */
+
+#define PDMA_INTSTS_REQTOF4_Pos          (12)                                              /*!< PDMA_T::INTSTS: REQTOF4 Position       */
+#define PDMA_INTSTS_REQTOF4_Msk          (0x1ul << PDMA_INTSTS_REQTOF4_Pos)                /*!< PDMA_T::INTSTS: REQTOF4 Mask           */
+
+#define PDMA_INTSTS_REQTOF5_Pos          (13)                                              /*!< PDMA_T::INTSTS: REQTOF5 Position       */
+#define PDMA_INTSTS_REQTOF5_Msk          (0x1ul << PDMA_INTSTS_REQTOF5_Pos)                /*!< PDMA_T::INTSTS: REQTOF5 Mask           */
+
+#define PDMA_INTSTS_REQTOF6_Pos          (14)                                              /*!< PDMA_T::INTSTS: REQTOF6 Position       */
+#define PDMA_INTSTS_REQTOF6_Msk          (0x1ul << PDMA_INTSTS_REQTOF6_Pos)                /*!< PDMA_T::INTSTS: REQTOF6 Mask           */
+
+#define PDMA_INTSTS_REQTOF7_Pos          (15)                                              /*!< PDMA_T::INTSTS: REQTOF7 Position       */
+#define PDMA_INTSTS_REQTOF7_Msk          (0x1ul << PDMA_INTSTS_REQTOF7_Pos)                /*!< PDMA_T::INTSTS: REQTOF7 Mask           */
+
+#define PDMA_INTSTS_REQTOF8_Pos          (16)                                              /*!< PDMA_T::INTSTS: REQTOF8 Position       */
+#define PDMA_INTSTS_REQTOF8_Msk          (0x1ul << PDMA_INTSTS_REQTOF8_Pos)                /*!< PDMA_T::INTSTS: REQTOF8 Mask           */
+
+#define PDMA_INTSTS_REQTOF9_Pos          (17)                                              /*!< PDMA_T::INTSTS: REQTOF9 Position       */
+#define PDMA_INTSTS_REQTOF9_Msk          (0x1ul << PDMA_INTSTS_REQTOF9_Pos)                /*!< PDMA_T::INTSTS: REQTOF9 Mask           */
+
+#define PDMA_ABTSTS_ABTIF0_Pos           (0)                                               /*!< PDMA_T::ABTSTS: ABTIF0 Position        */
+#define PDMA_ABTSTS_ABTIF0_Msk           (0x1ul << PDMA_ABTSTS_ABTIF0_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF0 Mask            */
+
+#define PDMA_ABTSTS_ABTIF1_Pos           (1)                                               /*!< PDMA_T::ABTSTS: ABTIF1 Position        */
+#define PDMA_ABTSTS_ABTIF1_Msk           (0x1ul << PDMA_ABTSTS_ABTIF1_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF1 Mask            */
+
+#define PDMA_ABTSTS_ABTIF2_Pos           (2)                                               /*!< PDMA_T::ABTSTS: ABTIF2 Position        */
+#define PDMA_ABTSTS_ABTIF2_Msk           (0x1ul << PDMA_ABTSTS_ABTIF2_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF2 Mask            */
+
+#define PDMA_ABTSTS_ABTIF3_Pos           (3)                                               /*!< PDMA_T::ABTSTS: ABTIF3 Position        */
+#define PDMA_ABTSTS_ABTIF3_Msk           (0x1ul << PDMA_ABTSTS_ABTIF3_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF3 Mask            */
+
+#define PDMA_ABTSTS_ABTIF4_Pos           (4)                                               /*!< PDMA_T::ABTSTS: ABTIF4 Position        */
+#define PDMA_ABTSTS_ABTIF4_Msk           (0x1ul << PDMA_ABTSTS_ABTIF4_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF4 Mask            */
+
+#define PDMA_ABTSTS_ABTIF5_Pos           (5)                                               /*!< PDMA_T::ABTSTS: ABTIF5 Position        */
+#define PDMA_ABTSTS_ABTIF5_Msk           (0x1ul << PDMA_ABTSTS_ABTIF5_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF5 Mask            */
+
+#define PDMA_ABTSTS_ABTIF6_Pos           (6)                                               /*!< PDMA_T::ABTSTS: ABTIF6 Position        */
+#define PDMA_ABTSTS_ABTIF6_Msk           (0x1ul << PDMA_ABTSTS_ABTIF6_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF6 Mask            */
+
+#define PDMA_ABTSTS_ABTIF7_Pos           (7)                                               /*!< PDMA_T::ABTSTS: ABTIF7 Position        */
+#define PDMA_ABTSTS_ABTIF7_Msk           (0x1ul << PDMA_ABTSTS_ABTIF7_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF7 Mask            */
+
+#define PDMA_ABTSTS_ABTIF8_Pos           (8)                                               /*!< PDMA_T::ABTSTS: ABTIF8 Position        */
+#define PDMA_ABTSTS_ABTIF8_Msk           (0x1ul << PDMA_ABTSTS_ABTIF8_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF8 Mask            */
+
+#define PDMA_ABTSTS_ABTIF9_Pos           (9)                                               /*!< PDMA_T::ABTSTS: ABTIF9 Position        */
+#define PDMA_ABTSTS_ABTIF9_Msk           (0x1ul << PDMA_ABTSTS_ABTIF9_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF9 Mask            */
+
+#define PDMA_ABTSTS_ABTIF10_Pos           (10)                                               /*!< PDMA_T::ABTSTS: ABTIF10 Position        */
+#define PDMA_ABTSTS_ABTIF10_Msk           (0x1ul << PDMA_ABTSTS_ABTIF10_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF10 Mask            */
+
+#define PDMA_ABTSTS_ABTIF11_Pos           (11)                                               /*!< PDMA_T::ABTSTS: ABTIF11 Position        */
+#define PDMA_ABTSTS_ABTIF11_Msk           (0x1ul << PDMA_ABTSTS_ABTIF11_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF11 Mask            */
+
+#define PDMA_ABTSTS_ABTIF12_Pos           (12)                                               /*!< PDMA_T::ABTSTS: ABTIF12 Position        */
+#define PDMA_ABTSTS_ABTIF12_Msk           (0x1ul << PDMA_ABTSTS_ABTIF12_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF12 Mask            */
+
+#define PDMA_ABTSTS_ABTIF13_Pos           (13)                                               /*!< PDMA_T::ABTSTS: ABTIF13 Position        */
+#define PDMA_ABTSTS_ABTIF13_Msk           (0x1ul << PDMA_ABTSTS_ABTIF13_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF13 Mask            */
+
+#define PDMA_ABTSTS_ABTIF14_Pos           (14)                                               /*!< PDMA_T::ABTSTS: ABTIF14 Position        */
+#define PDMA_ABTSTS_ABTIF14_Msk           (0x1ul << PDMA_ABTSTS_ABTIF14_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF14 Mask            */
+
+#define PDMA_ABTSTS_ABTIF15_Pos           (15)                                               /*!< PDMA_T::ABTSTS: ABTIF15 Position        */
+#define PDMA_ABTSTS_ABTIF15_Msk           (0x1ul << PDMA_ABTSTS_ABTIF15_Pos)                 /*!< PDMA_T::ABTSTS: ABTIF15 Mask            */
+
+#define PDMA_TDSTS_TDIF0_Pos           (0)                                               /*!< PDMA_T::TDSTS: TDIF0 Position        */
+#define PDMA_TDSTS_TDIF0_Msk           (0x1ul << PDMA_TDSTS_TDIF0_Pos)                   /*!< PDMA_T::TDSTS: TDIF0 Mask            */
+
+#define PDMA_TDSTS_TDIF1_Pos           (1)                                               /*!< PDMA_T::TDSTS: TDIF1 Position        */
+#define PDMA_TDSTS_TDIF1_Msk           (0x1ul << PDMA_TDSTS_TDIF1_Pos)                   /*!< PDMA_T::TDSTS: TDIF1 Mask            */
+
+#define PDMA_TDSTS_TDIF2_Pos           (2)                                               /*!< PDMA_T::TDSTS: TDIF2 Position        */
+#define PDMA_TDSTS_TDIF2_Msk           (0x1ul << PDMA_TDSTS_TDIF2_Pos)                   /*!< PDMA_T::TDSTS: TDIF2 Mask            */
+
+#define PDMA_TDSTS_TDIF3_Pos           (3)                                               /*!< PDMA_T::TDSTS: TDIF3 Position        */
+#define PDMA_TDSTS_TDIF3_Msk           (0x1ul << PDMA_TDSTS_TDIF3_Pos)                   /*!< PDMA_T::TDSTS: TDIF3 Mask            */
+
+#define PDMA_TDSTS_TDIF4_Pos           (4)                                               /*!< PDMA_T::TDSTS: TDIF4 Position        */
+#define PDMA_TDSTS_TDIF4_Msk           (0x1ul << PDMA_TDSTS_TDIF4_Pos)                   /*!< PDMA_T::TDSTS: TDIF4 Mask            */
+
+#define PDMA_TDSTS_TDIF5_Pos           (5)                                               /*!< PDMA_T::TDSTS: TDIF5 Position        */
+#define PDMA_TDSTS_TDIF5_Msk           (0x1ul << PDMA_TDSTS_TDIF5_Pos)                   /*!< PDMA_T::TDSTS: TDIF5 Mask            */
+
+#define PDMA_TDSTS_TDIF6_Pos           (6)                                               /*!< PDMA_T::TDSTS: TDIF6 Position        */
+#define PDMA_TDSTS_TDIF6_Msk           (0x1ul << PDMA_TDSTS_TDIF6_Pos)                   /*!< PDMA_T::TDSTS: TDIF6 Mask            */
+
+#define PDMA_TDSTS_TDIF7_Pos           (7)                                               /*!< PDMA_T::TDSTS: TDIF7 Position        */
+#define PDMA_TDSTS_TDIF7_Msk           (0x1ul << PDMA_TDSTS_TDIF7_Pos)                   /*!< PDMA_T::TDSTS: TDIF7 Mask            */
+
+#define PDMA_TDSTS_TDIF8_Pos           (8)                                               /*!< PDMA_T::TDSTS: TDIF8 Position        */
+#define PDMA_TDSTS_TDIF8_Msk           (0x1ul << PDMA_TDSTS_TDIF8_Pos)                   /*!< PDMA_T::TDSTS: TDIF8 Mask            */
+
+#define PDMA_TDSTS_TDIF9_Pos           (9)                                               /*!< PDMA_T::TDSTS: TDIF9 Position        */
+#define PDMA_TDSTS_TDIF9_Msk           (0x1ul << PDMA_TDSTS_TDIF9_Pos)                   /*!< PDMA_T::TDSTS: TDIF9 Mask            */
+
+#define PDMA_TDSTS_TDIF10_Pos           (10)                                               /*!< PDMA_T::TDSTS: TDIF10 Position        */
+#define PDMA_TDSTS_TDIF10_Msk           (0x1ul << PDMA_TDSTS_TDIF10_Pos)                   /*!< PDMA_T::TDSTS: TDIF10 Mask            */
+
+#define PDMA_TDSTS_TDIF11_Pos           (11)                                               /*!< PDMA_T::TDSTS: TDIF11 Position        */
+#define PDMA_TDSTS_TDIF11_Msk           (0x1ul << PDMA_TDSTS_TDIF11_Pos)                   /*!< PDMA_T::TDSTS: TDIF11 Mask            */
+
+#define PDMA_TDSTS_TDIF12_Pos           (12)                                               /*!< PDMA_T::TDSTS: TDIF12 Position        */
+#define PDMA_TDSTS_TDIF12_Msk           (0x1ul << PDMA_TDSTS_TDIF12_Pos)                   /*!< PDMA_T::TDSTS: TDIF12 Mask            */
+
+#define PDMA_TDSTS_TDIF13_Pos           (13)                                               /*!< PDMA_T::TDSTS: TDIF13 Position        */
+#define PDMA_TDSTS_TDIF13_Msk           (0x1ul << PDMA_TDSTS_TDIF13_Pos)                   /*!< PDMA_T::TDSTS: TDIF13 Mask            */
+
+#define PDMA_TDSTS_TDIF14_Pos           (14)                                               /*!< PDMA_T::TDSTS: TDIF14 Position        */
+#define PDMA_TDSTS_TDIF14_Msk           (0x1ul << PDMA_TDSTS_TDIF14_Pos)                   /*!< PDMA_T::TDSTS: TDIF14 Mask            */
+
+#define PDMA_TDSTS_TDIF15_Pos           (15)                                               /*!< PDMA_T::TDSTS: TDIF15 Position        */
+#define PDMA_TDSTS_TDIF15_Msk           (0x1ul << PDMA_TDSTS_TDIF15_Pos)                   /*!< PDMA_T::TDSTS: TDIF15 Mask            */
+
+#define PDMA_ALIGN_ALIGNn_Pos           (0)                                                /*!< PDMA_T::ALIGN: ALIGNn Position        */
+#define PDMA_ALIGN_ALIGNn_Msk           (0xfffful << PDMA_ALIGN_ALIGNn_Pos)                /*!< PDMA_T::ALIGN: ALIGNn Mask            */
+
+#define PDMA_TACTSTS_TXACTFn_Pos         (0)                                               /*!< PDMA_T::TACTSTS: TXACTFn Position      */
+#define PDMA_TACTSTS_TXACTFn_Msk         (0xfffful << PDMA_TACTSTS_TXACTFn_Pos)            /*!< PDMA_T::TACTSTS: TXACTFn Mask          */
+
+#define PDMA_TOUTPSC_TOUTPSC0_Pos        (0)                                               /*!< PDMA_T::TOUTPSC: TOUTPSC0 Position     */
+#define PDMA_TOUTPSC_TOUTPSC0_Msk        (0x7ul << PDMA_TOUTPSC_TOUTPSC0_Pos)              /*!< PDMA_T::TOUTPSC: TOUTPSC0 Mask         */
+
+#define PDMA_TOUTPSC_TOUTPSC1_Pos        (4)                                               /*!< PDMA_T::TOUTPSC: TOUTPSC1 Position     */
+#define PDMA_TOUTPSC_TOUTPSC1_Msk        (0x7ul << PDMA_TOUTPSC_TOUTPSC1_Pos)              /*!< PDMA_T::TOUTPSC: TOUTPSC1 Mask         */
+
+#define PDMA_TOUTEN_TOUTENn_Pos          (0)                                               /*!< PDMA_T::TOUTEN: TOUTENn Position       */
+#define PDMA_TOUTEN_TOUTENn_Msk          (0x3ul << PDMA_TOUTEN_TOUTENn_Pos)                /*!< PDMA_T::TOUTEN: TOUTENn Mask           */
+
+#define PDMA_TOUTIEN_TOUTIENn_Pos        (0)                                               /*!< PDMA_T::TOUTIEN: TOUTIENn Position     */
+#define PDMA_TOUTIEN_TOUTIENn_Msk        (0x3ul << PDMA_TOUTIEN_TOUTIENn_Pos)              /*!< PDMA_T::TOUTIEN: TOUTIENn Mask         */
+
+#define PDMA_SCATBA_SCATBA_Pos           (16)                                              /*!< PDMA_T::SCATBA: SCATBA Position        */
+#define PDMA_SCATBA_SCATBA_Msk           (0xfffful << PDMA_SCATBA_SCATBA_Pos)              /*!< PDMA_T::SCATBA: SCATBA Mask            */
+
+#define PDMA_TOC0_1_TOC0_Pos             (0)                                               /*!< PDMA_T::TOC0_1: TOC0 Position          */
+#define PDMA_TOC0_1_TOC0_Msk             (0xfffful << PDMA_TOC0_1_TOC0_Pos)                /*!< PDMA_T::TOC0_1: TOC0 Mask              */
+
+#define PDMA_TOC0_1_TOC1_Pos             (16)                                              /*!< PDMA_T::TOC0_1: TOC1 Position          */
+#define PDMA_TOC0_1_TOC1_Msk             (0xfffful << PDMA_TOC0_1_TOC1_Pos)                /*!< PDMA_T::TOC0_1: TOC1 Mask              */
+
+#define PDMA_TOC2_3_TOC2_Pos             (0)                                               /*!< PDMA_T::TOC2_3: TOC2 Position          */
+#define PDMA_TOC2_3_TOC2_Msk             (0xfffful << PDMA_TOC2_3_TOC2_Pos)                /*!< PDMA_T::TOC2_3: TOC2 Mask              */
+
+#define PDMA_TOC2_3_TOC3_Pos             (16)                                              /*!< PDMA_T::TOC2_3: TOC3 Position          */
+#define PDMA_TOC2_3_TOC3_Msk             (0xfffful << PDMA_TOC2_3_TOC3_Pos)                /*!< PDMA_T::TOC2_3: TOC3 Mask              */
+
+#define PDMA_TOC4_5_TOC4_Pos             (0)                                               /*!< PDMA_T::TOC4_5: TOC4 Position          */
+#define PDMA_TOC4_5_TOC4_Msk             (0xfffful << PDMA_TOC4_5_TOC4_Pos)                /*!< PDMA_T::TOC4_5: TOC4 Mask              */
+
+#define PDMA_TOC4_5_TOC5_Pos             (16)                                              /*!< PDMA_T::TOC4_5: TOC5 Position          */
+#define PDMA_TOC4_5_TOC5_Msk             (0xfffful << PDMA_TOC4_5_TOC5_Pos)                /*!< PDMA_T::TOC4_5: TOC5 Mask              */
+
+#define PDMA_TOC6_7_TOC6_Pos             (0)                                               /*!< PDMA_T::TOC6_7: TOC6 Position          */
+#define PDMA_TOC6_7_TOC6_Msk             (0xfffful << PDMA_TOC6_7_TOC6_Pos)                /*!< PDMA_T::TOC6_7: TOC6 Mask              */
+
+#define PDMA_TOC6_7_TOC7_Pos             (16)                                              /*!< PDMA_T::TOC6_7: TOC7 Position          */
+#define PDMA_TOC6_7_TOC7_Msk             (0xfffful << PDMA_TOC6_7_TOC7_Pos)                /*!< PDMA_T::TOC6_7: TOC7 Mask              */
+
+#define PDMA_TOC8_9_TOC8_Pos             (0)                                               /*!< PDMA_T::TOC8_9: TOC8 Position          */
+#define PDMA_TOC8_9_TOC8_Msk             (0xfffful << PDMA_TOC8_9_TOC8_Pos)                /*!< PDMA_T::TOC8_9: TOC8 Mask              */
+
+#define PDMA_TOC8_9_TOC9_Pos             (16)                                              /*!< PDMA_T::TOC8_9: TOC9 Position          */
+#define PDMA_TOC8_9_TOC9_Msk             (0xfffful << PDMA_TOC8_9_TOC9_Pos)                /*!< PDMA_T::TOC8_9: TOC9 Mask              */
+
+#define PDMA_CHRST_CHnRST_Pos            (0)                                               /*!< PDMA_T::CHRST: CHnRST Position         */
+#define PDMA_CHRST_CHnRST_Msk            (0xfffful << PDMA_CHRST_CHnRST_Pos)               /*!< PDMA_T::CHRST: CHnRST Mask             */
+
+#define PDMA_REQSEL0_3_REQSRC0_Pos       (0)                                               /*!< PDMA_T::REQSEL0_3: REQSRC0 Position    */
+#define PDMA_REQSEL0_3_REQSRC0_Msk       (0x7ful << PDMA_REQSEL0_3_REQSRC0_Pos)            /*!< PDMA_T::REQSEL0_3: REQSRC0 Mask        */
+
+#define PDMA_REQSEL0_3_REQSRC1_Pos       (8)                                               /*!< PDMA_T::REQSEL0_3: REQSRC1 Position    */
+#define PDMA_REQSEL0_3_REQSRC1_Msk       (0x7ful << PDMA_REQSEL0_3_REQSRC1_Pos)            /*!< PDMA_T::REQSEL0_3: REQSRC1 Mask        */
+
+#define PDMA_REQSEL0_3_REQSRC2_Pos       (16)                                              /*!< PDMA_T::REQSEL0_3: REQSRC2 Position    */
+#define PDMA_REQSEL0_3_REQSRC2_Msk       (0x7ful << PDMA_REQSEL0_3_REQSRC2_Pos)            /*!< PDMA_T::REQSEL0_3: REQSRC2 Mask        */
+
+#define PDMA_REQSEL0_3_REQSRC3_Pos       (24)                                              /*!< PDMA_T::REQSEL0_3: REQSRC3 Position    */
+#define PDMA_REQSEL0_3_REQSRC3_Msk       (0x7ful << PDMA_REQSEL0_3_REQSRC3_Pos)            /*!< PDMA_T::REQSEL0_3: REQSRC3 Mask        */
+
+#define PDMA_REQSEL4_7_REQSRC4_Pos       (0)                                               /*!< PDMA_T::REQSEL4_7: REQSRC4 Position    */
+#define PDMA_REQSEL4_7_REQSRC4_Msk       (0x7ful << PDMA_REQSEL4_7_REQSRC4_Pos)            /*!< PDMA_T::REQSEL4_7: REQSRC4 Mask        */
+
+#define PDMA_REQSEL4_7_REQSRC5_Pos       (8)                                               /*!< PDMA_T::REQSEL4_7: REQSRC5 Position    */
+#define PDMA_REQSEL4_7_REQSRC5_Msk       (0x7ful << PDMA_REQSEL4_7_REQSRC5_Pos)            /*!< PDMA_T::REQSEL4_7: REQSRC5 Mask        */
+
+#define PDMA_REQSEL4_7_REQSRC6_Pos       (16)                                              /*!< PDMA_T::REQSEL4_7: REQSRC6 Position    */
+#define PDMA_REQSEL4_7_REQSRC6_Msk       (0x7ful << PDMA_REQSEL4_7_REQSRC6_Pos)            /*!< PDMA_T::REQSEL4_7: REQSRC6 Mask        */
+
+#define PDMA_REQSEL4_7_REQSRC7_Pos       (24)                                              /*!< PDMA_T::REQSEL4_7: REQSRC7 Position    */
+#define PDMA_REQSEL4_7_REQSRC7_Msk       (0x7ful << PDMA_REQSEL4_7_REQSRC7_Pos)            /*!< PDMA_T::REQSEL4_7: REQSRC7 Mask        */
+
+#define PDMA_REQSEL8_11_REQSRC8_Pos      (0)                                               /*!< PDMA_T::REQSEL8_11: REQSRC8 Position   */
+#define PDMA_REQSEL8_11_REQSRC8_Msk      (0x7ful << PDMA_REQSEL8_11_REQSRC8_Pos)           /*!< PDMA_T::REQSEL8_11: REQSRC8 Mask       */
+
+#define PDMA_REQSEL8_11_REQSRC9_Pos      (8)                                               /*!< PDMA_T::REQSEL8_11: REQSRC9 Position   */
+#define PDMA_REQSEL8_11_REQSRC9_Msk      (0x7ful << PDMA_REQSEL8_11_REQSRC9_Pos)           /*!< PDMA_T::REQSEL8_11: REQSRC9 Mask       */
+
+#define PDMA_REQSEL8_11_REQSRC10_Pos     (16)                                              /*!< PDMA_T::REQSEL8_11: REQSRC10 Position  */
+#define PDMA_REQSEL8_11_REQSRC10_Msk     (0x7ful << PDMA_REQSEL8_11_REQSRC10_Pos)          /*!< PDMA_T::REQSEL8_11: REQSRC10 Mask      */
+
+#define PDMA_REQSEL8_11_REQSRC11_Pos     (24)                                              /*!< PDMA_T::REQSEL8_11: REQSRC11 Position  */
+#define PDMA_REQSEL8_11_REQSRC11_Msk     (0x7ful << PDMA_REQSEL8_11_REQSRC11_Pos)          /*!< PDMA_T::REQSEL8_11: REQSRC11 Mask      */
+
+#define PDMA_REQSEL12_15_REQSRC12_Pos    (0)                                               /*!< PDMA_T::REQSEL12_15: REQSRC12 Position */
+#define PDMA_REQSEL12_15_REQSRC12_Msk    (0x7ful << PDMA_REQSEL12_15_REQSRC12_Pos)         /*!< PDMA_T::REQSEL12_15: REQSRC12 Mask     */
+
+#define PDMA_REQSEL12_15_REQSRC13_Pos    (8)                                               /*!< PDMA_T::REQSEL12_15: REQSRC13 Position */
+#define PDMA_REQSEL12_15_REQSRC13_Msk    (0x7ful << PDMA_REQSEL12_15_REQSRC13_Pos)         /*!< PDMA_T::REQSEL12_15: REQSRC13 Mask     */
+
+#define PDMA_REQSEL12_15_REQSRC14_Pos    (16)                                              /*!< PDMA_T::REQSEL12_15: REQSRC14 Position */
+#define PDMA_REQSEL12_15_REQSRC14_Msk    (0x7ful << PDMA_REQSEL12_15_REQSRC14_Pos)         /*!< PDMA_T::REQSEL12_15: REQSRC14 Mask     */
+
+#define PDMA_REQSEL12_15_REQSRC15_Pos    (24)                                              /*!< PDMA_T::REQSEL12_15: REQSRC15 Position */
+#define PDMA_REQSEL12_15_REQSRC15_Msk    (0x7ful << PDMA_REQSEL12_15_REQSRC15_Pos)         /*!< PDMA_T::REQSEL12_15: REQSRC15 Mask     */
+
+#define PDMA_STCRn_STC_Pos               (0)                                               /*!< PDMA_T::STCRn: STC Position            */
+#define PDMA_STCRn_STC_Msk               (0xfffful << PDMA_STCRn_STC_Pos)                  /*!< PDMA_T::STCRn: STC Mask                */
+
+#define PDMA_ASOCRn_SASOL_Pos            (0)                                               /*!< PDMA_T::ASOCRn: SASOL Position         */
+#define PDMA_ASOCRn_SASOL_Msk            (0xfffful << PDMA_ASOCRn_SASOL_Pos)               /*!< PDMA_T::ASOCRn: SASOL Mask             */
+
+#define PDMA_ASOCRn_DASOL_Pos            (16)                                              /*!< PDMA_T::ASOCRn: DASOL Position         */
+#define PDMA_ASOCRn_DASOL_Msk            (0xfffful << PDMA_ASOCRn_DASOL_Pos)               /*!< PDMA_T::ASOCRn: DASOL Mask             */
+
+/**@}*/ /* PDMA_CONST */
+/**@}*/ /* end of PDMA register group */
+/**@}*/ /* end of REGISTER group */
+
+#define PDMA0                  ((PDMA_T *)   PDMA0_BA)
+#define PDMA1                  ((PDMA_T *)   PDMA1_BA)
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup PDMA_Driver PDMA Driver
+  @{
+*/
+
+/** @addtogroup PDMA_EXPORTED_CONSTANTS PDMA Exported Constants
+  @{
+*/
+#define PDMA_CH_MAX    10UL   /*!< Specify Maximum Channels of PDMA  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Operation Mode Constant Definitions                                                                    */
+/*---------------------------------------------------------------------------------------------------------*/
+#define PDMA_OP_STOP        0x00000000UL            /*!<DMA Stop Mode  \hideinitializer */
+#define PDMA_OP_BASIC       0x00000001UL            /*!<DMA Basic Mode  \hideinitializer */
+#define PDMA_OP_SCATTER     0x00000002UL            /*!<DMA Scatter-gather Mode  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Data Width Constant Definitions                                                                        */
+/*---------------------------------------------------------------------------------------------------------*/
+#define PDMA_WIDTH_8        0x00000000UL            /*!<DMA Transfer Width 8-bit  \hideinitializer */
+#define PDMA_WIDTH_16       0x00001000UL            /*!<DMA Transfer Width 16-bit  \hideinitializer */
+#define PDMA_WIDTH_32       0x00002000UL            /*!<DMA Transfer Width 32-bit  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Address Attribute Constant Definitions                                                                 */
+/*---------------------------------------------------------------------------------------------------------*/
+#define PDMA_SAR_INC        0x00000000UL            /*!<DMA SAR increment  \hideinitializer */
+#define PDMA_SAR_FIX        0x00000300UL            /*!<DMA SAR fix address  \hideinitializer */
+#define PDMA_DAR_INC        0x00000000UL            /*!<DMA DAR increment  \hideinitializer */
+#define PDMA_DAR_FIX        0x00000C00UL            /*!<DMA DAR fix address  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Burst Mode Constant Definitions                                                                        */
+/*---------------------------------------------------------------------------------------------------------*/
+#define PDMA_REQ_SINGLE     0x00000004UL            /*!<DMA Single Request  \hideinitializer */
+#define PDMA_REQ_BURST      0x00000000UL            /*!<DMA Burst Request  \hideinitializer */
+
+#define PDMA_BURST_128      0x00000000UL            /*!<DMA Burst 128 Transfers  \hideinitializer */
+#define PDMA_BURST_64       0x00000010UL            /*!<DMA Burst 64 Transfers  \hideinitializer */
+#define PDMA_BURST_32       0x00000020UL            /*!<DMA Burst 32 Transfers  \hideinitializer */
+#define PDMA_BURST_16       0x00000030UL            /*!<DMA Burst 16 Transfers  \hideinitializer */
+#define PDMA_BURST_8        0x00000040UL            /*!<DMA Burst 8 Transfers  \hideinitializer */
+#define PDMA_BURST_4        0x00000050UL            /*!<DMA Burst 4 Transfers  \hideinitializer */
+#define PDMA_BURST_2        0x00000060UL            /*!<DMA Burst 2 Transfers  \hideinitializer */
+#define PDMA_BURST_1        0x00000070UL            /*!<DMA Burst 1 Transfers  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Table Interrupt Disable Constant Definitions                                                           */
+/*---------------------------------------------------------------------------------------------------------*/
+#define PDMA_TBINTDIS_ENABLE  (0x0UL<<PDMA_DSCT_CTL_TBINTDIS_Pos)  /*!<DMA Table Interrupt Enabled   \hideinitializer */
+#define PDMA_TBINTDIS_DISABLE (0x1UL<<PDMA_DSCT_CTL_TBINTDIS_Pos)  /*!<DMA Table Interrupt Disabled  \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Peripheral Transfer Mode Constant Definitions                                                          */
+/*---------------------------------------------------------------------------------------------------------*/
+#define PDMA_MEM          0UL  /*!<DMA Connect to PDMA_MEM \hideinitializer */
+#define PDMA_UART0_TX     4UL  /*!<DMA Connect to UART0_TX \hideinitializer */
+#define PDMA_UART0_RX     5UL  /*!<DMA Connect to UART0_RX \hideinitializer */
+#define PDMA_UART1_TX     6UL  /*!<DMA Connect to UART1_TX \hideinitializer */
+#define PDMA_UART1_RX     7UL  /*!<DMA Connect to UART1_RX \hideinitializer */
+#define PDMA_UART2_TX     8UL  /*!<DMA Connect to UART2_TX \hideinitializer */
+#define PDMA_UART2_RX     9UL  /*!<DMA Connect to UART2_RX \hideinitializer */
+#define PDMA_UART3_TX    10UL  /*!<DMA Connect to UART3_TX \hideinitializer */
+#define PDMA_UART3_RX    11UL  /*!<DMA Connect to UART3_RX \hideinitializer */
+#define PDMA_UART4_TX    12UL  /*!<DMA Connect to UART4_TX \hideinitializer */
+#define PDMA_UART4_RX    13UL  /*!<DMA Connect to UART4_RX \hideinitializer */
+#define PDMA_UART5_TX    14UL  /*!<DMA Connect to UART5_TX \hideinitializer */
+#define PDMA_UART5_RX    15UL  /*!<DMA Connect to UART5_RX \hideinitializer */
+#define PDMA_UART6_TX    16UL  /*!<DMA Connect to UART6_TX \hideinitializer */
+#define PDMA_UART6_RX    17UL  /*!<DMA Connect to UART6_RX \hideinitializer */
+#define PDMA_UART7_TX    18UL  /*!<DMA Connect to UART7_TX \hideinitializer */
+#define PDMA_UART7_RX    19UL  /*!<DMA Connect to UART7_RX \hideinitializer */
+#define PDMA_QSPI0_TX    20UL  /*!<DMA Connect to QSPI0_TX \hideinitializer */
+#define PDMA_QSPI0_RX    21UL  /*!<DMA Connect to QSPI0_RX \hideinitializer */
+#define PDMA_SPI0_TX     22UL  /*!<DMA Connect to SPI0_TX  \hideinitializer */
+#define PDMA_SPI0_RX     23UL  /*!<DMA Connect to SPI0_RX  \hideinitializer */
+#define PDMA_SPI1_TX     24UL  /*!<DMA Connect to SPI1_TX  \hideinitializer */
+#define PDMA_SPI1_RX     25UL  /*!<DMA Connect to SPI1_RX  \hideinitializer */
+#define PDMA_UART8_TX    26UL  /*!<DMA Connect to UART8_TX \hideinitializer */
+#define PDMA_UART8_RX    27UL  /*!<DMA Connect to UART8_RX \hideinitializer */
+#define PDMA_UART9_TX    28UL  /*!<DMA Connect to UART9_TX \hideinitializer */
+#define PDMA_UART9_RX    29UL  /*!<DMA Connect to UART9_RX \hideinitializer */
+#define PDMA_I2C0_TX     38UL  /*!<DMA Connect to I2C0_TX  \hideinitializer */
+#define PDMA_I2C0_RX     39UL  /*!<DMA Connect to I2C0_RX  \hideinitializer */
+#define PDMA_I2C1_TX     40UL  /*!<DMA Connect to I2C1_TX  \hideinitializer */
+#define PDMA_I2C1_RX     41UL  /*!<DMA Connect to I2C1_RX  \hideinitializer */
+#define PDMA_I2C2_TX     42UL  /*!<DMA Connect to I2C2_TX  \hideinitializer */
+#define PDMA_I2C2_RX     43UL  /*!<DMA Connect to I2C2_RX  \hideinitializer */
+#define PDMA_I2C3_TX     44UL  /*!<DMA Connect to I2C3_TX  \hideinitializer */
+#define PDMA_I2C3_RX     45UL  /*!<DMA Connect to I2C3_RX  \hideinitializer */
+#define PDMA_TIMER0      46UL  /*!<DMA Connect to TIMER0   \hideinitializer */
+#define PDMA_TIMER1      47UL  /*!<DMA Connect to TIMER1   \hideinitializer */
+#define PDMA_TIMER2      48UL  /*!<DMA Connect to TIMER2   \hideinitializer */
+#define PDMA_TIMER3      49UL  /*!<DMA Connect to TIMER3   \hideinitializer */
+#define PDMA_TIMER4      50UL  /*!<DMA Connect to TIMER4   \hideinitializer */
+#define PDMA_TIMER5      51UL  /*!<DMA Connect to TIMER5   \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  Interrupt Type Constant Definitions                                                                    */
+/*---------------------------------------------------------------------------------------------------------*/
+#define PDMA_INT_TRANS_DONE 0x00000000UL            /*!<Transfer Done Interrupt  \hideinitializer */
+#define PDMA_INT_TEMPTY     0x00000001UL            /*!<Table Empty Interrupt  \hideinitializer */
+#define PDMA_INT_TIMEOUT    0x00000002UL            /*!<Timeout Interrupt \hideinitializer */
+
+
+/*@}*/ /* end of group PDMA_EXPORTED_CONSTANTS */
+
+/** @addtogroup PDMA_EXPORTED_FUNCTIONS PDMA Exported Functions
+  @{
+*/
+
+/**
+ * @brief       Get PDMA Interrupt Status
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @return      None
+ *
+ * @details     This macro gets the interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_GET_INT_STATUS(pdma) ((uint32_t)(pdma->INTSTS))
+
+/**
+ * @brief       Get Transfer Done Interrupt Status
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @return      None
+ *
+ * @details     Get the transfer done Interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_GET_TD_STS(pdma) ((uint32_t)(pdma->TDSTS))
+
+/**
+ * @brief       Clear Transfer Done Interrupt Status
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @param[in]   u32Mask     The channel mask
+ *
+ * @return      None
+ *
+ * @details     Clear the transfer done Interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_CLR_TD_FLAG(pdma,u32Mask) ((uint32_t)(pdma->TDSTS = (u32Mask)))
+
+/**
+ * @brief       Get Target Abort Interrupt Status
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @return      None
+ *
+ * @details     Get the target abort Interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_GET_ABORT_STS(pdma) ((uint32_t)(pdma->ABTSTS))
+
+/**
+ * @brief       Clear Target Abort Interrupt Status
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @param[in]   u32Mask     The channel mask
+ *
+ * @return      None
+ *
+ * @details     Clear the target abort Interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_CLR_ABORT_FLAG(pdma,u32Mask) ((uint32_t)(pdma->ABTSTS = (u32Mask)))
+
+/**
+ * @brief       Get Alignment Interrupt Status
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @return      None
+ *
+ * @details     Get Alignment Interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_GET_ALIGN_STS(pdma) ((uint32_t)(PDMA->ALIGN))
+
+/**
+ * @brief       Clear Alignment Interrupt Status
+  *
+ * @param[in]   pdma        The pointer of the specified PDMA module
+ * @param[in]   u32Mask     The channel mask
+ *
+ * @return      None
+ *
+ * @details     Clear the Alignment Interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_CLR_ALIGN_FLAG(pdma,u32Mask) ((uint32_t)(pdma->ALIGN = (u32Mask)))
+
+/**
+ * @brief       Clear Timeout Interrupt Status
+  *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ * @param[in]   u32Ch     The selected channel
+ *
+ * @return      None
+ *
+ * @details     Clear the selected channel timeout interrupt status.
+ * \hideinitializer
+ */
+#define PDMA_CLR_TMOUT_FLAG(pdma,u32Ch) ((uint32_t)(pdma->INTSTS = (1 << ((u32Ch) + 8))))
+
+/**
+ * @brief       Check Channel Status
+  *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ * @param[in]   u32Ch     The selected channel
+ *
+ * @retval      0 Idle state
+ * @retval      1 Busy state
+ *
+ * @details     Check the selected channel is busy or not.
+ * \hideinitializer
+ */
+#define PDMA_IS_CH_BUSY(pdma,u32Ch) ((uint32_t)(pdma->TRGSTS & (1 << (u32Ch)))? 1 : 0)
+
+/**
+ * @brief       Set Source Address
+  *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ * @param[in]   u32Ch     The selected channel
+ * @param[in]   u32Addr   The selected address
+ *
+ * @return      None
+ *
+ * @details     This macro set the selected channel source address.
+ * \hideinitializer
+ */
+#define PDMA_SET_SRC_ADDR(pdma,u32Ch, u32Addr) ((uint32_t)(pdma->DSCT[(u32Ch)].SA = (u32Addr)))
+
+/**
+ * @brief       Set Destination Address
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ * @param[in]   u32Ch     The selected channel
+ * @param[in]   u32Addr   The selected address
+ *
+ * @return      None
+ *
+ * @details     This macro set the selected channel destination address.
+ * \hideinitializer
+ */
+#define PDMA_SET_DST_ADDR(pdma,u32Ch, u32Addr) ((uint32_t)(pdma->DSCT[(u32Ch)].DA = (u32Addr)))
+
+/**
+ * @brief       Set Transfer Count
+  *
+ * @param[in]   pdma           The pointer of the specified PDMA module
+ * @param[in]   u32Ch          The selected channel
+ * @param[in]   u32TransCount  Transfer Count
+ *
+ * @return      None
+ *
+ * @details     This macro set the selected channel transfer count.
+ * \hideinitializer
+ */
+#define PDMA_SET_TRANS_CNT(pdma,u32Ch, u32TransCount) ((uint32_t)(pdma->DSCT[(u32Ch)].CTL=(pdma->DSCT[(u32Ch)].CTL&~PDMA_DSCT_CTL_TXCNT_Msk)|(((u32TransCount)-1) << PDMA_DSCT_CTL_TXCNT_Pos)))
+
+/**
+ * @brief       Set Scatter-gather descriptor Address
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ * @param[in]   u32Ch     The selected channel
+ * @param[in]   u32Addr   The descriptor address
+ *
+ * @return      None
+ *
+ * @details     This macro set the selected channel scatter-gather descriptor address.
+ * \hideinitializer
+ */
+#define PDMA_SET_SCATTER_DESC(pdma,u32Ch, u32Addr) ((uint32_t)(pdma->DSCT[(u32Ch)].NEXT = (u32Addr) - (pdma->SCATBA)))
+
+/**
+ * @brief       Stop the channel
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @param[in]   u32Ch     The selected channel
+ *
+ * @return      None
+ *
+ * @details     This macro stop the selected channel.
+ * \hideinitializer
+ */
+#define PDMA_STOP(pdma,u32Ch) ((uint32_t)(pdma->PAUSE = (1 << (u32Ch))))
+
+/**
+ * @brief       Pause the channel
+ *
+ * @param[in]   pdma      The pointer of the specified PDMA module
+ *
+ * @param[in]   u32Ch     The selected channel
+ *
+ * @return      None
+ *
+ * @details     This macro pause the selected channel.
+ * \hideinitializer
+ */
+#define PDMA_PAUSE(pdma,u32Ch) ((uint32_t)(pdma->PAUSE = (1 << (u32Ch))))
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* Define PDMA functions prototype                                                                          */
+/*---------------------------------------------------------------------------------------------------------*/
+void PDMA_Open(PDMA_T *pdma, uint32_t u32Mask);
+void PDMA_Close(PDMA_T *pdma);
+void PDMA_SetTransferCnt(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32Width, uint32_t u32TransCount);
+void PDMA_SetTransferAddr(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32SrcAddr, uint32_t u32SrcCtrl, uint32_t u32DstAddr, uint32_t u32DstCtrl);
+void PDMA_SetTransferMode(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32Peripheral, uint32_t u32ScatterEn, uint32_t u32DescAddr);
+void PDMA_SetBurstType(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32BurstType, uint32_t u32BurstSize);
+void PDMA_EnableTimeout(PDMA_T *pdma, uint32_t u32Mask);
+void PDMA_DisableTimeout(PDMA_T *pdma, uint32_t u32Mask);
+void PDMA_SetTimeOut(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32OnOff, uint32_t u32TimeOutCnt);
+void PDMA_Trigger(PDMA_T *pdma, uint32_t u32Ch);
+void PDMA_EnableInt(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32Mask);
+void PDMA_DisableInt(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32Mask);
+void PDMA_SetStride(PDMA_T *pdma, uint32_t u32Ch, uint32_t u32DestLen, uint32_t u32SrcLen, uint32_t u32TransCount);
+
+
+/*@}*/ /* end of group PDMA_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group PDMA_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NU_PDMA_H__ */

+ 271 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_pwm.h

@@ -0,0 +1,271 @@
+/**************************************************************************//**
+ * @file     pwm.h
+ * @version  V1.00
+ * $Revision: 3 $
+ * $Date: 15/05/19 10:16a $
+ * @brief    NUC980 series PWM driver header file
+ *
+ * @note
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_PWM_H__
+#define __NU_PWM_H__
+#include "nuc980.h"
+#include "nu_sys.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup PWM_Driver PWM Driver
+  @{
+*/
+
+/** @addtogroup PWM_EXPORTED_CONSTANTS PWM Exported Constants
+  @{
+*/
+
+#define PWM_OFFSET      0xc ///< each channel has 3 control registers which occupies 12 bytes
+
+// Timer channel identity information
+#define PWM_TIMER_NUM   8   ///< Total PWM channel count
+#define PWM_TIMER_MIN   0   ///< Min PWM channel number
+#define PWM_TIMER_MAX   7   ///< Max PWM channel number
+#define PWM0_TIMER0     0   ///< PWM0 channel 0
+#define PWM0_TIMER1     1   ///< PWM0 channel 1
+#define PWM0_TIMER2     2   ///< PWM0 channel 2
+#define PWM0_TIMER3     3   ///< PWM0 channel 3
+#define PWM1_TIMER0     4   ///< PWM1 channel 0
+#define PWM1_TIMER1     5   ///< PWM1 channel 1
+#define PWM1_TIMER2     6   ///< PWM1 channel 2
+#define PWM1_TIMER3     7   ///< PWM1 channel 3
+
+//ioctl command
+#define START_PWMTIMER          0   ///< Start PWM ioctl command 
+#define STOP_PWMTIMER           1   ///< Stop PWM ioctl command
+#define SET_CSR                 2   ///< Set CSR ioctl command
+#define SET_CP                  3   ///< Set CP ioctl command
+#define SET_DZI                 4   ///< Set dead zone ioctl command
+#define SET_INVERTER            5   ///< Set inverter ioctl command
+#define SET_MODE                6   ///< Set OP mode ioctl command
+#define ENABLE_DZ_GENERATOR     7   ///< Enable dead zone ioctl command
+#define DISABLE_DZ_GENERATOR    8   ///< Disable dead zone ioctl command
+#define ENABLE_PWMGPIOOUTPUT    9   ///< Enable PWM output ioctl command
+
+#define PWM_STOP_METHOD1    1        ///< PWM stop method 1
+#define PWM_STOP_METHOD2    2        ///< PWM stop method 2
+//#define PWM_STOP_METHOD3  3 not recommended
+
+//Timer default value
+#define DEFAULT_CSR     CSRD16        ///< Default CSR value
+#define DEFAULT_CP      255            ///< Default CP value
+#define DEFAULT_DZI     50            ///< Default DZI value
+#define DEFAULT_CNR     19531        ///< Default CNR value
+#define DEFAULT_CMR     (19531/4)    ///< Default CMR value
+#define DEFAULT_MODE    PWM_TOGGLE    ///< Default OP mode
+
+// for PWM_PPR
+#define DZI_MIN     0        ///< Min DZI value
+#define DZI_MAX     255        ///< Max DZI value
+#define CP_MIN      0        ///< Min CP value
+#define CP_MAX      255        ///< Max CP value
+
+// for PWM_CSR
+#define CSR_MIN     0        ///< Min CSR value
+#define CSR_MAX     4        ///< Mac SCR value
+#define CSRD2       0x0        ///< Div by 2
+#define CSRD4       0x1        ///< Div by 4
+#define CSRD8       0x2        ///< Div by 8
+#define CSRD16      0x3        ///< Div by 16
+#define CSRD1       0x4        ///< Div by 1
+
+// for PWM_PCR
+#define PWMDZG_ENABLE   1    ///< Enable PWM dead zone
+#define PWMDZG_DISABLE  0    ///< Disable PWM dead zone
+#define PWM_ENABLE      1   ///< Enable PWM channel
+#define PWM_DISABLE     0   ///< Disable PWM channel
+#define PWM_TOGGLE      1    ///< PWM toggle mode
+#define PWM_ONESHOT     0    ///< PWM one-shot mode
+#define PWM_INVON       1    ///< Enable PWM inverter
+#define PWM_INVOFF      0    ///< Disable PWM inverter
+
+// for PWM_CNR
+#define CNR_MIN     0        ///< Min CNR value
+#define CNR_MAX     65535    ///< Mac CNR value
+
+// for PWM_CMR
+#define CMR_MIN     0        ///< Min CMR value
+#define CMR_MAX     65535    ///< Max CMR value
+
+// for pin control
+#define PWM00_GPF5      0       ///< PWM00 output on GPF5
+#define PWM01_GPF6      1       ///< PWM01 output on GPF6
+#define PWM02_GPF7      2       ///< PWM02 output on GPF7
+#define PWM03_GPF8      3       ///< PWM03 output on GPF8
+#define PWM00_GPG0      4       ///< PWM00 output on GPG0
+#define PWM01_GPG1      5       ///< PWM01 output on GPG1
+#define PWM02_GPG2      6       ///< PWM02 output on GPG2
+#define PWM03_GPG3      7       ///< PWM03 output on GPG3
+#define PWM00_GPD12     8       ///< PWM00 output on GPD12
+#define PWM01_GPD13     9       ///< PWM01 output on GPD13
+#define PWM02_GPD14     10      ///< PWM02 output on GPD14
+#define PWM03_GPD15     11      ///< PWM03 output on GPD15
+#define PWM00_GPG10     12      ///< PWM00 output on GPG10
+#define PWM01_GPA15     13      ///< PWM01 output on GPA15
+#define PWM02_GPA14     14      ///< PWM02 output on GPA14
+#define PWM03_GPA13     15      ///< PWM03 output on GPA13
+#define PWM02_GPB13     16      ///< PWM02 output on GPB13
+
+#define PWM10_GPB12     17      ///< PWM10 output on GPB12
+#define PWM11_GPB11     18      ///< PWM11 output on GPB11
+#define PWM12_GPB10     19      ///< PWM12 output on GPB10
+#define PWM13_GPB9      20      ///< PWM13 output on GPB9
+#define PWM10_GPG6      21      ///< PWM10 output on GPG6
+#define PWM11_GPG7      22      ///< PWM11 output on GPG7
+#define PWM12_GPG8      23      ///< PWM12 output on GPG8
+#define PWM13_GPG9      24      ///< PWM13 output on GPG9
+#define PWM10_GPG11     25      ///< PWM10 output on GPG11
+#define PWM11_GPG12     26      ///< PWM11 output on GPG12
+#define PWM12_GPG13     27      ///< PWM12 output on GPG13
+#define PWM13_GPG14     28      ///< PWM13 output on GPG14
+#define PWM10_GPF9      29      ///< PWM10 output on GPF9
+#define PWM11_GPF10     30      ///< PWM11 output on GPF10
+#define PWM12_GPE10     31      ///< PWM12 output on GPE10
+#define PWM13_GPE12     32      ///< PWM13 output on GPE12
+
+#define PWM_ERR_ID      0xFFFF1300  ///< PWM library ID
+
+//PWM Error code
+#define pwmInvalidTimerChannel  (PWM_ERR_ID|1)    ///< Invalid channel number
+#define pwmInvalidStructLength  (PWM_ERR_ID|2)    ///< Invalid structure length
+#define pwmInvalidIoctlCommand  (PWM_ERR_ID|3)    ///< Invalid ioctl command
+#define pwmInvalidStopMethod    (PWM_ERR_ID|4)    ///< Invalid stop mode
+#define pwmInvalidCPValue       (PWM_ERR_ID|5)    ///< Invalid CP value
+#define pwmInvalidDZIValue      (PWM_ERR_ID|6)    ///< Invalid DZI value
+#define pwmInvalidCSRValue      (PWM_ERR_ID|7)    ///< Invalid CSR value
+#define pwmInvalidDZGStatus     (PWM_ERR_ID|8)    ///< Invalid DZ status
+#define pwmInvalidTimerStatus   (PWM_ERR_ID|9)    ///< Invalid timer status
+#define pwmInvalidInverterValue (PWM_ERR_ID|10)    ///< Invalid inverter value
+#define pwmInvalidModeStatus    (PWM_ERR_ID|11)    ///< Invalid OP mode
+#define pwmInvalidCNRValue      (PWM_ERR_ID|12)    ///< Invalid CNR value
+#define pwmInvalidCMRValue      (PWM_ERR_ID|13)    ///< Invalid CMR value
+#define pwmTimerNotOpen         (PWM_ERR_ID|14)    ///< PWM channel not stop
+#define pwmTimerBusy            (PWM_ERR_ID|15)    ///< PWM channel is busy
+#define pwmInvalidPin           (PWM_ERR_ID|16)    ///< Invalid PWM output pin
+
+/*@}*/ /* end of group PWM_EXPORTED_CONSTANTS */
+
+/// @cond HIDDEN_SYMBOLS
+/** @addtogroup PWM_EXPORTED_STRUCTS PWM Exported Structs
+  @{
+*/
+
+typedef union
+{
+    UINT value;
+    struct
+    {
+        UINT cp0: 8, cp1: 8, dzi0: 8, dzi1: 8;
+    } field;
+} typePPR;
+
+typedef union
+{
+    UINT value;
+    struct
+    {
+        UINT   csr0: 3, _reserved3: 1,
+               csr1: 3, _reserved7: 1,
+               csr2: 3, _reserved11: 1,
+               csr3: 3, _reserved15: 1,
+               _reserved16_31: 16;
+    } field;
+} typeCSR;
+
+typedef union
+{
+    UINT value;
+    struct
+    {
+        UINT   ch0_en: 1, _reserved1: 1, ch0_inverter: 1, ch0_mode: 1,
+               grpup0_dzen: 1, grpup1_dzen: 1,
+               _reserved6_7: 2,
+               ch1_en: 1, _reserved9: 1, ch1_inverter: 1, ch1_mode: 1,
+               ch2_en: 1, _reserved13: 1, ch2_inverter: 1, ch2_mode: 1,
+               ch3_en: 1, _reserved17: 1, ch3_inverter: 1, ch3_mode: 1,
+               _reserved20_31: 12;
+    } field;
+} typePCR;
+
+typedef union
+{
+    UINT value;
+    struct
+    {
+        UINT cnr: 16, _reserved16_31: 16;
+    } field;
+} typeCNR;
+
+typedef union
+{
+    UINT value;
+    struct
+    {
+        UINT cmr: 16, _reserved16_31: 16;
+    } field;
+} typeCMR;
+
+// for write operation
+typedef union
+{
+    UINT value;
+    struct
+    {
+        UINT cnr: 16, cmr: 16;
+    } field;
+} typePWMVALUE;
+
+// for read operation
+typedef struct
+{
+    UINT volatile PDR;
+    BOOL volatile InterruptFlag;
+    BOOL _reversed0;
+    BOOL _reversed1;
+    BOOL _reversed2;
+} typePWMSTATUS;
+
+/*@}*/ /* end of group PWM_EXPORTED_STRUCTS */
+/// @endcond /* HIDDEN_SYMBOLS */
+
+/** @addtogroup PWM_EXPORTED_FUNCTIONS PWM Exported Functions
+  @{
+*/
+
+// function definition
+INT pwmInit(const INT nTimerIdentity);
+INT pwmExit(void);
+INT pwmOpen(const INT nTimerIdentity);
+INT pwmClose(const INT nTimerIdentity);
+INT pwmRead(const INT nTimerIdentity, PUCHAR pucStatusValue, const UINT uLength);
+INT pwmWrite(const INT nTimerIdentity, PUCHAR pucCNRCMRValue, const UINT uLength);
+INT pwmIoctl(const INT nTimerIdentity, const UINT uCommand, const UINT uIndication, UINT uValue);
+
+/*@}*/ /* end of group PWM_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group PWM_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_PWM_H__
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

+ 929 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_qspi.h

@@ -0,0 +1,929 @@
+/**************************************************************************//**
+ * @file     qspi.h
+ * @brief    NUC980 series QSPI driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+#ifndef __NU_QSPI_H__
+#define __NU_QSPI_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+   @addtogroup REGISTER Control Register
+   @{
+*/
+
+/**
+    @addtogroup QSPI Serial Peripheral Interface Controller(QSPI)
+    Memory Mapped Structure for QSPI Controller
+@{ */
+
+typedef struct
+{
+
+
+    /**
+     * @var QSPI_T::CTL
+     * Offset: 0x00  QSPI Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |QSPIEN    |QSPI Transfer Control Enable Bit
+     * |        |          |In Master mode, the transfer will start when there is data in the FIFO buffer after this bit is set to 1
+     * |        |          |In Slave mode, this device is ready to receive data when this bit is set to 1.
+     * |        |          |0 = Transfer control Disabled.
+     * |        |          |1 = Transfer control Enabled.
+     * |        |          |Note: Before changing the configurations of QSPIx_CTL, QSPIx_CLKDIV, QSPIx_SSCTL and QSPIx_FIFOCTL registers, user shall clear the QSPIEN (QSPIx_CTL[0]) and confirm the QSPIENSTS (QSPIx_STATUS[15]) is 0.
+     * |[1]     |RXNEG     |Receive on Negative Edge
+     * |        |          |0 = Received data input signal is latched on the rising edge of QSPI bus clock.
+     * |        |          |1 = Received data input signal is latched on the falling edge of QSPI bus clock.
+     * |[2]     |TXNEG     |Transmit on Negative Edge
+     * |        |          |0 = Transmitted data output signal is changed on the rising edge of QSPI bus clock.
+     * |        |          |1 = Transmitted data output signal is changed on the falling edge of QSPI bus clock.
+     * |[3]     |CLKPOL    |Clock Polarity
+     * |        |          |0 = QSPI bus clock is idle low.
+     * |        |          |1 = QSPI bus clock is idle high.
+     * |[7:4]   |SUSPITV   |Suspend Interval (Master Only)
+     * |        |          |The four bits provide configurable suspend interval between two successive transmit/receive transaction in a transfer
+     * |        |          |The definition of the suspend interval is the interval between the last clock edge of the preceding transaction word and the first clock edge of the following transaction word
+     * |        |          |The default value is 0x3
+     * |        |          |The period of the suspend interval is obtained according to the following equation.
+     * |        |          |(SUSPITV[3:0] + 0.5) * period of QSPICLK clock cycle
+     * |        |          |Example:
+     * |        |          |SUSPITV = 0x0 .... 0.5 QSPICLK clock cycle.
+     * |        |          |SUSPITV = 0x1 .... 1.5 QSPICLK clock cycle.
+     * |        |          |.....
+     * |        |          |SUSPITV = 0xE .... 14.5 QSPICLK clock cycle.
+     * |        |          |SUSPITV = 0xF .... 15.5 QSPICLK clock cycle.
+     * |[12:8]  |DWIDTH    |Data Width
+     * |        |          |This field specifies how many bits can be transmitted / received in one transaction
+     * |        |          |The minimum bit length is 8 bits and can up to 32 bits.
+     * |        |          |DWIDTH = 0x08 .... 8 bits.
+     * |        |          |DWIDTH = 0x09 .... 9 bits.
+     * |        |          |.....
+     * |        |          |DWIDTH = 0x1F .... 31 bits.
+     * |        |          |DWIDTH = 0x00 .... 32 bits.
+     * |[13]    |LSB       |Send LSB First
+     * |        |          |0 = The MSB, which bit of transmit/receive register depends on the setting of DWIDTH, is transmitted/received first.
+     * |        |          |1 = The LSB, bit 0 of the QSPI TX register, is sent first to the QSPI data output pin, and the first bit received from the QSPI data input pin will be put in the LSB position of the RX register (bit 0 of QSPI_RX).
+     * |[14]    |HALFDPX   |QSPI Half-duplex Transfer Enable Bit
+     * |        |          |This bit is used to select full-duplex or half-duplex for QSPI transfer
+     * |        |          |The bit field DATDIR (QSPIx_CTL[20]) can be used to set the data direction in half-duplex transfer.
+     * |        |          |0 = QSPI operates in full-duplex transfer.
+     * |        |          |1 = QSPI operates in half-duplex transfer.
+     * |[15]    |RXONLY    |Receive-only Mode Enable Bit (Master Only)
+     * |        |          |This bit field is only available in Master mode
+     * |        |          |In receive-only mode, QSPI Master will generate QSPI bus clock continuously for receiving data bit from QSPI slave device and assert the BUSY status.
+     * |        |          |0 = Receive-only mode Disabled.
+     * |        |          |1 = Receive-only mode Enabled.
+     * |[16]    |TWOBIT    |2-bit Transfer Mode Enable Bit (Only Supported in QSPI0)
+     * |        |          |0 = 2-Bit Transfer mode Disabled.
+     * |        |          |1 = 2-Bit Transfer mode Enabled.
+     * |        |          |Note: When 2-Bit Transfer mode is enabled, the first serial transmitted bit data is from the first FIFO buffer data, and the 2nd serial transmitted bit data is from the second FIFO buffer data
+     * |        |          |As the same as transmitted function, the first received bit data is stored into the first FIFO buffer and the 2nd received bit data is stored into the second FIFO buffer at the same time.
+     * |[17]    |UNITIEN   |Unit Transfer Interrupt Enable Bit
+     * |        |          |0 = QSPI unit transfer interrupt Disabled.
+     * |        |          |1 = QSPI unit transfer interrupt Enabled.
+     * |[18]    |SLAVE     |Slave Mode Control
+     * |        |          |0 = Master mode.
+     * |        |          |1 = Slave mode.
+     * |[19]    |REORDER   |Byte Reorder Function Enable Bit
+     * |        |          |0 = Byte Reorder function Disabled.
+     * |        |          |1 = Byte Reorder function Enabled
+     * |        |          |A byte suspend interval will be inserted among each byte
+     * |        |          |The period of the byte suspend interval depends on the setting of SUSPITV.
+     * |        |          |Note: Byte Reorder function is only available if DWIDTH is defined as 16, 24, and 32 bits.
+     * |[20]    |DATDIR    |Data Port Direction Control
+     * |        |          |This bit is used to select the data input/output direction in half-duplex transfer and Dual/Quad transfer
+     * |        |          |0 = QSPI data is input direction.
+     * |        |          |1 = QSPI data is output direction.
+     * |[21]    |DUALIOEN  |Dual I/O Mode Enable Bit (Only Supported in QSPI0)
+     * |        |          |0 = Dual I/O mode Disabled.
+     * |        |          |1 = Dual I/O mode Enabled.
+     * |[22]    |QUADIOEN  |Quad I/O Mode Enable Bit (Only Supported in QSPI0)
+     * |        |          |0 = Quad I/O mode Disabled.
+     * |        |          |1 = Quad I/O mode Enabled.
+     * @var QSPI_T::CLKDIV
+     * Offset: 0x04  QSPI Clock Divider Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[8:0]   |DIVIDER   |Clock Divider
+     * |        |          |The value in this field is the frequency divider for generating the peripheral clock, fspi_eclk, and the QSPI bus clock of QSPI Master
+     * |        |          |The frequency is obtained according to the following equation.
+     * |        |          |where
+     * |        |          |is the peripheral clock source, which is defined in the clock control register, CLK_CLKSEL2.
+     * @var QSPI_T::SSCTL
+     * Offset: 0x08  QSPI Slave Select Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |SS        |Slave Selection Control (Master Only)
+     * |        |          |If AUTOSS bit is cleared to 0,
+     * |        |          |0 = set the QSPIx_SS line to inactive state.
+     * |        |          |1 = set the QSPIx_SS line to active state.
+     * |        |          |If the AUTOSS bit is set to 1,
+     * |        |          |0 = Keep the QSPIx_SS line at inactive state.
+     * |        |          |1 = QSPIx_SS line will be automatically driven to active state for the duration of data transfer, and will be driven to inactive state for the rest of the time
+     * |        |          |The active state of QSPIx_SS is specified in SSACTPOL (QSPIx_SSCTL[2]).
+     * |[2]     |SSACTPOL  |Slave Selection Active Polarity
+     * |        |          |This bit defines the active polarity of slave selection signal (QSPIx_SS).
+     * |        |          |0 = The slave selection signal QSPIx_SS is active low.
+     * |        |          |1 = The slave selection signal QSPIx_SS is active high.
+     * |[3]     |AUTOSS    |Automatic Slave Selection Function Enable Bit (Master Only)
+     * |        |          |0 = Automatic slave selection function Disabled
+     * |        |          |Slave selection signal will be asserted/de-asserted according to SS (QSPIx_SSCTL[0]).
+     * |        |          |1 = Automatic slave selection function Enabled.
+     * |[4]     |SLV3WIRE  |Slave 3-wire Mode Enable Bit (Only Supported in QSPI0)
+     * |        |          |Slave 3-wire mode is only available in QSPI0
+     * |        |          |In Slave 3-wire mode, the QSPI controller can work with 3-wire interface including QSPI0_CLK, QSPI0_MISO and QSPI0_MOSI pins.
+     * |        |          |0 = 4-wire bi-direction interface.
+     * |        |          |1 = 3-wire bi-direction interface.
+     * |[5]     |SLVTOIEN  |Slave Mode Time-out Interrupt Enable Bit (Only Supported in QSPI0)
+     * |        |          |0 = Slave mode time-out interrupt Disabled.
+     * |        |          |1 = Slave mode time-out interrupt Enabled.
+     * |[6]     |SLVTORST  |Slave Mode Time-out Reset Control (Only Supported in QSPI0)
+     * |        |          |0 = When Slave mode time-out event occurs, the TX and RX control circuit will not be reset.
+     * |        |          |1 = When Slave mode time-out event occurs, the TX and RX control circuit will be reset by hardware.
+     * |[8]     |SLVBEIEN  |Slave Mode Bit Count Error Interrupt Enable Bit
+     * |        |          |0 = Slave mode bit count error interrupt Disabled.
+     * |        |          |1 = Slave mode bit count error interrupt Enabled.
+     * |[9]     |SLVURIEN  |Slave Mode TX Under Run Interrupt Enable Bit
+     * |        |          |0 = Slave mode TX under run interrupt Disabled.
+     * |        |          |1 = Slave mode TX under run interrupt Enabled.
+     * |[12]    |SSACTIEN  |Slave Select Active Interrupt Enable Bit
+     * |        |          |0 = Slave select active interrupt Disabled.
+     * |        |          |1 = Slave select active interrupt Enabled.
+     * |[13]    |SSINAIEN  |Slave Select Inactive Interrupt Enable Bit
+     * |        |          |0 = Slave select inactive interrupt Disabled.
+     * |        |          |1 = Slave select inactive interrupt Enabled.
+     * |[31:16] |SLVTOCNT  |Slave Mode Time-out Period (Only Supported in QSPI0)
+     * |        |          |In Slave mode, these bits indicate the time-out period when there is bus clock input during slave select active
+     * |        |          |The clock source of the time-out counter is Slave peripheral clock
+     * |        |          |If the value is 0, it indicates the slave mode time-out function is disabled.
+     * @var QSPI_T::PDMACTL
+     * Offset: 0x0C  QSPI PDMA Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |TXPDMAEN  |Transmit PDMA Enable Bit
+     * |        |          |0 = Transmit PDMA function Disabled.
+     * |        |          |1 = Transmit PDMA function Enabled.
+     * |        |          |Note: In QSPI Master mode with full duplex transfer, if both TX and RX PDMA functions are enabled, RX PDMA function cannot be enabled prior to TX PDMA function
+     * |        |          |User can enable TX PDMA function firstly or enable both functions simultaneously.
+     * |[1]     |RXPDMAEN  |Receive PDMA Enable Bit
+     * |        |          |0 = Receive PDMA function Disabled.
+     * |        |          |1 = Receive PDMA function Enabled.
+     * |[2]     |PDMARST   |PDMA Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset the PDMA control logic of the QSPI controller. This bit will be automatically cleared to 0.
+     * @var QSPI_T::FIFOCTL
+     * Offset: 0x10  QSPI FIFO Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |RXRST     |Receive Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset receive FIFO pointer and receive circuit
+     * |        |          |The RXFULL bit will be cleared to 0 and the RXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 3 system clock cycles + 2 peripheral clock cycles after it is set to 1
+     * |        |          |User can read TXRXRST (QSPIx_STATUS[23]) to check if reset is accomplished or not.
+     * |[1]     |TXRST     |Transmit Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset transmit FIFO pointer and transmit circuit
+     * |        |          |The TXFULL bit will be cleared to 0 and the TXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 3 system clock cycles + 2 peripheral clock cycles after it is set to 1
+     * |        |          |User can read TXRXRST (QSPIx_STATUS[23]) to check if reset is accomplished or not.
+     * |        |          |Note: If TX underflow event occurs in QSPI Slave mode, this bit can be used to make QSPI return to idle state.
+     * |[2]     |RXTHIEN   |Receive FIFO Threshold Interrupt Enable Bit
+     * |        |          |0 = RX FIFO threshold interrupt Disabled.
+     * |        |          |1 = RX FIFO threshold interrupt Enabled.
+     * |[3]     |TXTHIEN   |Transmit FIFO Threshold Interrupt Enable Bit
+     * |        |          |0 = TX FIFO threshold interrupt Disabled.
+     * |        |          |1 = TX FIFO threshold interrupt Enabled.
+     * |[4]     |RXTOIEN   |Slave Receive Time-out Interrupt Enable Bit
+     * |        |          |0 = Receive time-out interrupt Disabled.
+     * |        |          |1 = Receive time-out interrupt Enabled.
+     * |[5]     |RXOVIEN   |Receive FIFO Overrun Interrupt Enable Bit
+     * |        |          |0 = Receive FIFO overrun interrupt Disabled.
+     * |        |          |1 = Receive FIFO overrun interrupt Enabled.
+     * |[6]     |TXUFPOL   |TX Underflow Data Polarity
+     * |        |          |0 = The QSPI data out is keep 0 if there is TX underflow event in Slave mode.
+     * |        |          |1 = The QSPI data out is keep 1 if there is TX underflow event in Slave mode.
+     * |        |          |Note:
+     * |        |          |1. The TX underflow event occurs if there is no any data in TX FIFO when the slave selection signal is active.
+     * |        |          |2. When TX underflow event occurs, QSPIx_MISO pin state will be determined by this setting even though TX FIFO is not empty afterward
+     * |        |          |Data stored in TX FIFO will be sent through QSPIx_MISO pin in the next transfer frame.
+     * |[7]     |TXUFIEN   |TX Underflow Interrupt Enable Bit
+     * |        |          |When TX underflow event occurs in Slave mode, TXUFIF (QSPIx_STATUS[19]) will be set to 1
+     * |        |          |This bit is used to enable the TX underflow interrupt.
+     * |        |          |0 = Slave TX underflow interrupt Disabled.
+     * |        |          |1 = Slave TX underflow interrupt Enabled.
+     * |[8]     |RXFBCLR   |Receive FIFO Buffer Clear
+     * |        |          |0 = No effect.
+     * |        |          |1 = Clear receive FIFO pointer
+     * |        |          |The RXFULL bit will be cleared to 0 and the RXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 1 system clock after it is set to 1.
+     * |        |          |Note: The RX shift register will not be cleared.
+     * |[9]     |TXFBCLR   |Transmit FIFO Buffer Clear
+     * |        |          |0 = No effect.
+     * |        |          |1 = Clear transmit FIFO pointer
+     * |        |          |The TXFULL bit will be cleared to 0 and the TXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 1 system clock after it is set to 1.
+     * |        |          |Note: The TX shift register will not be cleared.
+     * |[26:24] |RXTH      |Receive FIFO Threshold
+     * |        |          |If the valid data count of the receive FIFO buffer is larger than the RXTH setting, the RXTHIF bit will be set to 1, else the RXTHIF bit will be cleared to 0
+     * |[30:28] |TXTH      |Transmit FIFO Threshold
+     * |        |          |If the valid data count of the transmit FIFO buffer is less than or equal to the TXTH setting, the TXTHIF bit will be set to 1, else the TXTHIF bit will be cleared to 0
+     * @var QSPI_T::STATUS
+     * Offset: 0x14  QSPI Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |BUSY      |Busy Status (Read Only)
+     * |        |          |0 = QSPI controller is in idle state.
+     * |        |          |1 = QSPI controller is in busy state.
+     * |        |          |The following listing are the bus busy conditions:
+     * |        |          |a. QSPIx_CTL[0] = 1 and TXEMPTY = 0.
+     * |        |          |b
+     * |        |          |For QSPI Master mode, QSPIx_CTL[0] = 1 and TXEMPTY = 1 but the current transaction is not finished yet.
+     * |        |          |c. For QSPI Master mode, QSPIx_CTL[0] = 1 and RXONLY = 1.
+     * |        |          |d
+     * |        |          |For QSPI Slave mode, the QSPIx_CTL[0] = 1 and there is serial clock input into the QSPI core logic when slave select is active.
+     * |        |          |For QSPI Slave mode, the QSPIx_CTL[0] = 1 and the transmit buffer or transmit shift register is not empty even if the slave select is inactive.
+     * |[1]     |UNITIF    |Unit Transfer Interrupt Flag
+     * |        |          |0 = No transaction has been finished since this bit was cleared to 0.
+     * |        |          |1 = QSPI controller has finished one unit transfer.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[2]     |SSACTIF   |Slave Select Active Interrupt Flag
+     * |        |          |0 = Slave select active interrupt was cleared or not occurred.
+     * |        |          |1 = Slave select active interrupt event occurred.
+     * |        |          |Note: Only available in Slave mode. This bit will be cleared by writing 1 to it.
+     * |[3]     |SSINAIF   |Slave Select Inactive Interrupt Flag
+     * |        |          |0 = Slave select inactive interrupt was cleared or not occurred.
+     * |        |          |1 = Slave select inactive interrupt event occurred.
+     * |        |          |Note: Only available in Slave mode. This bit will be cleared by writing 1 to it.
+     * |[4]     |SSLINE    |Slave Select Line Bus Status (Read Only)
+     * |        |          |0 = The slave select line status is 0.
+     * |        |          |1 = The slave select line status is 1.
+     * |        |          |Note: This bit is only available in Slave mode
+     * |        |          |If SSACTPOL (QSPIx_SSCTL[2]) is set 0, and the SSLINE is 1, the QSPI slave select is in inactive status.
+     * |[5]     |SLVTOIF   |Slave Time-out Interrupt Flag (Only Supported in QSPI0)
+     * |        |          |When the slave select is active and the value of SLVTOCNT is not 0, as the bus clock is detected, the slave time-out counter in QSPI controller logic will be started
+     * |        |          |When the value of time-out counter is greater than or equal to the value of SLVTOCNT (QSPI_SSCTL[31:16]) before one transaction is done, the slave time-out interrupt event will be asserted.
+     * |        |          |0 = Slave time-out is not active.
+     * |        |          |1 = Slave time-out is active.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[6]     |SLVBEIF   |Slave Mode Bit Count Error Interrupt Flag
+     * |        |          |In Slave mode, when the slave select line goes to inactive state, if bit counter is mismatch with DWIDTH, this interrupt flag will be set to 1.
+     * |        |          |0 = No Slave mode bit count error event.
+     * |        |          |1 = Slave mode bit count error event occurs.
+     * |        |          |Note: If the slave select active but there is no any bus clock input, the SLVBEIF also active when the slave select goes to inactive state
+     * |        |          |This bit will be cleared by writing 1 to it.
+     * |[7]     |SLVURIF   |Slave Mode TX Under Run Interrupt Flag
+     * |        |          |In Slave mode, if TX underflow event occurs and the slave select line goes to inactive state, this interrupt flag will be set to 1.
+     * |        |          |0 = No Slave TX under run event.
+     * |        |          |1 = Slave TX under run event occurs.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[8]     |RXEMPTY   |Receive FIFO Buffer Empty Indicator (Read Only)
+     * |        |          |0 = Receive FIFO buffer is not empty.
+     * |        |          |1 = Receive FIFO buffer is empty.
+     * |[9]     |RXFULL    |Receive FIFO Buffer Full Indicator (Read Only)
+     * |        |          |0 = Receive FIFO buffer is not full.
+     * |        |          |1 = Receive FIFO buffer is full.
+     * |[10]    |RXTHIF    |Receive FIFO Threshold Interrupt Flag (Read Only)
+     * |        |          |0 = The valid data count within the receive FIFO buffer is smaller than or equal to the setting value of RXTH.
+     * |        |          |1 = The valid data count within the receive FIFO buffer is larger than the setting value of RXTH.
+     * |[11]    |RXOVIF    |Receive FIFO Overrun Interrupt Flag
+     * |        |          |When the receive FIFO buffer is full, the follow-up data will be dropped and this bit will be set to 1.
+     * |        |          |0 = No FIFO is overrun.
+     * |        |          |1 = Receive FIFO is overrun.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[12]    |RXTOIF    |Receive Time-out Interrupt Flag
+     * |        |          |0 = No receive FIFO time-out event.
+     * |        |          |1 = Receive FIFO buffer is not empty and no read operation on receive FIFO buffer over 64 QSPI peripheral clock periods in Master mode or over 576 QSPI peripheral clock periods in Slave mode
+     * |        |          |When the received FIFO buffer is read by software, the time-out status will be cleared automatically.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[15]    |QSPIENSTS |QSPI Enable Status (Read Only)
+     * |        |          |0 = The QSPI controller is disabled.
+     * |        |          |1 = The QSPI controller is enabled.
+     * |        |          |Note: The QSPI peripheral clock is asynchronous with the system clock
+     * |        |          |In order to make sure the QSPI control logic is disabled, this bit indicates the real status of QSPI controller.
+     * |[16]    |TXEMPTY   |Transmit FIFO Buffer Empty Indicator (Read Only)
+     * |        |          |0 = Transmit FIFO buffer is not empty.
+     * |        |          |1 = Transmit FIFO buffer is empty.
+     * |[17]    |TXFULL    |Transmit FIFO Buffer Full Indicator (Read Only)
+     * |        |          |0 = Transmit FIFO buffer is not full.
+     * |        |          |1 = Transmit FIFO buffer is full.
+     * |[18]    |TXTHIF    |Transmit FIFO Threshold Interrupt Flag (Read Only)
+     * |        |          |0 = The valid data count within the transmit FIFO buffer is larger than the setting value of TXTH.
+     * |        |          |1 = The valid data count within the transmit FIFO buffer is less than or equal to the setting value of TXTH.
+     * |[19]    |TXUFIF    |TX Underflow Interrupt Flag
+     * |        |          |When the TX underflow event occurs, this bit will be set to 1, the state of data output pin depends on the setting of TXUFPOL.
+     * |        |          |0 = No effect.
+     * |        |          |1 = No data in Transmit FIFO and TX shift register when the slave selection signal is active.
+     * |        |          |Note 1: This bit will be cleared by writing 1 to it.
+     * |        |          |Note 2: If reset slave's transmission circuit when slave selection signal is active, this flag will be set to 1 after 2 peripheral clock cycles + 3 system clock cycles since the reset operation is done.
+     * |[23]    |TXRXRST   |TX or RX Reset Status (Read Only)
+     * |        |          |0 = The reset function of TXRST or RXRST is done.
+     * |        |          |1 = Doing the reset function of TXRST or RXRST.
+     * |        |          |Note: Both the reset operations of TXRST and RXRST need 3 system clock cycles + 2 peripheral clock cycles
+     * |        |          |User can check the status of this bit to monitor the reset function is doing or done.
+     * |[27:24] |RXCNT     |Receive FIFO Data Count (Read Only)
+     * |        |          |This bit field indicates the valid data count of receive FIFO buffer.
+     * |[31:28] |TXCNT     |Transmit FIFO Data Count (Read Only)
+     * |        |          |This bit field indicates the valid data count of transmit FIFO buffer.
+     * @var QSPI_T::TX
+     * Offset: 0x20  QSPI Data Transmit Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |TX        |Data Transmit Register
+     * |        |          |The data transmit registers pass through the transmitted data into the 4-level transmit FIFO buffers
+     * |        |          |The number of valid bits depends on the setting of DWIDTH (QSPIx_CTL[12:8]) in SPI mode.
+     * |        |          |In SPI mode, if DWIDTH is set to 0x08, the bits TX[7:0] will be transmitted
+     * |        |          |If DWIDTH is set to 0x00 , the QSPI controller will perform a 32-bit transfer.
+     * |        |          |If WDWIDTH is set as 0x0, 0x1, or 0x3, all bits of this field are valid
+     * |        |          |Note: In Master mode, QSPI controller will start to transfer the QSPI bus clock after 1 APB clock and 6 peripheral clock cycles after user writes to this register.
+     * @var QSPI_T::RX
+     * Offset: 0x30  QSPI Data Receive Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |RX        |Data Receive Register
+     * |        |          |There are 4-level FIFO buffers in this controller
+     * |        |          |The data receive register holds the data received from QSPI data input pin
+     * |        |          |This is a read only register.
+     */
+    __IO uint32_t CTL;                   /*!< [0x0000] QSPI Control Register                                             */
+    __IO uint32_t CLKDIV;                /*!< [0x0004] QSPI Clock Divider Register                                       */
+    __IO uint32_t SSCTL;                 /*!< [0x0008] QSPI Slave Select Control Register                                */
+    __IO uint32_t PDMACTL;               /*!< [0x000c] QSPI PDMA Control Register                                        */
+    __IO uint32_t FIFOCTL;               /*!< [0x0010] QSPI FIFO Control Register                                        */
+    __IO uint32_t STATUS;                /*!< [0x0014] QSPI Status Register                                              */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE0[2];
+    /// @endcond //HIDDEN_SYMBOLS
+    __O  uint32_t TX;                    /*!< [0x0020] QSPI Data Transmit Register                                       */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE1[3];
+    /// @endcond //HIDDEN_SYMBOLS
+    __I  uint32_t RX;                    /*!< [0x0030] QSPI Data Receive Register                                        */
+
+} QSPI_T;
+
+/**
+    @addtogroup QSPI_CONST QSPI Bit Field Definition
+    Constant Definitions for QSPI Controller
+@{ */
+
+#define QSPI_CTL_QSPIEN_Pos               (0)                                                /*!< QSPI_T::CTL: QSPIEN Position             */
+#define QSPI_CTL_QSPIEN_Msk               (0x1ul << QSPI_CTL_QSPIEN_Pos)                     /*!< QSPI_T::CTL: QSPIEN Mask                 */
+
+#define QSPI_CTL_RXNEG_Pos                (1)                                                /*!< QSPI_T::CTL: RXNEG Position             */
+#define QSPI_CTL_RXNEG_Msk                (0x1ul << QSPI_CTL_RXNEG_Pos)                      /*!< QSPI_T::CTL: RXNEG Mask                 */
+
+#define QSPI_CTL_TXNEG_Pos                (2)                                                /*!< QSPI_T::CTL: TXNEG Position             */
+#define QSPI_CTL_TXNEG_Msk                (0x1ul << QSPI_CTL_TXNEG_Pos)                      /*!< QSPI_T::CTL: TXNEG Mask                 */
+
+#define QSPI_CTL_CLKPOL_Pos               (3)                                                /*!< QSPI_T::CTL: CLKPOL Position            */
+#define QSPI_CTL_CLKPOL_Msk               (0x1ul << QSPI_CTL_CLKPOL_Pos)                     /*!< QSPI_T::CTL: CLKPOL Mask                */
+
+#define QSPI_CTL_SUSPITV_Pos              (4)                                                /*!< QSPI_T::CTL: SUSPITV Position           */
+#define QSPI_CTL_SUSPITV_Msk              (0xful << QSPI_CTL_SUSPITV_Pos)                    /*!< QSPI_T::CTL: SUSPITV Mask               */
+
+#define QSPI_CTL_DWIDTH_Pos               (8)                                                /*!< QSPI_T::CTL: DWIDTH Position            */
+#define QSPI_CTL_DWIDTH_Msk               (0x1ful << QSPI_CTL_DWIDTH_Pos)                    /*!< QSPI_T::CTL: DWIDTH Mask                */
+
+#define QSPI_CTL_LSB_Pos                  (13)                                               /*!< QSPI_T::CTL: LSB Position               */
+#define QSPI_CTL_LSB_Msk                  (0x1ul << QSPI_CTL_LSB_Pos)                        /*!< QSPI_T::CTL: LSB Mask                   */
+
+#define QSPI_CTL_HALFDPX_Pos              (14)                                               /*!< QSPI_T::CTL: HALFDPX Position           */
+#define QSPI_CTL_HALFDPX_Msk              (0x1ul << QSPI_CTL_HALFDPX_Pos)                    /*!< QSPI_T::CTL: HALFDPX Mask               */
+
+#define QSPI_CTL_RXONLY_Pos               (15)                                               /*!< QSPI_T::CTL: RXONLY Position            */
+#define QSPI_CTL_RXONLY_Msk               (0x1ul << QSPI_CTL_RXONLY_Pos)                     /*!< QSPI_T::CTL: RXONLY Mask                */
+
+#define QSPI_CTL_TWOBIT_Pos               (16)                                               /*!< QSPI_T::CTL: TWOBIT Position            */
+#define QSPI_CTL_TWOBIT_Msk               (0x1ul << QSPI_CTL_TWOBIT_Pos)                     /*!< QSPI_T::CTL: TWOBIT Mask                */
+
+#define QSPI_CTL_UNITIEN_Pos              (17)                                               /*!< QSPI_T::CTL: UNITIEN Position           */
+#define QSPI_CTL_UNITIEN_Msk              (0x1ul << QSPI_CTL_UNITIEN_Pos)                    /*!< QSPI_T::CTL: UNITIEN Mask               */
+
+#define QSPI_CTL_SLAVE_Pos                (18)                                               /*!< QSPI_T::CTL: SLAVE Position             */
+#define QSPI_CTL_SLAVE_Msk                (0x1ul << QSPI_CTL_SLAVE_Pos)                      /*!< QSPI_T::CTL: SLAVE Mask                 */
+
+#define QSPI_CTL_REORDER_Pos              (19)                                               /*!< QSPI_T::CTL: REORDER Position           */
+#define QSPI_CTL_REORDER_Msk              (0x1ul << QSPI_CTL_REORDER_Pos)                    /*!< QSPI_T::CTL: REORDER Mask               */
+
+#define QSPI_CTL_DATDIR_Pos               (20)                                               /*!< QSPI_T::CTL: DATDIR Position            */
+#define QSPI_CTL_DATDIR_Msk               (0x1ul << QSPI_CTL_DATDIR_Pos)                     /*!< QSPI_T::CTL: DATDIR Mask                */
+
+#define QSPI_CTL_DUALIOEN_Pos             (21)                                               /*!< QSPI_T::CTL: DUALIOEN Position          */
+#define QSPI_CTL_DUALIOEN_Msk             (0x1ul << QSPI_CTL_DUALIOEN_Pos)                   /*!< QSPI_T::CTL: DUALIOEN Mask              */
+
+#define QSPI_CTL_QUADIOEN_Pos             (22)                                               /*!< QSPI_T::CTL: QUADIOEN Position          */
+#define QSPI_CTL_QUADIOEN_Msk             (0x1ul << QSPI_CTL_QUADIOEN_Pos)                   /*!< QSPI_T::CTL: QUADIOEN Mask              */
+
+#define QSPI_CLKDIV_DIVIDER_Pos           (0)                                                /*!< QSPI_T::CLKDIV: DIVIDER Position        */
+#define QSPI_CLKDIV_DIVIDER_Msk           (0x1fful << QSPI_CLKDIV_DIVIDER_Pos)               /*!< QSPI_T::CLKDIV: DIVIDER Mask            */
+
+#define QSPI_SSCTL_SS_Pos                 (0)                                                /*!< QSPI_T::SSCTL: SS Position              */
+#define QSPI_SSCTL_SS_Msk                 (0x1ul << QSPI_SSCTL_SS_Pos)                       /*!< QSPI_T::SSCTL: SS Mask                  */
+
+#define QSPI_SSCTL_SSACTPOL_Pos           (2)                                                /*!< QSPI_T::SSCTL: SSACTPOL Position        */
+#define QSPI_SSCTL_SSACTPOL_Msk           (0x1ul << QSPI_SSCTL_SSACTPOL_Pos)                 /*!< QSPI_T::SSCTL: SSACTPOL Mask            */
+
+#define QSPI_SSCTL_AUTOSS_Pos             (3)                                                /*!< QSPI_T::SSCTL: AUTOSS Position          */
+#define QSPI_SSCTL_AUTOSS_Msk             (0x1ul << QSPI_SSCTL_AUTOSS_Pos)                   /*!< QSPI_T::SSCTL: AUTOSS Mask              */
+
+#define QSPI_SSCTL_SLV3WIRE_Pos           (4)                                                /*!< QSPI_T::SSCTL: SLV3WIRE Position        */
+#define QSPI_SSCTL_SLV3WIRE_Msk           (0x1ul << QSPI_SSCTL_SLV3WIRE_Pos)                 /*!< QSPI_T::SSCTL: SLV3WIRE Mask            */
+
+#define QSPI_SSCTL_SLVTOIEN_Pos           (5)                                                /*!< QSPI_T::SSCTL: SLVTOIEN Position        */
+#define QSPI_SSCTL_SLVTOIEN_Msk           (0x1ul << QSPI_SSCTL_SLVTOIEN_Pos)                 /*!< QSPI_T::SSCTL: SLVTOIEN Mask            */
+
+#define QSPI_SSCTL_SLVTORST_Pos           (6)                                                /*!< QSPI_T::SSCTL: SLVTORST Position        */
+#define QSPI_SSCTL_SLVTORST_Msk           (0x1ul << QSPI_SSCTL_SLVTORST_Pos)                 /*!< QSPI_T::SSCTL: SLVTORST Mask            */
+
+#define QSPI_SSCTL_SLVBEIEN_Pos           (8)                                                /*!< QSPI_T::SSCTL: SLVBEIEN Position        */
+#define QSPI_SSCTL_SLVBEIEN_Msk           (0x1ul << QSPI_SSCTL_SLVBEIEN_Pos)                 /*!< QSPI_T::SSCTL: SLVBEIEN Mask            */
+
+#define QSPI_SSCTL_SLVURIEN_Pos           (9)                                                /*!< QSPI_T::SSCTL: SLVURIEN Position        */
+#define QSPI_SSCTL_SLVURIEN_Msk           (0x1ul << QSPI_SSCTL_SLVURIEN_Pos)                 /*!< QSPI_T::SSCTL: SLVURIEN Mask            */
+
+#define QSPI_SSCTL_SSACTIEN_Pos           (12)                                               /*!< QSPI_T::SSCTL: SSACTIEN Position        */
+#define QSPI_SSCTL_SSACTIEN_Msk           (0x1ul << QSPI_SSCTL_SSACTIEN_Pos)                 /*!< QSPI_T::SSCTL: SSACTIEN Mask            */
+
+#define QSPI_SSCTL_SSINAIEN_Pos           (13)                                               /*!< QSPI_T::SSCTL: SSINAIEN Position        */
+#define QSPI_SSCTL_SSINAIEN_Msk           (0x1ul << QSPI_SSCTL_SSINAIEN_Pos)                 /*!< QSPI_T::SSCTL: SSINAIEN Mask            */
+
+#define QSPI_SSCTL_SLVTOCNT_Pos           (16)                                               /*!< QSPI_T::SSCTL: SLVTOCNT Position        */
+#define QSPI_SSCTL_SLVTOCNT_Msk           (0xfffful << QSPI_SSCTL_SLVTOCNT_Pos)              /*!< QSPI_T::SSCTL: SLVTOCNT Mask            */
+
+#define QSPI_PDMACTL_TXPDMAEN_Pos         (0)                                                /*!< QSPI_T::PDMACTL: TXPDMAEN Position      */
+#define QSPI_PDMACTL_TXPDMAEN_Msk         (0x1ul << QSPI_PDMACTL_TXPDMAEN_Pos)               /*!< QSPI_T::PDMACTL: TXPDMAEN Mask          */
+
+#define QSPI_PDMACTL_RXPDMAEN_Pos         (1)                                                /*!< QSPI_T::PDMACTL: RXPDMAEN Position      */
+#define QSPI_PDMACTL_RXPDMAEN_Msk         (0x1ul << QSPI_PDMACTL_RXPDMAEN_Pos)               /*!< QSPI_T::PDMACTL: RXPDMAEN Mask          */
+
+#define QSPI_PDMACTL_PDMARST_Pos          (2)                                                /*!< QSPI_T::PDMACTL: PDMARST Position       */
+#define QSPI_PDMACTL_PDMARST_Msk          (0x1ul << QSPI_PDMACTL_PDMARST_Pos)                /*!< QSPI_T::PDMACTL: PDMARST Mask           */
+
+#define QSPI_FIFOCTL_RXRST_Pos            (0)                                                /*!< QSPI_T::FIFOCTL: RXRST Position         */
+#define QSPI_FIFOCTL_RXRST_Msk            (0x1ul << QSPI_FIFOCTL_RXRST_Pos)                  /*!< QSPI_T::FIFOCTL: RXRST Mask             */
+
+#define QSPI_FIFOCTL_TXRST_Pos            (1)                                                /*!< QSPI_T::FIFOCTL: TXRST Position         */
+#define QSPI_FIFOCTL_TXRST_Msk            (0x1ul << QSPI_FIFOCTL_TXRST_Pos)                  /*!< QSPI_T::FIFOCTL: TXRST Mask             */
+
+#define QSPI_FIFOCTL_RXTHIEN_Pos          (2)                                                /*!< QSPI_T::FIFOCTL: RXTHIEN Position       */
+#define QSPI_FIFOCTL_RXTHIEN_Msk          (0x1ul << QSPI_FIFOCTL_RXTHIEN_Pos)                /*!< QSPI_T::FIFOCTL: RXTHIEN Mask           */
+
+#define QSPI_FIFOCTL_TXTHIEN_Pos          (3)                                                /*!< QSPI_T::FIFOCTL: TXTHIEN Position       */
+#define QSPI_FIFOCTL_TXTHIEN_Msk          (0x1ul << QSPI_FIFOCTL_TXTHIEN_Pos)                /*!< QSPI_T::FIFOCTL: TXTHIEN Mask           */
+
+#define QSPI_FIFOCTL_RXTOIEN_Pos          (4)                                                /*!< QSPI_T::FIFOCTL: RXTOIEN Position       */
+#define QSPI_FIFOCTL_RXTOIEN_Msk          (0x1ul << QSPI_FIFOCTL_RXTOIEN_Pos)                /*!< QSPI_T::FIFOCTL: RXTOIEN Mask           */
+
+#define QSPI_FIFOCTL_RXOVIEN_Pos          (5)                                                /*!< QSPI_T::FIFOCTL: RXOVIEN Position       */
+#define QSPI_FIFOCTL_RXOVIEN_Msk          (0x1ul << QSPI_FIFOCTL_RXOVIEN_Pos)                /*!< QSPI_T::FIFOCTL: RXOVIEN Mask           */
+
+#define QSPI_FIFOCTL_TXUFPOL_Pos          (6)                                                /*!< QSPI_T::FIFOCTL: TXUFPOL Position       */
+#define QSPI_FIFOCTL_TXUFPOL_Msk          (0x1ul << QSPI_FIFOCTL_TXUFPOL_Pos)                /*!< QSPI_T::FIFOCTL: TXUFPOL Mask           */
+
+#define QSPI_FIFOCTL_TXUFIEN_Pos          (7)                                                /*!< QSPI_T::FIFOCTL: TXUFIEN Position       */
+#define QSPI_FIFOCTL_TXUFIEN_Msk          (0x1ul << QSPI_FIFOCTL_TXUFIEN_Pos)                /*!< QSPI_T::FIFOCTL: TXUFIEN Mask           */
+
+#define QSPI_FIFOCTL_RXFBCLR_Pos          (8)                                                /*!< QSPI_T::FIFOCTL: RXFBCLR Position       */
+#define QSPI_FIFOCTL_RXFBCLR_Msk          (0x1ul << QSPI_FIFOCTL_RXFBCLR_Pos)                /*!< QSPI_T::FIFOCTL: RXFBCLR Mask           */
+
+#define QSPI_FIFOCTL_TXFBCLR_Pos          (9)                                                /*!< QSPI_T::FIFOCTL: TXFBCLR Position       */
+#define QSPI_FIFOCTL_TXFBCLR_Msk          (0x1ul << QSPI_FIFOCTL_TXFBCLR_Pos)                /*!< QSPI_T::FIFOCTL: TXFBCLR Mask           */
+
+#define QSPI_FIFOCTL_RXTH_Pos             (24)                                               /*!< QSPI_T::FIFOCTL: RXTH Position          */
+#define QSPI_FIFOCTL_RXTH_Msk             (0x7ul << QSPI_FIFOCTL_RXTH_Pos)                   /*!< QSPI_T::FIFOCTL: RXTH Mask              */
+
+#define QSPI_FIFOCTL_TXTH_Pos             (28)                                               /*!< QSPI_T::FIFOCTL: TXTH Position          */
+#define QSPI_FIFOCTL_TXTH_Msk             (0x7ul << QSPI_FIFOCTL_TXTH_Pos)                   /*!< QSPI_T::FIFOCTL: TXTH Mask              */
+
+#define QSPI_STATUS_BUSY_Pos              (0)                                                /*!< QSPI_T::STATUS: BUSY Position           */
+#define QSPI_STATUS_BUSY_Msk              (0x1ul << QSPI_STATUS_BUSY_Pos)                    /*!< QSPI_T::STATUS: BUSY Mask               */
+
+#define QSPI_STATUS_UNITIF_Pos            (1)                                                /*!< QSPI_T::STATUS: UNITIF Position         */
+#define QSPI_STATUS_UNITIF_Msk            (0x1ul << QSPI_STATUS_UNITIF_Pos)                  /*!< QSPI_T::STATUS: UNITIF Mask             */
+
+#define QSPI_STATUS_SSACTIF_Pos           (2)                                                /*!< QSPI_T::STATUS: SSACTIF Position        */
+#define QSPI_STATUS_SSACTIF_Msk           (0x1ul << QSPI_STATUS_SSACTIF_Pos)                 /*!< QSPI_T::STATUS: SSACTIF Mask            */
+
+#define QSPI_STATUS_SSINAIF_Pos           (3)                                                /*!< QSPI_T::STATUS: SSINAIF Position        */
+#define QSPI_STATUS_SSINAIF_Msk           (0x1ul << QSPI_STATUS_SSINAIF_Pos)                 /*!< QSPI_T::STATUS: SSINAIF Mask            */
+
+#define QSPI_STATUS_SSLINE_Pos            (4)                                                /*!< QSPI_T::STATUS: SSLINE Position         */
+#define QSPI_STATUS_SSLINE_Msk            (0x1ul << QSPI_STATUS_SSLINE_Pos)                  /*!< QSPI_T::STATUS: SSLINE Mask             */
+
+#define QSPI_STATUS_SLVTOIF_Pos           (5)                                                /*!< QSPI_T::STATUS: SLVTOIF Position        */
+#define QSPI_STATUS_SLVTOIF_Msk           (0x1ul << QSPI_STATUS_SLVTOIF_Pos)                 /*!< QSPI_T::STATUS: SLVTOIF Mask            */
+
+#define QSPI_STATUS_SLVBEIF_Pos           (6)                                                /*!< QSPI_T::STATUS: SLVBEIF Position        */
+#define QSPI_STATUS_SLVBEIF_Msk           (0x1ul << QSPI_STATUS_SLVBEIF_Pos)                 /*!< QSPI_T::STATUS: SLVBEIF Mask            */
+
+#define QSPI_STATUS_SLVURIF_Pos           (7)                                                /*!< QSPI_T::STATUS: SLVURIF Position        */
+#define QSPI_STATUS_SLVURIF_Msk           (0x1ul << QSPI_STATUS_SLVURIF_Pos)                 /*!< QSPI_T::STATUS: SLVURIF Mask            */
+
+#define QSPI_STATUS_RXEMPTY_Pos           (8)                                                /*!< QSPI_T::STATUS: RXEMPTY Position        */
+#define QSPI_STATUS_RXEMPTY_Msk           (0x1ul << QSPI_STATUS_RXEMPTY_Pos)                 /*!< QSPI_T::STATUS: RXEMPTY Mask            */
+
+#define QSPI_STATUS_RXFULL_Pos            (9)                                                /*!< QSPI_T::STATUS: RXFULL Position         */
+#define QSPI_STATUS_RXFULL_Msk            (0x1ul << QSPI_STATUS_RXFULL_Pos)                  /*!< QSPI_T::STATUS: RXFULL Mask             */
+
+#define QSPI_STATUS_RXTHIF_Pos            (10)                                               /*!< QSPI_T::STATUS: RXTHIF Position         */
+#define QSPI_STATUS_RXTHIF_Msk            (0x1ul << QSPI_STATUS_RXTHIF_Pos)                  /*!< QSPI_T::STATUS: RXTHIF Mask             */
+
+#define QSPI_STATUS_RXOVIF_Pos            (11)                                               /*!< QSPI_T::STATUS: RXOVIF Position         */
+#define QSPI_STATUS_RXOVIF_Msk            (0x1ul << QSPI_STATUS_RXOVIF_Pos)                  /*!< QSPI_T::STATUS: RXOVIF Mask             */
+
+#define QSPI_STATUS_RXTOIF_Pos            (12)                                               /*!< QSPI_T::STATUS: RXTOIF Position         */
+#define QSPI_STATUS_RXTOIF_Msk            (0x1ul << QSPI_STATUS_RXTOIF_Pos)                  /*!< QSPI_T::STATUS: RXTOIF Mask             */
+
+#define QSPI_STATUS_QSPIENSTS_Pos          (15)                                              /*!< QSPI_T::STATUS: QSPIENSTS Position       */
+#define QSPI_STATUS_QSPIENSTS_Msk          (0x1ul << QSPI_STATUS_QSPIENSTS_Pos)              /*!< QSPI_T::STATUS: QSPIENSTS Mask           */
+
+#define QSPI_STATUS_TXEMPTY_Pos           (16)                                               /*!< QSPI_T::STATUS: TXEMPTY Position        */
+#define QSPI_STATUS_TXEMPTY_Msk           (0x1ul << QSPI_STATUS_TXEMPTY_Pos)                 /*!< QSPI_T::STATUS: TXEMPTY Mask            */
+
+#define QSPI_STATUS_TXFULL_Pos            (17)                                               /*!< QSPI_T::STATUS: TXFULL Position         */
+#define QSPI_STATUS_TXFULL_Msk            (0x1ul << QSPI_STATUS_TXFULL_Pos)                  /*!< QSPI_T::STATUS: TXFULL Mask             */
+
+#define QSPI_STATUS_TXTHIF_Pos            (18)                                               /*!< QSPI_T::STATUS: TXTHIF Position         */
+#define QSPI_STATUS_TXTHIF_Msk            (0x1ul << QSPI_STATUS_TXTHIF_Pos)                  /*!< QSPI_T::STATUS: TXTHIF Mask             */
+
+#define QSPI_STATUS_TXUFIF_Pos            (19)                                               /*!< QSPI_T::STATUS: TXUFIF Position         */
+#define QSPI_STATUS_TXUFIF_Msk            (0x1ul << QSPI_STATUS_TXUFIF_Pos)                  /*!< QSPI_T::STATUS: TXUFIF Mask             */
+
+#define QSPI_STATUS_TXRXRST_Pos           (23)                                               /*!< QSPI_T::STATUS: TXRXRST Position        */
+#define QSPI_STATUS_TXRXRST_Msk           (0x1ul << QSPI_STATUS_TXRXRST_Pos)                 /*!< QSPI_T::STATUS: TXRXRST Mask            */
+
+#define QSPI_STATUS_RXCNT_Pos             (24)                                               /*!< QSPI_T::STATUS: RXCNT Position          */
+#define QSPI_STATUS_RXCNT_Msk             (0xful << QSPI_STATUS_RXCNT_Pos)                   /*!< QSPI_T::STATUS: RXCNT Mask              */
+
+#define QSPI_STATUS_TXCNT_Pos             (28)                                               /*!< QSPI_T::STATUS: TXCNT Position          */
+#define QSPI_STATUS_TXCNT_Msk             (0xful << QSPI_STATUS_TXCNT_Pos)                   /*!< QSPI_T::STATUS: TXCNT Mask              */
+
+#define QSPI_TX_TX_Pos                    (0)                                                /*!< QSPI_T::TX: TX Position                 */
+#define QSPI_TX_TX_Msk                    (0xfffffffful << QSPI_TX_TX_Pos)                   /*!< QSPI_T::TX: TX Mask                     */
+
+#define QSPI_RX_RX_Pos                    (0)                                                /*!< QSPI_T::RX: RX Position                 */
+#define QSPI_RX_RX_Msk                    (0xfffffffful << QSPI_RX_RX_Pos)                   /*!< QSPI_T::RX: RX Mask                     */
+
+
+/**@}*/ /* QSPI_CONST */
+/**@}*/ /* end of QSPI register group */
+/**@}*/ /* end of REGISTER group */
+
+#define QSPI0                  ((QSPI_T *)   QSPI0_BA)
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup QSPI_Driver QSPI Driver
+  @{
+*/
+
+/** @addtogroup QSPI_EXPORTED_CONSTANTS QSPI Exported Constants
+  @{
+*/
+
+#define QSPI_MODE_0        (QSPI_CTL_TXNEG_Msk)                             /*!< CLKPOL=0; RXNEG=0; TXNEG=1 \hideinitializer */
+#define QSPI_MODE_1        (QSPI_CTL_RXNEG_Msk)                             /*!< CLKPOL=0; RXNEG=1; TXNEG=0 \hideinitializer */
+#define QSPI_MODE_2        (QSPI_CTL_CLKPOL_Msk | QSPI_CTL_RXNEG_Msk)       /*!< CLKPOL=1; RXNEG=1; TXNEG=0 \hideinitializer */
+#define QSPI_MODE_3        (QSPI_CTL_CLKPOL_Msk | QSPI_CTL_TXNEG_Msk)       /*!< CLKPOL=1; RXNEG=0; TXNEG=1 \hideinitializer */
+
+#define QSPI_SLAVE         (QSPI_CTL_SLAVE_Msk)                             /*!< Set as slave \hideinitializer */
+#define QSPI_MASTER        (0x0U)                                           /*!< Set as master \hideinitializer */
+
+#define QSPI_SS                (QSPI_SSCTL_SS_Msk)                          /*!< Set SS \hideinitializer */
+#define QSPI_SS_ACTIVE_HIGH    (QSPI_SSCTL_SSACTPOL_Msk)                    /*!< SS active high \hideinitializer */
+#define QSPI_SS_ACTIVE_LOW     (0x0U)                                       /*!< SS active low \hideinitializer */
+
+/* QSPI Interrupt Mask */
+#define QSPI_UNIT_INT_MASK                (0x001U)                          /*!< Unit transfer interrupt mask \hideinitializer */
+#define QSPI_SSACT_INT_MASK               (0x002U)                          /*!< Slave selection signal active interrupt mask \hideinitializer */
+#define QSPI_SSINACT_INT_MASK             (0x004U)                          /*!< Slave selection signal inactive interrupt mask \hideinitializer */
+#define QSPI_SLVUR_INT_MASK               (0x008U)                          /*!< Slave under run interrupt mask \hideinitializer */
+#define QSPI_SLVBE_INT_MASK               (0x010U)                          /*!< Slave bit count error interrupt mask \hideinitializer */
+#define QSPI_TXUF_INT_MASK                (0x040U)                          /*!< Slave TX underflow interrupt mask \hideinitializer */
+#define QSPI_FIFO_TXTH_INT_MASK           (0x080U)                          /*!< FIFO TX threshold interrupt mask \hideinitializer */
+#define QSPI_FIFO_RXTH_INT_MASK           (0x100U)                          /*!< FIFO RX threshold interrupt mask \hideinitializer */
+#define QSPI_FIFO_RXOV_INT_MASK           (0x200U)                          /*!< FIFO RX overrun interrupt mask \hideinitializer */
+#define QSPI_FIFO_RXTO_INT_MASK           (0x400U)                          /*!< FIFO RX time-out interrupt mask \hideinitializer */
+
+/* QSPI Status Mask */
+#define QSPI_BUSY_MASK                    (0x01U)                           /*!< Busy status mask \hideinitializer */
+#define QSPI_RX_EMPTY_MASK                (0x02U)                           /*!< RX empty status mask \hideinitializer */
+#define QSPI_RX_FULL_MASK                 (0x04U)                           /*!< RX full status mask \hideinitializer */
+#define QSPI_TX_EMPTY_MASK                (0x08U)                           /*!< TX empty status mask \hideinitializer */
+#define QSPI_TX_FULL_MASK                 (0x10U)                           /*!< TX full status mask \hideinitializer */
+#define QSPI_TXRX_RESET_MASK              (0x20U)                           /*!< TX or RX reset status mask \hideinitializer */
+#define QSPI_QSPIEN_STS_MASK              (0x40U)                           /*!< QSPIEN status mask \hideinitializer */
+#define QSPI_SSLINE_STS_MASK              (0x80U)                           /*!< QSPIx_SS line status mask \hideinitializer */
+
+/*@}*/ /* end of group QSPI_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup QSPI_EXPORTED_FUNCTIONS QSPI Exported Functions
+  @{
+*/
+
+/**
+  * @brief      Clear the unit transfer interrupt flag.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Write 1 to UNITIF bit of QSPI_STATUS register to clear the unit transfer interrupt flag.
+  * \hideinitializer
+  */
+#define QSPI_CLR_UNIT_TRANS_INT_FLAG(qspi)   ((qspi)->STATUS = QSPI_STATUS_UNITIF_Msk)
+
+/**
+  * @brief      Trigger RX PDMA function.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Set RXPDMAEN bit of QSPI_PDMACTL register to enable RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define QSPI_TRIGGER_RX_PDMA(qspi)   ((qspi)->PDMACTL |= QSPI_PDMACTL_RXPDMAEN_Msk)
+
+/**
+  * @brief      Trigger TX PDMA function.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Set TXPDMAEN bit of QSPI_PDMACTL register to enable TX PDMA transfer function.
+  * \hideinitializer
+  */
+#define QSPI_TRIGGER_TX_PDMA(qspi)   ((qspi)->PDMACTL |= QSPI_PDMACTL_TXPDMAEN_Msk)
+
+/**
+  * @brief      Disable RX PDMA transfer.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Clear RXPDMAEN bit of QSPI_PDMACTL register to disable RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define QSPI_DISABLE_RX_PDMA(qspi) ( (qspi)->PDMACTL &= ~QSPI_PDMACTL_RXPDMAEN_Msk )
+
+/**
+  * @brief      Disable TX PDMA transfer.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Clear TXPDMAEN bit of QSPI_PDMACTL register to disable TX PDMA transfer function.
+  * \hideinitializer
+  */
+#define QSPI_DISABLE_TX_PDMA(qspi) ( (qspi)->PDMACTL &= ~QSPI_PDMACTL_TXPDMAEN_Msk )
+
+/**
+  * @brief      Get the count of available data in RX FIFO.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     The count of available data in RX FIFO.
+  * @details    Read RXCNT (QSPI_STATUS[27:24]) to get the count of available data in RX FIFO.
+  * \hideinitializer
+  */
+#define QSPI_GET_RX_FIFO_COUNT(qspi)   (((qspi)->STATUS & QSPI_STATUS_RXCNT_Msk) >> QSPI_STATUS_RXCNT_Pos)
+
+/**
+  * @brief      Get the RX FIFO empty flag.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @retval     0 RX FIFO is not empty.
+  * @retval     1 RX FIFO is empty.
+  * @details    Read RXEMPTY bit of QSPI_STATUS register to get the RX FIFO empty flag.
+  * \hideinitializer
+  */
+#define QSPI_GET_RX_FIFO_EMPTY_FLAG(qspi)   (((qspi)->STATUS & QSPI_STATUS_RXEMPTY_Msk)>>QSPI_STATUS_RXEMPTY_Pos)
+
+/**
+  * @brief      Get the TX FIFO empty flag.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @retval     0 TX FIFO is not empty.
+  * @retval     1 TX FIFO is empty.
+  * @details    Read TXEMPTY bit of QSPI_STATUS register to get the TX FIFO empty flag.
+  * \hideinitializer
+  */
+#define QSPI_GET_TX_FIFO_EMPTY_FLAG(qspi)   (((qspi)->STATUS & QSPI_STATUS_TXEMPTY_Msk)>>QSPI_STATUS_TXEMPTY_Pos)
+
+/**
+  * @brief      Get the TX FIFO full flag.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @retval     0 TX FIFO is not full.
+  * @retval     1 TX FIFO is full.
+  * @details    Read TXFULL bit of QSPI_STATUS register to get the TX FIFO full flag.
+  * \hideinitializer
+  */
+#define QSPI_GET_TX_FIFO_FULL_FLAG(qspi)   (((qspi)->STATUS & QSPI_STATUS_TXFULL_Msk)>>QSPI_STATUS_TXFULL_Pos)
+
+/**
+  * @brief      Get the datum read from RX register.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     Data in RX register.
+  * @details    Read QSPI_RX register to get the received datum.
+  * \hideinitializer
+  */
+#define QSPI_READ_RX(qspi)   ((qspi)->RX)
+
+/**
+  * @brief      Write datum to TX register.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @param[in]  u32TxData The datum which user attempt to transfer through QSPI bus.
+  * @return     None.
+  * @details    Write u32TxData to QSPI_TX register.
+  * \hideinitializer
+  */
+#define QSPI_WRITE_TX(qspi, u32TxData)   ((qspi)->TX = (u32TxData))
+
+/**
+  * @brief      Set QSPIx_SS pin to high state.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Disable automatic slave selection function and set QSPIx_SS pin to high state.
+  * \hideinitializer
+  */
+#define QSPI_SET_SS_HIGH(qspi)   ((qspi)->SSCTL = ((qspi)->SSCTL & (~QSPI_SSCTL_AUTOSS_Msk)) | (QSPI_SSCTL_SSACTPOL_Msk | QSPI_SSCTL_SS_Msk))
+
+/**
+  * @brief      Set QSPIx_SS pin to low state.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Disable automatic slave selection function and set QSPIx_SS pin to low state.
+  * \hideinitializer
+  */
+#define QSPI_SET_SS_LOW(qspi)   ((qspi)->SSCTL = ((qspi)->SSCTL & (~(QSPI_SSCTL_AUTOSS_Msk | QSPI_SSCTL_SSACTPOL_Msk))) | QSPI_SSCTL_SS_Msk)
+
+/**
+  * @brief      Enable Byte Reorder function.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Enable Byte Reorder function. The suspend interval depends on the setting of SUSPITV (QSPI_CTL[7:4]).
+  * \hideinitializer
+  */
+#define QSPI_ENABLE_BYTE_REORDER(qspi)   ((qspi)->CTL |=  QSPI_CTL_REORDER_Msk)
+
+/**
+  * @brief      Disable Byte Reorder function.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Clear REORDER bit field of QSPI_CTL register to disable Byte Reorder function.
+  * \hideinitializer
+  */
+#define QSPI_DISABLE_BYTE_REORDER(qspi)   ((qspi)->CTL &= ~QSPI_CTL_REORDER_Msk)
+
+/**
+  * @brief      Set the length of suspend interval.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @param[in]  u32SuspCycle Decides the length of suspend interval. It could be 0 ~ 15.
+  * @return     None.
+  * @details    Set the length of suspend interval according to u32SuspCycle.
+  *             The length of suspend interval is ((u32SuspCycle + 0.5) * the length of one QSPI bus clock cycle).
+  * \hideinitializer
+  */
+#define QSPI_SET_SUSPEND_CYCLE(qspi, u32SuspCycle)   ((qspi)->CTL = ((qspi)->CTL & ~QSPI_CTL_SUSPITV_Msk) | ((u32SuspCycle) << QSPI_CTL_SUSPITV_Pos))
+
+/**
+  * @brief      Set the QSPI transfer sequence with LSB first.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Set LSB bit of QSPI_CTL register to set the QSPI transfer sequence with LSB first.
+  * \hideinitializer
+  */
+#define QSPI_SET_LSB_FIRST(qspi)   ((qspi)->CTL |= QSPI_CTL_LSB_Msk)
+
+/**
+  * @brief      Set the QSPI transfer sequence with MSB first.
+  * @param[in]  qspi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Clear LSB bit of QSPI_CTL register to set the QSPI transfer sequence with MSB first.
+  * \hideinitializer
+  */
+#define QSPI_SET_MSB_FIRST(qspi)   ((qspi)->CTL &= ~QSPI_CTL_LSB_Msk)
+
+/**
+  * @brief      Set the data width of a QSPI transaction.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @param[in]  u32Width The bit width of one transaction.
+  * @return     None.
+  * @details    The data width can be 8 ~ 32 bits.
+  * \hideinitializer
+  */
+#define QSPI_SET_DATA_WIDTH(qspi, u32Width)   ((qspi)->CTL = ((qspi)->CTL & ~QSPI_CTL_DWIDTH_Msk) | (((u32Width)&0x1F) << QSPI_CTL_DWIDTH_Pos))
+
+/**
+  * @brief      Get the QSPI busy state.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @retval     0 QSPI controller is not busy.
+  * @retval     1 QSPI controller is busy.
+  * @details    This macro will return the busy state of QSPI controller.
+  * \hideinitializer
+  */
+#define QSPI_IS_BUSY(qspi)   ( ((qspi)->STATUS & QSPI_STATUS_BUSY_Msk)>>QSPI_STATUS_BUSY_Pos )
+
+/**
+  * @brief      Enable QSPI controller.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Set QSPIEN (QSPI_CTL[0]) to enable QSPI controller.
+  * \hideinitializer
+  */
+#define QSPI_ENABLE(qspi)   ((qspi)->CTL |= QSPI_CTL_QSPIEN_Msk)
+
+/**
+  * @brief      Disable QSPI controller.
+  * @param[in]  qspi The pointer of the specified QSPI module.
+  * @return     None.
+  * @details    Clear QSPIEN (QSPI_CTL[0]) to disable QSPI controller.
+  * \hideinitializer
+  */
+#define QSPI_DISABLE(qspi)   ((qspi)->CTL &= ~QSPI_CTL_QSPIEN_Msk)
+
+/**
+  * @brief  Disable QSPI Dual IO function.
+  * @param[in]  qspi is the base address of QSPI module.
+  * @return none
+  * \hideinitializer
+  */
+#define QSPI_DISABLE_DUAL_MODE(qspi) ( (qspi)->CTL &= ~QSPI_CTL_DUALIOEN_Msk )
+
+/**
+  * @brief  Enable Dual IO function and set QSPI Dual IO direction to input.
+  * @param[in]  qspi is the base address of QSPI module.
+  * @return none
+  * \hideinitializer
+  */
+#define QSPI_ENABLE_DUAL_INPUT_MODE(qspi) ( (qspi)->CTL = ((qspi)->CTL & ~QSPI_CTL_DATDIR_Msk) | QSPI_CTL_DUALIOEN_Msk )
+
+/**
+  * @brief  Enable Dual IO function and set QSPI Dual IO direction to output.
+  * @param[in]  qspi is the base address of QSPI module.
+  * @return none
+  * \hideinitializer
+  */
+#define QSPI_ENABLE_DUAL_OUTPUT_MODE(qspi) ( (qspi)->CTL |= QSPI_CTL_DATDIR_Msk | QSPI_CTL_DUALIOEN_Msk )
+
+/**
+  * @brief  Disable QSPI Dual IO function.
+  * @param[in]  qspi is the base address of QSPI module.
+  * @return none
+  * \hideinitializer
+  */
+#define QSPI_DISABLE_QUAD_MODE(qspi) ( (qspi)->CTL &= ~QSPI_CTL_QUADIOEN_Msk )
+
+/**
+  * @brief  Set QSPI Quad IO direction to input.
+  * @param[in]  qspi is the base address of QSPI module.
+  * @return none
+  * \hideinitializer
+  */
+#define QSPI_ENABLE_QUAD_INPUT_MODE(qspi) ( (qspi)->CTL = ((qspi)->CTL & ~QSPI_CTL_DATDIR_Msk) | QSPI_CTL_QUADIOEN_Msk )
+
+/**
+  * @brief  Set QSPI Quad IO direction to output.
+  * @param[in]  qspi is the base address of QSPI module.
+  * @return none
+  * \hideinitializer
+  */
+#define QSPI_ENABLE_QUAD_OUTPUT_MODE(qspi) ( (qspi)->CTL |= QSPI_CTL_DATDIR_Msk | QSPI_CTL_QUADIOEN_Msk )
+
+
+
+
+/* Function prototype declaration */
+uint32_t QSPI_Open(QSPI_T *qspi, uint32_t u32MasterSlave, uint32_t u32QSPIMode, uint32_t u32DataWidth, uint32_t u32BusClock);
+void QSPI_Close(QSPI_T *qspi);
+void QSPI_ClearRxFIFO(QSPI_T *qspi);
+void QSPI_ClearTxFIFO(QSPI_T *qspi);
+void QSPI_DisableAutoSS(QSPI_T *qspi);
+void QSPI_EnableAutoSS(QSPI_T *qspi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel);
+uint32_t QSPI_SetBusClock(QSPI_T *qspi, uint32_t u32BusClock);
+void QSPI_SetFIFO(QSPI_T *qspi, uint32_t u32TxThreshold, uint32_t u32RxThreshold);
+uint32_t QSPI_GetBusClock(QSPI_T *qspi);
+void QSPI_EnableInt(QSPI_T *qspi, uint32_t u32Mask);
+void QSPI_DisableInt(QSPI_T *qspi, uint32_t u32Mask);
+uint32_t QSPI_GetIntFlag(QSPI_T *qspi, uint32_t u32Mask);
+void QSPI_ClearIntFlag(QSPI_T *qspi, uint32_t u32Mask);
+uint32_t QSPI_GetStatus(QSPI_T *qspi, uint32_t u32Mask);
+
+
+/*@}*/ /* end of group QSPI_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group QSPI_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

+ 445 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_rtc.h

@@ -0,0 +1,445 @@
+/**************************************************************************//**
+ * @file     rtc.h
+ * @version  V3.00
+ * @brief    NUC980 series RTC driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_RTC_H__
+#define __NU_RTC_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "nuc980.h"
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup RTC_Driver RTC Driver
+  @{
+*/
+
+/** @addtogroup RTC_EXPORTED_CONSTANTS RTC Exported Constants
+  @{
+*/
+/*---------------------------------------------------------------------------------------------------------*/
+/*  RTC Initial Keyword Constant Definitions                                                               */
+/*---------------------------------------------------------------------------------------------------------*/
+#define RTC_INIT_KEY            0xA5EB1357UL    /*!< RTC Initiation Key to make RTC leaving reset state \hideinitializer */
+#define RTC_WRITE_KEY           0x0000A965UL    /*!< RTC Register Access Enable Key to enable RTC read/write accessible and kept 1024 RTC clock \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  RTC Time Attribute Constant Definitions                                                                */
+/*---------------------------------------------------------------------------------------------------------*/
+#define RTC_CLOCK_12            0UL               /*!< RTC as 12-hour time scale with AM and PM indication \hideinitializer */
+#define RTC_CLOCK_24            1UL               /*!< RTC as 24-hour time scale \hideinitializer */
+#define RTC_AM                  1UL               /*!< RTC as AM indication \hideinitializer */
+#define RTC_PM                  2UL               /*!< RTC as PM indication \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  RTC Tick Period Constant Definitions                                                                   */
+/*---------------------------------------------------------------------------------------------------------*/
+#define RTC_TICK_1_SEC          0x0UL           /*!< RTC time tick period is 1 second \hideinitializer */
+#define RTC_TICK_1_2_SEC        0x1UL           /*!< RTC time tick period is 1/2 second \hideinitializer */
+#define RTC_TICK_1_4_SEC        0x2UL           /*!< RTC time tick period is 1/4 second \hideinitializer */
+#define RTC_TICK_1_8_SEC        0x3UL           /*!< RTC time tick period is 1/8 second \hideinitializer */
+#define RTC_TICK_1_16_SEC       0x4UL           /*!< RTC time tick period is 1/16 second \hideinitializer */
+#define RTC_TICK_1_32_SEC       0x5UL           /*!< RTC time tick period is 1/32 second \hideinitializer */
+#define RTC_TICK_1_64_SEC       0x6UL           /*!< RTC time tick period is 1/64 second \hideinitializer */
+#define RTC_TICK_1_128_SEC      0x7UL           /*!< RTC time tick period is 1/128 second \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  RTC Day of Week Constant Definitions                                                                   */
+/*---------------------------------------------------------------------------------------------------------*/
+#define RTC_SUNDAY              0x0UL           /*!< Day of the Week is Sunday \hideinitializer */
+#define RTC_MONDAY              0x1UL           /*!< Day of the Week is Monday \hideinitializer */
+#define RTC_TUESDAY             0x2UL           /*!< Day of the Week is Tuesday \hideinitializer */
+#define RTC_WEDNESDAY           0x3UL           /*!< Day of the Week is Wednesday \hideinitializer */
+#define RTC_THURSDAY            0x4UL           /*!< Day of the Week is Thursday \hideinitializer */
+#define RTC_FRIDAY              0x5UL           /*!< Day of the Week is Friday \hideinitializer */
+#define RTC_SATURDAY            0x6UL           /*!< Day of the Week is Saturday \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/*  RTC Miscellaneous Constant Definitions                                                                         */
+/*---------------------------------------------------------------------------------------------------------*/
+#define RTC_WAIT_COUNT          0xFFFFFFFFUL      /*!< Initial Time-out Value \hideinitializer */
+#define RTC_YEAR2000            2000UL            /*!< RTC Reference for compute year data \hideinitializer */
+#define RTC_FCR_REFERENCE       32761UL           /*!< RTC Reference for frequency compensation \hideinitializer */
+
+#define RTC_2POW10_CLK  (0x0 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 RTC clock cycles \hideinitializer */
+#define RTC_2POW11_CLK  (0x1 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 x 2 RTC clock cycles \hideinitializer */
+#define RTC_2POW12_CLK  (0x2 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 x 4 RTC clock cycles \hideinitializer */
+#define RTC_2POW13_CLK  (0x3 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 x 6 RTC clock cycles \hideinitializer */
+#define RTC_2POW14_CLK  (0x4 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 x 8 RTC clock cycles \hideinitializer */
+#define RTC_2POW15_CLK  (0x5 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 x 16 RTC clock cycles \hideinitializer */
+#define RTC_2POW16_CLK  (0x6 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 x 32 RTC clock cycles \hideinitializer */
+#define RTC_2POW17_CLK  (0x7 << RTC_TAMPCTL_DYNRATE_Pos) /*!< 1024 x 64 RTC clock cycles \hideinitializer */
+
+#define REF_RANDOM_PATTERN    0x0 /*!< The new reference pattern is generated by random number generator when the reference pattern run out \hideinitializer */
+#define REF_PREVIOUS_PATTERN  0x1 /*!< The new reference pattern is repeated previous random value when the reference pattern run out \hideinitializer */
+#define REF_SEED              0x3 /*!< The new reference pattern is repeated from SEED (RTC_TAMPSEED[31:0]) when the reference pattern run out \hideinitializer */
+
+/*@}*/ /* end of group RTC_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup RTC_EXPORTED_STRUCTS RTC Exported Structs
+  @{
+*/
+/**
+  * @details    RTC define Time Data Struct
+  */
+typedef struct
+{
+    uint32_t u32Year;           /*!< Year value */
+    uint32_t u32Month;          /*!< Month value */
+    uint32_t u32Day;            /*!< Day value */
+    uint32_t u32DayOfWeek;      /*!< Day of week value */
+    uint32_t u32Hour;           /*!< Hour value */
+    uint32_t u32Minute;         /*!< Minute value */
+    uint32_t u32Second;         /*!< Second value */
+    uint32_t u32TimeScale;      /*!< 12-Hour, 24-Hour */
+    uint32_t u32AmPm;           /*!< Only Time Scale select 12-hr used */
+} S_RTC_TIME_DATA_T;
+
+/*@}*/ /* end of group RTC_EXPORTED_STRUCTS */
+
+
+typedef struct
+{
+    uint32_t INIT;                  /*!< [0x0000] RTC Initiation Register                                          */
+    uint32_t RWEN;                  /*!< [0x0004] RTC Access Enable Register                                       */
+    uint32_t FREQADJ;               /*!< [0x0008] RTC Frequency Compensation Register                              */
+    uint32_t TIME;                  /*!< [0x000c] RTC Time Loading Register                                        */
+    uint32_t CAL;                   /*!< [0x0010] RTC Calendar Loading Register                                    */
+    uint32_t CLKFMT;                /*!< [0x0014] RTC Time Scale Selection Register                                */
+    uint32_t WEEKDAY;               /*!< [0x0018] RTC Day of the Week Register                                     */
+    uint32_t TALM;                  /*!< [0x001c] RTC Time Alarm Register                                          */
+    uint32_t CALM;                  /*!< [0x0020] RTC Calendar Alarm Register                                      */
+    uint32_t LEAPYEAR;              /*!< [0x0024] RTC Leap Year Indicator Register                                 */
+    uint32_t INTEN;                 /*!< [0x0028] RTC Interrupt Enable Register                                    */
+    uint32_t INTSTS;                /*!< [0x002c] RTC Interrupt Status Register                                    */
+    uint32_t TICK;                  /*!< [0x0030] RTC Time Tick Register                                           */
+    uint32_t PWRCTL;                 /*!< [0x0034] RTC Power Control Register                                     */
+    uint32_t PWRCNT;                 /*!< [0x0038] RTC Power Control Counter Register                                 */
+    uint32_t RESERVE0;                /*!< [0x003c] RTC Spare Functional Control Register                            */
+    uint32_t SPR[16];               /*!< [0x0040] ~ [0x007c] RTC Spare Register 0 ~ 15                             */
+} RTC_T;
+
+#define RTC_INIT_ACTIVE_Pos         (0)                                               /*!< RTC_T::INIT: INIT_ACTIVE Position      */
+#define RTC_INIT_ACTIVE_Msk         (0x1ul << RTC_INIT_ACTIVE_Pos)               /*!< RTC_T::INIT: INIT_ACTIVE Mask          */
+
+#define RTC_INIT_INIT_Pos                (1)                                               /*!< RTC_T::INIT: INIT Position             */
+#define RTC_INIT_INIT_Msk                (0x7ffffffful << RTC_INIT_INIT_Pos)               /*!< RTC_T::INIT: INIT Mask                 */
+
+#define RTC_RWEN_RWENF_Pos               (16)                                              /*!< RTC_T::RWEN: RWENF Position            */
+#define RTC_RWEN_RWENF_Msk               (0x1ul << RTC_RWEN_RWENF_Pos)                     /*!< RTC_T::RWEN: RWENF Mask                */
+
+#define RTC_RWEN_RTCBUSY_Pos             (24)                                              /*!< RTC_T::RWEN: RTCBUSY Position          */
+#define RTC_RWEN_RTCBUSY_Msk             (0x1ul << RTC_RWEN_RTCBUSY_Pos)                   /*!< RTC_T::RWEN: RTCBUSY Mask              */
+
+#define RTC_FREQADJ_FRACTION_Pos          (0)                                              /*!< RTC_T::FRACTION: FRACTION Position       */
+#define RTC_FREQADJ_FRACTION_Msk          (0x3ful << RTC_FREQADJ_FRACTION_Pos)             /*!< RTC_T::FRACTION: FRACTION Mask           */
+
+#define RTC_INTEGER_FRACTION_Pos          (8)                                              /*!< RTC_T::INTEGER: INTEGER Position       */
+#define RTC_INTEGER_FRACTION_Msk          (0xful << RTC_FREQADJ_INTEGER_Pos)               /*!< RTC_T::INTEGER: INTEGER Mask           */
+
+#define RTC_TIME_SEC_Pos                 (0)                                               /*!< RTC_T::TIME: SEC Position              */
+#define RTC_TIME_SEC_Msk                 (0xful << RTC_TIME_SEC_Pos)                       /*!< RTC_T::TIME: SEC Mask                  */
+
+#define RTC_TIME_TENSEC_Pos              (4)                                               /*!< RTC_T::TIME: TENSEC Position           */
+#define RTC_TIME_TENSEC_Msk              (0x7ul << RTC_TIME_TENSEC_Pos)                    /*!< RTC_T::TIME: TENSEC Mask               */
+
+#define RTC_TIME_MIN_Pos                 (8)                                               /*!< RTC_T::TIME: MIN Position              */
+#define RTC_TIME_MIN_Msk                 (0xful << RTC_TIME_MIN_Pos)                       /*!< RTC_T::TIME: MIN Mask                  */
+
+#define RTC_TIME_TENMIN_Pos              (12)                                              /*!< RTC_T::TIME: TENMIN Position           */
+#define RTC_TIME_TENMIN_Msk              (0x7ul << RTC_TIME_TENMIN_Pos)                    /*!< RTC_T::TIME: TENMIN Mask               */
+
+#define RTC_TIME_HR_Pos                  (16)                                              /*!< RTC_T::TIME: HR Position               */
+#define RTC_TIME_HR_Msk                  (0xful << RTC_TIME_HR_Pos)                        /*!< RTC_T::TIME: HR Mask                   */
+
+#define RTC_TIME_TENHR_Pos               (20)                                              /*!< RTC_T::TIME: TENHR Position            */
+#define RTC_TIME_TENHR_Msk               (0x3ul << RTC_TIME_TENHR_Pos)                     /*!< RTC_T::TIME: TENHR Mask                */
+
+#define RTC_CAL_DAY_Pos                  (0)                                               /*!< RTC_T::CAL: DAY Position               */
+#define RTC_CAL_DAY_Msk                  (0xful << RTC_CAL_DAY_Pos)                        /*!< RTC_T::CAL: DAY Mask                   */
+
+#define RTC_CAL_TENDAY_Pos               (4)                                               /*!< RTC_T::CAL: TENDAY Position            */
+#define RTC_CAL_TENDAY_Msk               (0x3ul << RTC_CAL_TENDAY_Pos)                     /*!< RTC_T::CAL: TENDAY Mask                */
+
+#define RTC_CAL_MON_Pos                  (8)                                               /*!< RTC_T::CAL: MON Position               */
+#define RTC_CAL_MON_Msk                  (0xful << RTC_CAL_MON_Pos)                        /*!< RTC_T::CAL: MON Mask                   */
+
+#define RTC_CAL_TENMON_Pos               (12)                                              /*!< RTC_T::CAL: TENMON Position            */
+#define RTC_CAL_TENMON_Msk               (0x1ul << RTC_CAL_TENMON_Pos)                     /*!< RTC_T::CAL: TENMON Mask                */
+
+#define RTC_CAL_YEAR_Pos                 (16)                                              /*!< RTC_T::CAL: YEAR Position              */
+#define RTC_CAL_YEAR_Msk                 (0xful << RTC_CAL_YEAR_Pos)                       /*!< RTC_T::CAL: YEAR Mask                  */
+
+#define RTC_CAL_TENYEAR_Pos              (20)                                              /*!< RTC_T::CAL: TENYEAR Position           */
+#define RTC_CAL_TENYEAR_Msk              (0xful << RTC_CAL_TENYEAR_Pos)                    /*!< RTC_T::CAL: TENYEAR Mask               */
+
+#define RTC_CLKFMT_24HEN_Pos             (0)                                               /*!< RTC_T::CLKFMT: 24HEN Position          */
+#define RTC_CLKFMT_24HEN_Msk             (0x1ul << RTC_CLKFMT_24HEN_Pos)                   /*!< RTC_T::CLKFMT: 24HEN Mask              */
+
+#define RTC_WEEKDAY_WEEKDAY_Pos          (0)                                               /*!< RTC_T::WEEKDAY: WEEKDAY Position       */
+#define RTC_WEEKDAY_WEEKDAY_Msk          (0x7ul << RTC_WEEKDAY_WEEKDAY_Pos)                /*!< RTC_T::WEEKDAY: WEEKDAY Mask           */
+
+#define RTC_TALM_SEC_Pos                 (0)                                               /*!< RTC_T::TALM: SEC Position              */
+#define RTC_TALM_SEC_Msk                 (0xful << RTC_TALM_SEC_Pos)                       /*!< RTC_T::TALM: SEC Mask                  */
+
+#define RTC_TALM_TENSEC_Pos              (4)                                               /*!< RTC_T::TALM: TENSEC Position           */
+#define RTC_TALM_TENSEC_Msk              (0x7ul << RTC_TALM_TENSEC_Pos)                    /*!< RTC_T::TALM: TENSEC Mask               */
+
+#define RTC_TALM_MIN_Pos                 (8)                                               /*!< RTC_T::TALM: MIN Position              */
+#define RTC_TALM_MIN_Msk                 (0xful << RTC_TALM_MIN_Pos)                       /*!< RTC_T::TALM: MIN Mask                  */
+
+#define RTC_TALM_TENMIN_Pos              (12)                                              /*!< RTC_T::TALM: TENMIN Position           */
+#define RTC_TALM_TENMIN_Msk              (0x7ul << RTC_TALM_TENMIN_Pos)                    /*!< RTC_T::TALM: TENMIN Mask               */
+
+#define RTC_TALM_HR_Pos                  (16)                                              /*!< RTC_T::TALM: HR Position               */
+#define RTC_TALM_HR_Msk                  (0xful << RTC_TALM_HR_Pos)                        /*!< RTC_T::TALM: HR Mask                   */
+
+#define RTC_TALM_TENHR_Pos               (20)                                              /*!< RTC_T::TALM: TENHR Position            */
+#define RTC_TALM_TENHR_Msk               (0x3ul << RTC_TALM_TENHR_Pos)                     /*!< RTC_T::TALM: TENHR Mask                */
+
+#define RTC_CALM_DAY_Pos                 (0)                                               /*!< RTC_T::CALM: DAY Position              */
+#define RTC_CALM_DAY_Msk                 (0xful << RTC_CALM_DAY_Pos)                       /*!< RTC_T::CALM: DAY Mask                  */
+
+#define RTC_CALM_TENDAY_Pos              (4)                                               /*!< RTC_T::CALM: TENDAY Position           */
+#define RTC_CALM_TENDAY_Msk              (0x3ul << RTC_CALM_TENDAY_Pos)                    /*!< RTC_T::CALM: TENDAY Mask               */
+
+#define RTC_CALM_MON_Pos                 (8)                                               /*!< RTC_T::CALM: MON Position              */
+#define RTC_CALM_MON_Msk                 (0xful << RTC_CALM_MON_Pos)                       /*!< RTC_T::CALM: MON Mask                  */
+
+#define RTC_CALM_TENMON_Pos              (12)                                              /*!< RTC_T::CALM: TENMON Position           */
+#define RTC_CALM_TENMON_Msk              (0x1ul << RTC_CALM_TENMON_Pos)                    /*!< RTC_T::CALM: TENMON Mask               */
+
+#define RTC_CALM_YEAR_Pos                (16)                                              /*!< RTC_T::CALM: YEAR Position             */
+#define RTC_CALM_YEAR_Msk                (0xful << RTC_CALM_YEAR_Pos)                      /*!< RTC_T::CALM: YEAR Mask                 */
+
+#define RTC_CALM_TENYEAR_Pos             (20)                                              /*!< RTC_T::CALM: TENYEAR Position          */
+#define RTC_CALM_TENYEAR_Msk             (0xful << RTC_CALM_TENYEAR_Pos)                   /*!< RTC_T::CALM: TENYEAR Mask              */
+
+#define RTC_LEAPYEAR_LEAPYEAR_Pos        (0)                                               /*!< RTC_T::LEAPYEAR: LEAPYEAR Position     */
+#define RTC_LEAPYEAR_LEAPYEAR_Msk        (0x1ul << RTC_LEAPYEAR_LEAPYEAR_Pos)              /*!< RTC_T::LEAPYEAR: LEAPYEAR Mask         */
+
+#define RTC_INTEN_ALMIEN_Pos             (0)                                               /*!< RTC_T::INTEN: ALMIEN Position          */
+#define RTC_INTEN_ALMIEN_Msk             (0x1ul << RTC_INTEN_ALMIEN_Pos)                   /*!< RTC_T::INTEN: ALMIEN Mask              */
+
+#define RTC_INTEN_TICKIEN_Pos            (1)                                               /*!< RTC_T::INTEN: TICKIEN Position         */
+#define RTC_INTEN_TICKIEN_Msk            (0x1ul << RTC_INTEN_TICKIEN_Pos)                  /*!< RTC_T::INTEN: TICKIEN Mask             */
+
+#define RTC_INTEN_WAKEUPIEN_Pos          (2)                                               /*!< RTC INTEN: WAKEUPIEN Position            */
+#define RTC_INTEN_WAKEUPIEN_Msk          (0x1ul << RTC_INTEN_WAKEUPIEN_Pos)                /*!< RTC INTEN: WAKEUPIEN Mask                */
+
+#define RTC_INTEN_RELALMIEN_Pos          (4)                                               /*!< RTC INTEN: RELALMIEN Position            */
+#define RTC_INTEN_RELALMIEN_Msk          (0x1ul << RTC_INTEN_RELALMIEN_Pos)                /*!< RTC INTEN: RELALMIEN Mask                */
+
+#define RTC_INTSTS_ALMIF_Pos             (0)                                               /*!< RTC_T::INTSTS: ALMIF Position          */
+#define RTC_INTSTS_ALMIF_Msk             (0x1ul << RTC_INTSTS_ALMIF_Pos)                   /*!< RTC_T::INTSTS: ALMIF Mask              */
+
+#define RTC_INTSTS_TICKIF_Pos            (1)                                               /*!< RTC_T::INTSTS: TICKIF Position         */
+#define RTC_INTSTS_TICKIF_Msk            (0x1ul << RTC_INTSTS_TICKIF_Pos)                  /*!< RTC_T::INTSTS: TICKIF Mask             */
+
+#define RTC_INTSTS_WAKEUPINT_Pos          (2)                                              /*!< RTC INTSTS: WAKEUPINT Position            */
+#define RTC_INTSTS_WAKEUPINT_Msk          (0x1ul << RTC_INTSTS_WAKEUPINT_Pos)              /*!< RTC INTSTS: WAKEUPINT Mask                */
+
+#define RTC_INTSTS_REGWRBUSY_Pos          (31)                                             /*!< RTC INTSTS: REGWRBUSY Position            */
+#define RTC_INTSTS_REGWRBUSY_Msk          (0x1ul << RTC_INTSTS_REGWRBUSY_Pos)              /*!< RTC INTSTS: REGWRBUSY Mask                */
+
+#define RTC_TICK_TICK_Pos                (0)                                               /*!< RTC_T::TICK: TICK Position             */
+#define RTC_TICK_TICK_Msk                (0x7ul << RTC_TICK_TICK_Pos)                      /*!< RTC_T::TICK: TICK Mask                 */
+
+#define RTC_PWRCTL_ALARM_EN_Pos          (3)
+#define RTC_PWRCTL_ALARM_EN_Msk          (0x1ul << RTC_PWRCTL_ALARM_EN_Pos)
+
+#define RTC_PWRCTL_REL_ALARM_EN_Pos      (4)
+#define RTC_PWRCTL_REL_ALARM_EN_Msk      (0x1ul << RTC_PWRCTL_REL_ALARM_EN_Pos)
+
+#define RTC_PWRCTL_RELALM_TIME_Pos       (16)
+#define RTC_PWRCTL_RELALM_TIME_Msk       (0xffful << RTC_PWRCTL_RELALM_TIME_Pos)
+
+#define RTC_SPR0_SPARE_Pos               (0)                                               /*!< RTC_T::SPR0: SPARE Position            */
+#define RTC_SPR0_SPARE_Msk               (0xfffffffful << RTC_SPR0_SPARE_Pos)              /*!< RTC_T::SPR0: SPARE Mask                */
+
+#define RTC_SPR1_SPARE_Pos               (0)                                               /*!< RTC_T::SPR1: SPARE Position            */
+#define RTC_SPR1_SPARE_Msk               (0xfffffffful << RTC_SPR1_SPARE_Pos)              /*!< RTC_T::SPR1: SPARE Mask                */
+
+#define RTC_SPR2_SPARE_Pos               (0)                                               /*!< RTC_T::SPR2: SPARE Position            */
+#define RTC_SPR2_SPARE_Msk               (0xfffffffful << RTC_SPR2_SPARE_Pos)              /*!< RTC_T::SPR2: SPARE Mask                */
+
+#define RTC_SPR3_SPARE_Pos               (0)                                               /*!< RTC_T::SPR3: SPARE Position            */
+#define RTC_SPR3_SPARE_Msk               (0xfffffffful << RTC_SPR3_SPARE_Pos)              /*!< RTC_T::SPR3: SPARE Mask                */
+
+#define RTC_SPR4_SPARE_Pos               (0)                                               /*!< RTC_T::SPR4: SPARE Position            */
+#define RTC_SPR4_SPARE_Msk               (0xfffffffful << RTC_SPR4_SPARE_Pos)              /*!< RTC_T::SPR4: SPARE Mask                */
+
+#define RTC_SPR5_SPARE_Pos               (0)                                               /*!< RTC_T::SPR5: SPARE Position            */
+#define RTC_SPR5_SPARE_Msk               (0xfffffffful << RTC_SPR5_SPARE_Pos)              /*!< RTC_T::SPR5: SPARE Mask                */
+
+#define RTC_SPR6_SPARE_Pos               (0)                                               /*!< RTC_T::SPR6: SPARE Position            */
+#define RTC_SPR6_SPARE_Msk               (0xfffffffful << RTC_SPR6_SPARE_Pos)              /*!< RTC_T::SPR6: SPARE Mask                */
+
+#define RTC_SPR7_SPARE_Pos               (0)                                               /*!< RTC_T::SPR7: SPARE Position            */
+#define RTC_SPR7_SPARE_Msk               (0xfffffffful << RTC_SPR7_SPARE_Pos)              /*!< RTC_T::SPR7: SPARE Mask                */
+
+#define RTC_SPR8_SPARE_Pos               (0)                                               /*!< RTC_T::SPR8: SPARE Position            */
+#define RTC_SPR8_SPARE_Msk               (0xfffffffful << RTC_SPR8_SPARE_Pos)              /*!< RTC_T::SPR8: SPARE Mask                */
+
+#define RTC_SPR9_SPARE_Pos               (0)                                               /*!< RTC_T::SPR9: SPARE Position            */
+#define RTC_SPR9_SPARE_Msk               (0xfffffffful << RTC_SPR9_SPARE_Pos)              /*!< RTC_T::SPR9: SPARE Mask                */
+
+#define RTC_SPR10_SPARE_Pos              (0)                                               /*!< RTC_T::SPR10: SPARE Position           */
+#define RTC_SPR10_SPARE_Msk              (0xfffffffful << RTC_SPR10_SPARE_Pos)             /*!< RTC_T::SPR10: SPARE Mask               */
+
+#define RTC_SPR11_SPARE_Pos              (0)                                               /*!< RTC_T::SPR11: SPARE Position           */
+#define RTC_SPR11_SPARE_Msk              (0xfffffffful << RTC_SPR11_SPARE_Pos)             /*!< RTC_T::SPR11: SPARE Mask               */
+
+#define RTC_SPR12_SPARE_Pos              (0)                                               /*!< RTC_T::SPR12: SPARE Position           */
+#define RTC_SPR12_SPARE_Msk              (0xfffffffful << RTC_SPR12_SPARE_Pos)             /*!< RTC_T::SPR12: SPARE Mask               */
+
+#define RTC_SPR13_SPARE_Pos              (0)                                               /*!< RTC_T::SPR13: SPARE Position           */
+#define RTC_SPR13_SPARE_Msk              (0xfffffffful << RTC_SPR13_SPARE_Pos)             /*!< RTC_T::SPR13: SPARE Mask               */
+
+#define RTC_SPR14_SPARE_Pos              (0)                                               /*!< RTC_T::SPR14: SPARE Position           */
+#define RTC_SPR14_SPARE_Msk              (0xfffffffful << RTC_SPR14_SPARE_Pos)             /*!< RTC_T::SPR14: SPARE Mask               */
+
+#define RTC_SPR15_SPARE_Pos              (0)                                               /*!< RTC_T::SPR15: SPARE Position           */
+#define RTC_SPR15_SPARE_Msk              (0xfffffffful << RTC_SPR15_SPARE_Pos)             /*!< RTC_T::SPR15: SPARE Mask               */
+
+
+#define RTC                 ((RTC_T *)   RTC_BA)
+
+/** @addtogroup RTC_EXPORTED_FUNCTIONS RTC Exported Functions
+  @{
+*/
+
+/**
+  * @brief      Indicate is Leap Year or not
+  *
+  * @param      None
+  *
+  * @retval     0   This year is not a leap year
+  * @retval     1   This year is a leap year
+  *
+  * @details    According to current date, return this year is leap year or not.
+  * \hideinitializer
+  */
+#define RTC_IS_LEAP_YEAR()              (RTC->LEAPYEAR & RTC_LEAPYEAR_LEAPYEAR_Msk ? 1:0)
+
+/**
+  * @brief      Clear RTC Alarm Interrupt Flag
+  *
+  * @param      None
+  *
+  * @return     None
+  *
+  * @details    This macro is used to clear RTC alarm interrupt flag.
+  * \hideinitializer
+  */
+#define RTC_CLEAR_ALARM_INT_FLAG()      (RTC->INTSTS = RTC_INTSTS_ALMIF_Msk)
+
+/**
+  * @brief      Clear RTC Tick Interrupt Flag
+  *
+  * @param      None
+  *
+  * @return     None
+  *
+  * @details    This macro is used to clear RTC tick interrupt flag.
+  * \hideinitializer
+  */
+#define RTC_CLEAR_TICK_INT_FLAG()       (RTC->INTSTS = RTC_INTSTS_TICKIF_Msk)
+
+/**
+  * @brief      Get RTC Alarm Interrupt Flag
+  *
+  * @param      None
+  *
+  * @retval     0   RTC alarm interrupt did not occur
+  * @retval     1   RTC alarm interrupt occurred
+  *
+  * @details    This macro indicates RTC alarm interrupt occurred or not.
+  * \hideinitializer
+  */
+#define RTC_GET_ALARM_INT_FLAG()        ((RTC->INTSTS & RTC_INTSTS_ALMIF_Msk)? 1:0)
+
+/**
+  * @brief      Get RTC Time Tick Interrupt Flag
+  *
+  * @param      None
+  *
+  * @retval     0   RTC time tick interrupt did not occur
+  * @retval     1   RTC time tick interrupt occurred
+  *
+  * @details    This macro indicates RTC time tick interrupt occurred or not.
+  * \hideinitializer
+  */
+#define RTC_GET_TICK_INT_FLAG()         ((RTC->INTSTS & RTC_INTSTS_TICKIF_Msk)? 1:0)
+
+/**
+  * @brief      Read Spare Register
+  *
+  * @param[in]  u32RegNum   The spare register number, 0~19.
+  *
+  * @return     Spare register content
+  *
+  * @details    Read the specify spare register content.
+  * @note       The returned value is valid only when SPRRDY(SPRCTL[7] SPR Register Ready) bit is set. \n
+  *             And its controlled by RTC Access Enable Register.
+  * \hideinitializer
+  */
+#define RTC_READ_SPARE_REGISTER(u32RegNum)                  (RTC->SPR[(u32RegNum)])
+
+/**
+  * @brief      Write Spare Register
+  *
+  * @param[in]  u32RegNum    The spare register number, 0~19.
+  * @param[in]  u32RegValue  The spare register value.
+  *
+  * @return     None
+  *
+  * @details    Write specify data to spare register.
+  * @note       This macro is effect only when SPRRDY(SPRCTL[7] SPR Register Ready) bit is set. \n
+  *             And its controlled by RTC Access Enable Register(RTC_RWEN).
+  * \hideinitializer
+  */
+#define RTC_WRITE_SPARE_REGISTER(u32RegNum, u32RegValue)    (RTC->SPR[(u32RegNum)] = (u32RegValue))
+
+/* Declare these inline functions here to avoid MISRA C 2004 rule 8.1 error */
+void RTC_WaitAccessEnable(void);
+void RTC_Check(void);
+
+void RTC_Open(S_RTC_TIME_DATA_T *sPt);
+void RTC_Close(void);
+void RTC_32KCalibration(int32_t i32FrequencyX100);
+void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt);
+void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt);
+void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt);
+void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt);
+void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek);
+void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm);
+void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek);
+void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm);
+uint32_t RTC_GetDayOfWeek(void);
+void RTC_SetTickPeriod(uint32_t u32TickSelection);
+void RTC_EnableInt(uint32_t u32IntFlagMask);
+void RTC_DisableInt(uint32_t u32IntFlagMask);
+void RTC_EnableSpareAccess(void);
+void RTC_DisableSpareRegister(void);
+
+/*@}*/ /* end of group RTC_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group RTC_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+
+#endif /* __NU_RTC_H__ */
+
+/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/

+ 425 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_sc.h

@@ -0,0 +1,425 @@
+/**************************************************************************//**
+ * @file     sc.h
+ * @brief    NUC980 Smartcard (SC) driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_SC_H__
+#define __NU_SC_H__
+#include "nuc980.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup SC_Driver SC Driver
+  @{
+*/
+
+/** @addtogroup SC_EXPORTED_CONSTANTS SC Exported Constants
+  @{
+*/
+#define SC_INTERFACE_NUM        2                /*!< Smartcard interface numbers */ /* NUC980 series has two SC interface */
+#define SC_PIN_STATE_HIGH       1                /*!< Smartcard pin status high   */
+#define SC_PIN_STATE_LOW        0                /*!< Smartcard pin status low    */
+#define SC_PIN_STATE_IGNORE     0xFFFFFFFF       /*!< Ignore pin status           */
+#define SC_CLK_ON               1                /*!< Smartcard clock on          */
+#define SC_CLK_OFF              0                /*!< Smartcard clock off         */
+
+#define SC_TMR_MODE_0                   (0ul << 24)     /*!<Timer Operation Mode 0, down count                                                      */
+#define SC_TMR_MODE_1                   (1ul << 24)     /*!<Timer Operation Mode 1, down count, start after detect start bit                        */
+#define SC_TMR_MODE_2                   (2ul << 24)     /*!<Timer Operation Mode 2, down count, start after receive start bit                       */
+#define SC_TMR_MODE_3                   (3ul << 24)     /*!<Timer Operation Mode 3, down count, use for activation, only timer 0 support this mode  */
+#define SC_TMR_MODE_4                   (4ul << 24)     /*!<Timer Operation Mode 4, down count with reload after timeout                            */
+#define SC_TMR_MODE_5                   (5ul << 24)     /*!<Timer Operation Mode 5, down count, start after detect start bit, reload after timeout  */
+#define SC_TMR_MODE_6                   (6ul << 24)     /*!<Timer Operation Mode 6, down count, start after receive start bit, reload after timeout */
+#define SC_TMR_MODE_7                   (7ul << 24)     /*!<Timer Operation Mode 7, down count, start and reload after detect start bit             */
+#define SC_TMR_MODE_8                   (8ul << 24)     /*!<Timer Operation Mode 8, up count                                                        */
+#define SC_TMR_MODE_F                   (0xF << 24)     /*!<Timer Operation Mode 15, down count, reload after detect start bit                      */
+
+#define SC_INTEN_ACERRIEN_Msk   0x00000400
+#define SC_INTEN_RXTOIF_Msk     0x00000200
+#define SC_INTEN_INITIEN_Msk    0x00000100
+#define SC_INTEN_CDIEN_Msk      0x00000080
+#define SC_INTEN_BGTIEN_Msk     0x00000040
+#define SC_INTEN_TMR2IEN_Msk    0x00000020
+#define SC_INTEN_TMR1IEN_Msk    0x00000010
+#define SC_INTEN_TMR0IEN_Msk    0x00000008
+#define SC_INTEN_TERRIEN_Msk    0x00000004
+#define SC_INTEN_TBEIEN_Msk     0x00000002
+#define SC_INTEN_RDAIEN_Msk     0x00000001
+
+#define SC_INTSTS_ACERRIF_Msk   0x00000400
+#define SC_INTSTS_RBTOIF_Msk    0x00000200
+#define SC_INTSTS_CDIF_Msk      0x00000080
+#define SC_INTSTS_TMR2IF_Msk    0x00000020
+#define SC_INTSTS_TMR1IF_Msk    0x00000010
+#define SC_INTSTS_TMR0IF_Msk    0x00000008
+#define SC_INTSTS_TERRIF_Msk    0x00000004
+#define SC_INTSTS_TBEIF_Msk     0x00000002
+#define SC_INTSTS_RDAIF_Msk     0x00000001
+
+#define SC_CTL_SYNC_Msk         0x40000000
+#define SC_CTL_CDLV_Msk         0x04000000
+#define SC_CTL_CDDBSEL_Msk      0x03000000
+#define SC_CTL_TXRTYEN_Msk      0x00800000
+#define SC_CTL_TXRTY_Msk        0x00700000
+#define SC_CTL_RXRTYEN_Msk      0x00080000
+#define SC_CTL_RXRTY_Msk        0x00070000
+#define SC_CTL_NSB_Msk          0x00008000
+#define SC_CTL_TMRSEL_Msk       0x00006000
+#define SC_CTL_RXTRGLV_Msk      0x000000C0
+#define SC_CTL_AUTOCEN_Msk      0x00000008
+#define SC_CTL_RXOFF_Msk        0x00000002
+#define SC_CTL_SCEN_Msk         0x00000001
+
+#define SC_PINCTL_SYNC_Msk      0x40000000
+#define SC_PINCTL_PWRINV_Msk    0x00000800
+#define SC_PINCTL_SCDOUT_Msk    0x00000200
+#define SC_PINCTL_CLKKEEP_Msk   0x00000040
+#define SC_PINCTL_SCRST_Msk     0x00000002
+#define SC_PINCTL_PWREN_Msk     0x00000001
+
+#define SC_ALTCTL_ADACEN_Msk    0x00000800
+#define SC_ALTCTL_CNTEN2_Msk    0x00000080
+#define SC_ALTCTL_CNTEN1_Msk    0x00000040
+#define SC_ALTCTL_CNTEN0_Msk    0x00000020
+#define SC_ALTCTL_RXRST_Msk     0x00000002
+#define SC_ALTCTL_TXRST_Msk     0x00000001
+
+#define SC_ETUCTL_CMPEN_Msk     0x00008000
+#define SC_ETUCTL_ETURDIV_Msk   0x00000FFF
+
+#define SC_EGT_EGT_Msk          0x000000FF
+
+#define SC_STATUS_TXACT_Msk     0x80000000
+#define SC_STATUS_TXOVERR_Msk   0x40000000
+#define SC_STATUS_TXRERR_Msk    0x20000000
+#define SC_STATUS_RXACT_Msk     0x00800000
+#define SC_STATUS_RXOVERR_Msk   0x00400000
+#define SC_STATUS_RXRERR_Msk    0x00200000
+#define SC_STATUS_CDPINSTS_Msk  0x00002000
+#define SC_STATUS_CINSERT_Msk   0x00001000
+#define SC_STATUS_CREMOVE_Msk   0x00000800
+#define SC_STATUS_TXEMPTY_Msk   0x00000200
+#define SC_STATUS_TXOV_Msk      0x00000100
+#define SC_STATUS_BEF_Msk       0x00000040
+#define SC_STATUS_FEF_Msk       0x00000020
+#define SC_STATUS_PEF_Msk       0x00000010
+#define SC_STATUS_RXEMPTY_Msk   0x00000002
+#define SC_STATUS_RXOV_Msk      0x00000001
+
+/*@}*/ /* end of group NUC980_SC_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup NUC980_SC_EXPORTED_FUNCTIONS SC Exported Functions
+  @{
+*/
+
+/**
+  * @brief Enable smartcard interrupt.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Mask Interrupt mask to be enabled. A combination of
+  *             - \ref SC_INTEN_ACERRIEN_Msk
+  *             - \ref SC_INTEN_RXTOIF_Msk
+  *             - \ref SC_INTEN_INITIEN_Msk
+  *             - \ref SC_INTEN_CDIEN_Msk
+  *             - \ref SC_INTEN_BGTIEN_Msk
+  *             - \ref SC_INTEN_TMR2IEN_Msk
+  *             - \ref SC_INTEN_TMR1IEN_Msk
+  *             - \ref SC_INTEN_TMR0IEN_Msk
+  *             - \ref SC_INTEN_TERRIEN_Msk
+  *             - \ref SC_INTEN_TBEIEN_Msk
+  *             - \ref SC_INTEN_RDAIEN_Msk
+  * @return None
+  * @details The macro is used to enable Auto-convention error interrupt, Receiver buffer time-out interrupt, Initial end interrupt,
+  *          Card detect interrupt, Block guard time interrupt, Timer2 interrupt, Timer1 interrupt, Timer0 interrupt,
+  *          Transfer error interrupt, Transmit buffer empty interrupt or Receive data reach trigger level interrupt.
+  * \hideinitializer
+  */
+#define SC_ENABLE_INT(sc, u32Mask) \
+    do {\
+        if(sc == 0)\
+            outpw(REG_SC0_INTEN, inpw(REG_SC0_INTEN) | (u32Mask));\
+        else\
+            outpw(REG_SC1_INTEN, inpw(REG_SC1_INTEN) | (u32Mask));\
+    }while(0)
+
+
+/**
+  * @brief Disable smartcard interrupt.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Mask Interrupt mask to be disabled. A combination of
+  *             - \ref SC_INTEN_ACERRIEN_Msk
+  *             - \ref SC_INTEN_RXTOIF_Msk
+  *             - \ref SC_INTEN_INITIEN_Msk
+  *             - \ref SC_INTEN_CDIEN_Msk
+  *             - \ref SC_INTEN_BGTIEN_Msk
+  *             - \ref SC_INTEN_TMR2IEN_Msk
+  *             - \ref SC_INTEN_TMR1IEN_Msk
+  *             - \ref SC_INTEN_TMR0IEN_Msk
+  *             - \ref SC_INTEN_TERRIEN_Msk
+  *             - \ref SC_INTEN_TBEIEN_Msk
+  *             - \ref SC_INTEN_RDAIEN_Msk
+  * @return None
+  * @details The macro is used to disable Auto-convention error interrupt, Receiver buffer time-out interrupt, Initial end interrupt,
+  *          Card detect interrupt, Block guard time interrupt, Timer2 interrupt, Timer1 interrupt, Timer0 interrupt,
+  *          Transfer error interrupt, Transmit buffer empty interrupt or Receive data reach trigger level interrupt.
+  * \hideinitializer
+  */
+#define SC_DISABLE_INT(sc, u32Mask) \
+    do {\
+        if(sc == 0)\
+            outpw(REG_SC0_INTEN, inpw(REG_SC0_INTEN) & ~(u32Mask));\
+        else\
+            outpw(REG_SC1_INTEN, inpw(REG_SC1_INTEN) & ~(u32Mask));\
+    }while(0)
+
+/**
+  * @brief This macro set VCC pin state of smartcard interface.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32State Pin state of VCC pin, valid parameters are:
+  *                 \ref SC_PIN_STATE_HIGH    :Smartcard pin status high.
+  *                 \ref SC_PIN_STATE_LOW     :Smartcard pin status low.
+  * @return None
+  * @details User can set PWREN (SC_PINCTL[0]) and PWRINV (SC_PINCTL[11])to decide SC_PWR pin is in high or low level.
+  * \hideinitializer
+  */
+#define SC_SET_VCC_PIN(sc, u32State) \
+    do {\
+        if(sc == 0) {\
+            while(inpw(REG_SC0_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32State)\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) | SC_PINCTL_PWREN_Msk);\
+            else\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) & ~SC_PINCTL_PWREN_Msk);\
+        } else {\
+            while(inpw(REG_SC1_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32State)\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) | SC_PINCTL_PWREN_Msk);\
+            else\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) & ~SC_PINCTL_PWREN_Msk);\
+        }\
+    }while(0)
+
+
+/**
+  * @brief Set CLK output status.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32OnOff Clock on or off for selected smartcard module, valid values are:
+  *                 \ref SC_CLK_ON    :Smartcard clock on.
+  *                 \ref SC_CLK_OFF   :Smartcard clock off.
+  * @return None
+  * @details User can set CLKKEEP (SC_PINCTL[6]) to decide SC_CLK pin always keeps free running or not.
+  * \hideinitializer
+  */
+#define SC_SET_CLK_PIN(sc, u32OnOff)\
+    do {\
+        if(sc == 0) {\
+            while(inpw(REG_SC0_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32OnOff)\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) | SC_PINCTL_CLKKEEP_Msk);\
+            else\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) & ~SC_PINCTL_CLKKEEP_Msk);\
+        } else {\
+            while(inpw(REG_SC1_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32OnOff)\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) | SC_PINCTL_CLKKEEP_Msk);\
+            else\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) & ~SC_PINCTL_CLKKEEP_Msk);\
+        }\
+    }while(0)
+
+
+/**
+  * @brief Set I/O pin state.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32State Pin state of I/O pin, valid parameters are:
+  *                 \ref SC_PIN_STATE_HIGH    :Smartcard pin status high.
+  *                 \ref SC_PIN_STATE_LOW     :Smartcard pin status low.
+  * @return None
+  * @details User can set SCDOUT(SC_PINCTL[9]) to decide SCDOUT pin to high or low.
+  * \hideinitializer
+  */
+#define SC_SET_IO_PIN(sc, u32State)\
+    do {\
+        if(sc == 0) {\
+            while(inpw(REG_SC0_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32State)\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) | SC_PINCTL_SCDOUT_Msk);\
+            else\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) & ~SC_PINCTL_SCDOUT_Msk);\
+        } else {\
+            while(inpw(REG_SC1_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32State)\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) | SC_PINCTL_SCDOUT_Msk);\
+            else\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) & ~SC_PINCTL_SCDOUT_Msk);\
+        }\
+    }while(0)
+
+/**
+  * @brief Set RST pin state.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32State Pin state of RST pin, valid parameters are:
+  *                 \ref SC_PIN_STATE_HIGH    :Smartcard pin status high.
+  *                 \ref SC_PIN_STATE_LOW     :Smartcard pin status low.
+  * @return None
+  * @details User can set SCRST(SC_PINCTL[1]) to decide SCRST pin to high or low.
+  * \hideinitializer
+  */
+#define SC_SET_RST_PIN(sc, u32State)\
+    do {\
+        if(sc == 0) {\
+            while(inpw(REG_SC0_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32State)\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) | SC_PINCTL_SCRST_Msk);\
+            else\
+                outpw(REG_SC0_PINCTL, inpw(REG_SC0_PINCTL) & ~SC_PINCTL_SCRST_Msk);\
+        } else {\
+            while(inpw(REG_SC1_PINCTL) & SC_PINCTL_SYNC_Msk);\
+            if(u32State)\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) | SC_PINCTL_SCRST_Msk);\
+            else\
+                outpw(REG_SC1_PINCTL, inpw(REG_SC1_PINCTL) & ~SC_PINCTL_SCRST_Msk);\
+        }\
+    }while(0)
+
+/**
+  * @brief Read one byte from smartcard module receive FIFO.
+  * @param[in] sc Smartcard module number
+  * @return One byte read from receive FIFO.
+  * @details By reading DAT register, the SC will return an 8-bit received data.
+  * \hideinitializer
+  */
+#define SC_READ(sc) (sc == 0 ? inpw(REG_SC0_DAT) : inpw(REG_SC1_DAT))
+
+/**
+  * @brief Write one byte to smartcard module transmit FIFO.
+  * @param[in] sc Smartcard module number
+  * @param[in] u8Data Data to write to transmit FIFO.
+  * @return None
+  * @details By writing data to DAT register, the SC will send out an 8-bit data.
+  * \hideinitializer
+  */
+#define SC_WRITE(sc, u8Data) \
+    do {\
+        if(sc == 0)\
+            outpw(REG_SC0_DAT, u8Data);\
+        else\
+            outpw(REG_SC1_DAT, u8Data);\
+    }while(0)
+
+/**
+  * @brief This macro set smartcard stop bit length.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Len Stop bit length, ether 1 or 2.
+  * @return None
+  * @details Stop bit length must be 1 for T = 1 protocol and 2 for T = 0 protocol.
+  * \hideinitializer
+  */
+#define SC_SET_STOP_BIT_LEN(sc, u32Len) \
+    do {\
+        if(sc == 0) {\
+            outpw(REG_SC0_CTL, (inpw(REG_SC0_CTL) & ~SC_CTL_NSB_Msk) | ((u32Len) == 1 ? 1 : 0));\
+        } else{ \
+            outpw(REG_SC1_CTL, (inpw(REG_SC1_CTL) & ~SC_CTL_NSB_Msk) | ((u32Len) == 1 ? 1 : 0));\
+        }\
+    }while(0)
+
+/**
+  * @brief Enable/Disable Tx error retry, and set Tx error retry count.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Count The number of times of Tx error retry count, between 0~8. 0 means disable Tx error retry.
+  * @return None
+  * @details This macro enable/disable transmitter retry function when parity error has occurred, and set error retry count.
+  */
+static __inline void SC_SetTxRetry(UINT sc, uint32_t u32Count)
+{
+    if (sc == 0)
+    {
+        while (inpw(REG_SC0_CTL) & SC_CTL_SYNC_Msk);
+        outpw(REG_SC0_CTL, inpw(REG_SC0_CTL) & ~(SC_CTL_TXRTY_Msk | SC_CTL_TXRTYEN_Msk));
+        if (u32Count != 0)
+        {
+            while (inpw(REG_SC0_CTL) & SC_CTL_SYNC_Msk);
+            outpw(REG_SC0_CTL, inpw(REG_SC0_CTL) | (((u32Count - 1) << 20) | SC_CTL_TXRTYEN_Msk));
+        }
+    }
+    else
+    {
+        while (inpw(REG_SC1_CTL) & SC_CTL_SYNC_Msk);
+        outpw(REG_SC1_CTL, inpw(REG_SC1_CTL) & ~(SC_CTL_TXRTY_Msk | SC_CTL_TXRTYEN_Msk));
+        if (u32Count != 0)
+        {
+            while (inpw(REG_SC1_CTL) & SC_CTL_SYNC_Msk);
+            outpw(REG_SC1_CTL, inpw(REG_SC1_CTL) | (((u32Count - 1) << 20) | SC_CTL_TXRTYEN_Msk));
+        }
+    }
+}
+
+/**
+  * @brief Enable/Disable Rx error retry, and set Rx error retry count.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Count The number of times of Rx error retry count, between 0~8. 0 means disable Rx error retry.
+  * @return None
+  * @details This macro enable/disable receiver retry function when parity error has occurred, and set error retry count.
+  */
+static __inline void  SC_SetRxRetry(UINT sc, uint32_t u32Count)
+{
+    if (sc == 0)
+    {
+        while (inpw(REG_SC0_CTL) & SC_CTL_SYNC_Msk);
+        outpw(REG_SC0_CTL, inpw(REG_SC0_CTL) & ~(SC_CTL_RXRTY_Msk | SC_CTL_RXRTYEN_Msk));
+
+        if (u32Count != 0)
+        {
+            while (inpw(REG_SC0_CTL) & SC_CTL_SYNC_Msk);
+            outpw(REG_SC0_CTL, inpw(REG_SC0_CTL) | (((u32Count - 1) << 16) | SC_CTL_RXRTYEN_Msk));
+        }
+    }
+    else
+    {
+        while (inpw(REG_SC1_CTL) & SC_CTL_SYNC_Msk);
+        outpw(REG_SC1_CTL, inpw(REG_SC1_CTL) & ~(SC_CTL_RXRTY_Msk | SC_CTL_RXRTYEN_Msk));
+        if (u32Count != 0)
+        {
+            while (inpw(REG_SC1_CTL) & SC_CTL_SYNC_Msk);
+            outpw(REG_SC1_CTL, inpw(REG_SC1_CTL) | (((u32Count - 1) << 16) | SC_CTL_RXRTYEN_Msk));
+        }
+    }
+}
+
+
+UINT SC_IsCardInserted(UINT sc);
+void SC_ClearFIFO(UINT sc);
+void SC_Close(UINT sc);
+void SC_Open(UINT sc, UINT u32CardDet, UINT u32PWR);
+void SC_ResetReader(UINT sc);
+void SC_SetBlockGuardTime(UINT sc, UINT u32BGT);
+void SC_SetCharGuardTime(UINT sc, UINT u32CGT);
+void SC_StopAllTimer(UINT sc);
+void SC_StartTimer(UINT sc, UINT u32TimerNum, UINT u32Mode, UINT u32ETUCount);
+void SC_StopTimer(UINT sc, UINT u32TimerNum);
+
+
+/*@}*/ /* end of group SC_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group SC_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_SC_H__
+
+
+

+ 333 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_scuart.h

@@ -0,0 +1,333 @@
+/**************************************************************************//**
+ * @file     scuart.h
+ * @brief    NUC980 series Smartcard UART mode (SCUART) driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_SCUART_H__
+#define __NU_SCUART_H__
+#include "nuc980.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup SCUART_Driver SCUART Driver
+  @{
+*/
+
+/** @addtogroup SCUART_EXPORTED_CONSTANTS SCUART Exported Constants
+  @{
+*/
+#define SCUART_CHAR_LEN_5     (0x3ul << 4)  /*!< Set SCUART word length to 5 bits */
+#define SCUART_CHAR_LEN_6     (0x2ul << 4)  /*!< Set SCUART word length to 6 bits */
+#define SCUART_CHAR_LEN_7     (0x1ul << 4)  /*!< Set SCUART word length to 7 bits */
+#define SCUART_CHAR_LEN_8     (0)                            /*!< Set SCUART word length to 8 bits */
+
+#define SCUART_PARITY_NONE    (0x00000040)                   /*!< Set SCUART transfer with no parity   */
+#define SCUART_PARITY_ODD     (0x00000080)                   /*!< Set SCUART transfer with odd parity  */
+#define SCUART_PARITY_EVEN    (0)                            /*!< Set SCUART transfer with even parity */
+
+#define SCUART_STOP_BIT_1     (0x00008000)                   /*!< Set SCUART transfer with one stop bit  */
+#define SCUART_STOP_BIT_2     (0)                            /*!< Set SCUART transfer with two stop bits */
+
+#define SC_STATUS_RXEMPTY_Msk   0x00000002
+#define SC_STATUS_RXFULL_Msk    0x00000004
+#define SC_STATUS_PEF_Msk       0x00000010
+#define SC_STATUS_FEF_Msk       0x00000020
+#define SC_STATUS_BEF_Msk       0x00000040
+#define SC_STATUS_TXEMPTY_Msk   0x00000200
+#define SC_STATUS_TXFULL_Msk    0x00000400
+#define SC_STATUS_TXACT_Msk     0x80000000
+
+#define SC_INTEN_RXTOIEN_Msk    0x00000200
+#define SC_INTEN_TERRIEN_Msk    0x00000004
+#define SC_INTEN_TBEIEN_Msk     0x00000002
+#define SC_INTEN_RDAIEN_Msk     0x00000001
+
+#define SC_INTSTS_RBTOIF_Msk    0x00000200
+#define SC_INTSTS_TERRIF_Msk    0x00000004
+#define SC_INTSTS_TBEIF_Msk     0x00000002
+#define SC_INTSTS_RDAIF_Msk     0x00000001
+
+#define SC_CTL_SCEN_Msk         0x00000001
+#define SC_CTL_NSB_Msk          0x00008000
+
+#define SC_UARTCTL_UARTEN_Msk   0x00000001
+
+/*@}*/ /* end of group SCUART_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup SCUART_EXPORTED_FUNCTIONS SCUART Exported Functions
+  @{
+*/
+
+/* TX Macros */
+/**
+  * @brief Write Data to Tx data register.
+  * @param[in] sc Smartcard module number
+  * @param[in] u8Data Data byte to transmit.
+  * @return None
+  * @details By writing data to DAT register, the SC will send out an 8-bit data.
+  * \hideinitializer
+  */
+#define SCUART_WRITE(sc, u8Data) \
+do {\
+    if(sc == 0)\
+        outpw(REG_SC0_DAT, u8Data);\
+    else\
+        outpw(REG_SC1_DAT, u8Data);\
+}while(0)
+
+/**
+  * @brief Get TX FIFO empty flag status from register.
+  * @param[in] sc Smartcard module number
+  * @return Transmit FIFO empty status.
+  * @retval 0 Transmit FIFO is not empty.
+  * @retval SC_STATUS_TXEMPTY_Msk Transmit FIFO is empty.
+  * @details When the last byte of TX buffer has been transferred to Transmitter Shift Register, hardware sets TXEMPTY bit (SC_STATUS[9]) high.
+  *          It will be cleared when writing data into DAT (SC_DAT[7:0]).
+  * \hideinitializer
+  */
+#define SCUART_GET_TX_EMPTY(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & SC_STATUS_TXEMPTY_Msk) : (inpw(REG_SC1_STATUS) & SC_STATUS_TXEMPTY_Msk))
+
+/**
+  * @brief Get TX FIFO full flag status from register.
+  * @param[in] sc Smartcard module number
+  * @retval 0 Transmit FIFO is not full.
+  * @retval SC_STATUS_TXFULL_Msk Transmit FIFO is full.
+  * @details TXFULL(SC_STATUS[10]) is set when TX pointer is equal to 4, otherwise is cleared by hardware.
+  * \hideinitializer
+  */
+#define SCUART_GET_TX_FULL(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & SC_STATUS_TXFULL_Msk) : (inpw(REG_SC1_STATUS) & SC_STATUS_TXFULL_Msk))
+
+/**
+  * @brief Wait specified smartcard port transmission complete.
+  * @param[in] sc Smartcard module number
+  * @return None
+  * @details TXACT (SC_STATUS[31]) is cleared automatically when TX transfer is finished or the last byte transmission has completed.
+  * @note This macro blocks until transmit complete.
+  * \hideinitializer
+  */
+#define SCUART_WAIT_TX_EMPTY(sc)\
+do {\
+    if(sc == 0)\
+        while(inpw(REG_SC0_STATUS) & SC_STATUS_TXACT_Msk);\
+    else\
+        while(inpw(REG_SC1_STATUS) & SC_STATUS_TXACT_Msk);\
+}while(0)
+
+/**
+  * @brief Check specified smartcard port transmit FIFO is full or not.
+  * @param[in] sc Smartcard module number
+  * @retval 0 Transmit FIFO is not full.
+  * @retval 1 Transmit FIFO is full.
+  * @details TXFULL(SC_STATUS[10]) indicates TX buffer full or not.
+  *          This is set when TX pointer is equal to 4, otherwise is cleared by hardware.
+  * \hideinitializer
+  */
+#define SCUART_IS_TX_FULL(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & SC_STATUS_TXFULL_Msk ? 1 : 0) : (inpw(REG_SC1_STATUS) & SC_STATUS_TXFULL_Msk ? 1 : 0))
+
+/**
+  * @brief Check specified smartcard port transmission is over.
+  * @param[in] sc Smartcard module number
+  * @retval 0 Transmit is not complete.
+  * @retval 1 Transmit complete.
+  * @details TXACT (SC_STATUS[31]) is set by hardware when TX transfer is in active and the STOP bit of the last byte has been transmitted.
+  * \hideinitializer
+  */
+#define SCUART_IS_TX_EMPTY(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & SC_STATUS_TXACT_Msk ? 1 : 0) : (inpw(REG_SC1_STATUS) & SC_STATUS_TXACT_Msk ? 1 : 0))
+
+/* RX Macros */
+
+/**
+  * @brief Read Rx data register.
+  * @param[in] sc Smartcard module number
+  * @return The oldest data byte in RX FIFO.
+  * @details By reading DAT register, the SC will return an 8-bit received data.
+  * \hideinitializer
+  */
+#define SCUART_READ(sc) (sc == 0 ? inpw(REG_SC0_DAT) : inpw(REG_SC1_DAT))
+
+/**
+  * @brief Get RX FIFO empty flag status from register.
+  * @param[in] sc Smartcard module number
+  * @retval 0 Receive FIFO is not empty.
+  * @retval SC_STATUS_RXEMPTY_Msk Receive FIFO is empty.
+  * @details When the last byte of Rx buffer has been read by CPU, hardware sets RXEMPTY(SC_STATUS[1]) high.
+  *          It will be cleared when SC receives any new data.
+  * \hideinitializer
+  */
+#define SCUART_GET_RX_EMPTY(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & SC_STATUS_RXEMPTY_Msk) : (inpw(REG_SC1_STATUS) & SC_STATUS_RXEMPTY_Msk))
+
+
+/**
+  * @brief Get RX FIFO full flag status from register.
+  * @param[in] sc Smartcard module number
+  * @retval 0 Receive FIFO is not full.
+  * @retval SC_STATUS_RXFULL_Msk Receive FIFO is full.
+  * @details RXFULLF(SC_STATUS[2]) is set when RX pointer is equal to 4, otherwise it is cleared by hardware.
+  * \hideinitializer
+  */
+#define SCUART_GET_RX_FULL(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & SC_STATUS_RXFULL_Msk) : (inpw(REG_SC1_STATUS) & SC_STATUS_RXFULL_Msk))
+
+/**
+  * @brief Check if receive data number in FIFO reach FIFO trigger level or not.
+  * @param[in] sc Smartcard module number
+  * @retval 0 The number of bytes in receive FIFO is less than trigger level.
+  * @retval 1 The number of bytes in receive FIFO equals or larger than trigger level.
+  * @details RDAIF(SC_INTSTS[0]) is used for received data reaching trigger level RXTRGLV (SC_CTL[7:6]) interrupt status flag.
+  * @note If receive trigger level is \b not 1 byte, this macro return 0 does not necessary indicates there is no data in FIFO.
+  * \hideinitializer
+  */
+#define SCUART_IS_RX_READY(sc) (sc == 0 ? (inpw(REG_SC0_INTSTS) & SC_INTSTS_RDAIF_Msk ? 1 : 0) : (inpw(REG_SC1_INTSTS) & SC_INTSTS_RDAIF_Msk ? 1 : 0))
+
+/**
+  * @brief Check specified smartcard port receive FIFO is full or not.
+  * @param[in] sc Smartcard module number
+  * @retval 0 Receive FIFO is not full.
+  * @retval 1 Receive FIFO is full.
+  * @details RXFULLF(SC_STATUS[2]) is set when RX pointer is equal to 4, otherwise it is cleared by hardware.
+  * \hideinitializer
+  */
+#define SCUART_IS_RX_FULL(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & SC_STATUS_RXFULL_Msk ? 1 : 0) : (inpw(REG_SC1_STATUS) & SC_STATUS_RXFULL_Msk ? 1 : 0))
+
+/* Interrupt Macros */
+
+/**
+  * @brief Enable specified interrupts.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Mask Interrupt masks to enable, a combination of following bits.
+  *             - \ref SC_INTEN_RXTOIEN_Msk
+  *             - \ref SC_INTEN_TERRIEN_Msk
+  *             - \ref SC_INTEN_TBEIEN_Msk
+  *             - \ref SC_INTEN_RDAIEN_Msk
+  * @return None
+  * @details The macro is used to enable receiver buffer time-out interrupt, transfer error interrupt,
+  *          transmit buffer empty interrupt or receive data reach trigger level interrupt.
+  * \hideinitializer
+  */
+#define SCUART_ENABLE_INT(sc, u32Mask)\
+do {\
+    if(sc == 0)\
+        outpw(REG_SC0_INTEN, inpw(REG_SC0_INTEN) | (u32Mask));\
+    else\
+        outpw(REG_SC1_INTEN, inpw(REG_SC1_INTEN) | (u32Mask));\
+}while(0)
+
+/**
+  * @brief Disable specified interrupts.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Mask Interrupt masks to disable, a combination of following bits.
+  *             - \ref SC_INTEN_RXTOIEN_Msk
+  *             - \ref SC_INTEN_TERRIEN_Msk
+  *             - \ref SC_INTEN_TBEIEN_Msk
+  *             - \ref SC_INTEN_RDAIEN_Msk
+  * @return None
+  * @details The macro is used to disable receiver buffer time-out interrupt, transfer error interrupt,
+  *          transmit buffer empty interrupt or receive data reach trigger level interrupt.
+  * \hideinitializer
+  */
+#define SCUART_DISABLE_INT(sc, u32Mask)\
+do {\
+    if(sc == 0)\
+        outpw(REG_SC0_INTEN, inpw(REG_SC0_INTEN) & ~(u32Mask));\
+    else\
+        outpw(REG_SC1_INTEN, inpw(REG_SC1_INTEN) & ~(u32Mask));\
+}while(0)
+
+/**
+  * @brief Get specified interrupt flag/status.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Type Interrupt flag/status to check, could be one of following value:
+  *             - \ref SC_INTSTS_RBTOIF_Msk
+  *             - \ref SC_INTSTS_TERRIF_Msk
+  *             - \ref SC_INTSTS_TBEIF_Msk
+  *             - \ref SC_INTSTS_RDAIF_Msk
+  * @return The status of specified interrupt.
+  * @retval 0 Specified interrupt does not happened.
+  * @retval 1 Specified interrupt happened.
+  * @details The macro is used to get receiver buffer time-out interrupt status, transfer error interrupt status,
+  *          transmit buffer empty interrupt status or receive data reach interrupt status.
+  * \hideinitializer
+  */
+#define SCUART_GET_INT_FLAG(sc, u32Type) (sc == 0 ? (inpw(REG_SC0_INTSTS) & (u32Type) ? 1 : 0) : (inpw(REG_SC1_INTSTS) & (u32Type) ? 1 : 0))
+
+/**
+  * @brief Clear specified interrupt flag/status.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Type Interrupt flag/status to clear, could be the combination of following values:
+  *             - \ref SC_INTSTS_RBTOIF_Msk
+  *             - \ref SC_INTSTS_TERRIF_Msk
+  *             - \ref SC_INTSTS_TBEIF_Msk
+  * @return None
+  * @details The macro is used to clear receiver buffer time-out interrupt flag, transfer error interrupt flag or
+  *          transmit buffer empty interrupt flag.
+  * \hideinitializer
+  */
+#define SCUART_CLR_INT_FLAG(sc, u32Type) \
+do {\
+    if(sc == 0)\
+        outpw(REG_SC0_INTSTS, (u32Type));\
+    else\
+        outpw(REG_SC1_INTSTS, (u32Type));\
+}while(0)
+
+/**
+  * @brief Get receive error flag/status.
+  * @param[in] sc Smartcard module number
+  * @return Current receive error status, could one of following errors:
+  * @retval SC_STATUS_PEF_Msk Parity error.
+  * @retval SC_STATUS_FEF_Msk Frame error.
+  * @retval SC_STATUS_BEF_Msk Break error.
+  * @details The macro is used to get receiver parity error status, receiver frame error status or
+  *          receiver break error status.
+  * \hideinitializer
+  */
+#define SCUART_GET_ERR_FLAG(sc) (sc == 0 ? (inpw(REG_SC0_STATUS) & (SC_STATUS_PEF_Msk | SC_STATUS_FEF_Msk | SC_STATUS_BEF_Msk)) : (inpw(REG_SC1_STATUS) & (SC_STATUS_PEF_Msk | SC_STATUS_FEF_Msk | SC_STATUS_BEF_Msk)))
+
+/**
+  * @brief Clear specified receive error flag/status.
+  * @param[in] sc Smartcard module number
+  * @param[in] u32Mask Receive error flag/status to clear, combination following values:
+  *             - \ref SC_STATUS_PEF_Msk
+  *             - \ref SC_STATUS_FEF_Msk
+  *             - \ref SC_STATUS_BEF_Msk
+  * @return None
+  * @details The macro is used to clear receiver parity error flag, receiver frame error flag or
+  *          receiver break error flag.
+  * \hideinitializer
+  */
+#define SCUART_CLR_ERR_FLAG(sc, u32Mask)\
+do {\
+    if(sc == 0)\
+        outpw(REG_SC0_STATUS, (u32Mask));\
+    else\
+        outpw(REG_SC1_STATUS, (u32Mask));\
+}while(0)
+
+void SCUART_Close(UINT sc);
+UINT SCUART_Open(UINT sc, UINT u32baudrate);
+UINT SCUART_Read(UINT sc, char *pu8RxBuf, UINT u32ReadBytes);
+UINT SCUART_SetLineConfig(UINT sc, UINT u32Baudrate, UINT u32DataWidth, UINT u32Parity, UINT  u32StopBits);
+void SCUART_SetTimeoutCnt(UINT sc, UINT u32TOC);
+void SCUART_Write(UINT sc, char *pu8TxBuf, UINT u32WriteBytes);
+
+/*@}*/ /* end of group SCUART_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group SCUART_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_SCUART_H__
+

+ 721 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_sdh.h

@@ -0,0 +1,721 @@
+/**************************************************************************//**
+ * @file     sdh.h
+ * @brief    SDH driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+#include <stdio.h>
+
+#ifndef __NU_SDH_H__
+#define __NU_SDH_H__
+
+#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              */
+
+#define TIMER0 0
+
+/**
+   @addtogroup REGISTER Control Register
+   @{
+*/
+
+/**
+    @addtogroup SDH SD/SDIO Host Controller(SDH)
+    Memory Mapped Structure for SDH Controller
+@{ */
+
+typedef struct
+{
+
+    /**
+     * @var SDH_T::FB
+     * Offset: 0x00~0x7C  Shared Buffer (FIFO)
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |BUFFER    |Shared Buffer
+     * |        |          |Buffer for DMA transfer
+     * @var SDH_T::DMACTL
+     * Offset: 0x400  DMA Control and Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |DMAEN     |DMA Engine Enable Bit
+     * |        |          |0 = DMA Disabled.
+     * |        |          |1 = DMA Enabled.
+     * |        |          |If this bit is cleared, DMA will ignore all requests from SD host and force bus master into IDLE state.
+     * |        |          |Note: If target abort is occurred, DMAEN will be cleared.
+     * |[1]     |DMARST    |Software Engine Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset internal state machine and pointers
+     * |        |          |The contents of control register will not be cleared
+     * |        |          |This bit will auto be cleared after few clock cycles.
+     * |        |          |Note: The software reset DMA related registers.
+     * |[3]     |SGEN      |Scatter-gather Function Enable Bit
+     * |        |          |0 = Scatter-gather function Disabled (DMA will treat the starting address in DMASAR as starting pointer of a single block memory).
+     * |        |          |1 = Scatter-gather function Enabled (DMA will treat the starting address in DMASAR as a starting address of Physical Address Descriptor (PAD) table
+     * |        |          |The format of these Pads' will be described later).
+     * |[9]     |DMABUSY   |DMA Transfer Is in Progress
+     * |        |          |This bit indicates if SD Host is granted and doing DMA transfer or not.
+     * |        |          |0 = DMA transfer is not in progress.
+     * |        |          |1 = DMA transfer is in progress.
+     * @var SDH_T::DMASA
+     * Offset: 0x408  DMA Transfer Starting Address Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |ORDER     |Determined to the PAD Table Fetching Is in Order or Out of Order
+     * |        |          |0 = PAD table is fetched in order.
+     * |        |          |1 = PAD table is fetched out of order.
+     * |        |          |Note: the bit0 is valid in scatter-gather mode when SGEN = 1.
+     * |[31:1]  |DMASA     |DMA Transfer Starting Address
+     * |        |          |This field pads 0 as least significant bit indicates a 32-bit starting address of system memory (SRAM) for DMA to retrieve or fill in data.
+     * |        |          |If DMA is not in normal mode, this field will be interpreted as a starting address of Physical Address Descriptor (PAD) table.
+     * |        |          |Note: Starting address of the SRAM must be word aligned, for example, 0x0000_0000, 0x0000_0004.
+     * @var SDH_T::DMABCNT
+     * Offset: 0x40C  DMA Transfer Byte Count Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[25:0]  |BCNT      |DMA Transfer Byte Count (Read Only)
+     * |        |          |This field indicates the remained byte count of DMA transfer
+     * |        |          |The value of this field is valid only when DMA is busy; otherwise, it is 0.
+     * @var SDH_T::DMAINTEN
+     * Offset: 0x410  DMA Interrupt Enable Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |ABORTIEN  |DMA Read/Write Target Abort Interrupt Enable Bit
+     * |        |          |0 = Target abort interrupt generation Disabled during DMA transfer.
+     * |        |          |1 = Target abort interrupt generation Enabled during DMA transfer.
+     * |[1]     |WEOTIEN   |Wrong EOT Encountered Interrupt Enable Bit
+     * |        |          |0 = Interrupt generation Disabled when wrong EOT is encountered.
+     * |        |          |1 = Interrupt generation Enabled when wrong EOT is encountered.
+     * @var SDH_T::DMAINTSTS
+     * Offset: 0x414  DMA Interrupt Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |ABORTIF   |DMA Read/Write Target Abort Interrupt Flag
+     * |        |          |0 = No bus ERROR response received.
+     * |        |          |1 = Bus ERROR response received.
+     * |        |          |Note1: This bit is read only, but can be cleared by writing '1' to it.
+     * |        |          |Note2: When DMA's bus master received ERROR response, it means that target abort is happened
+     * |        |          |DMA will stop transfer and respond this event and then go to IDLE state
+     * |        |          |When target abort occurred or WEOTIF is set, software must reset DMA and SD host, and then transfer those data again.
+     * |[1]     |WEOTIF    |Wrong EOT Encountered Interrupt Flag
+     * |        |          |When DMA Scatter-Gather function is enabled, and EOT of the descriptor is encountered before DMA transfer finished (that means the total sector count of all PAD is less than the sector count of SD host), this bit will be set.
+     * |        |          |0 = No EOT encountered before DMA transfer finished.
+     * |        |          |1 = EOT encountered before DMA transfer finished.
+     * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
+     * @var SDH_T::GCTL
+     * Offset: 0x800  Global Control and Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |GCTLRST   |Software Engine Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset SD host
+     * |        |          |The contents of control register will not be cleared
+     * |        |          |This bit will auto cleared after reset complete.
+     * |[1]     |SDEN      |Secure Digital Functionality Enable Bit
+     * |        |          |0 = SD functionality disabled.
+     * |        |          |1 = SD functionality enabled.
+     * @var SDH_T::GINTEN
+     * Offset: 0x804  Global Interrupt Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |DTAIEN    |DMA READ/WRITE Target Abort Interrupt Enable Bit
+     * |        |          |0 = DMA READ/WRITE target abort interrupt generation disabled.
+     * |        |          |1 = DMA READ/WRITE target abort interrupt generation enabled.
+     * @var SDH_T::GINTSTS
+     * Offset: 0x808  Global Interrupt Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |DTAIF     |DMA READ/WRITE Target Abort Interrupt Flag (Read Only)
+     * |        |          |This bit indicates DMA received an ERROR response from internal AHB bus during DMA read/write operation
+     * |        |          |When Target Abort is occurred, please reset all engine.
+     * |        |          |0 = No bus ERROR response received.
+     * |        |          |1 = Bus ERROR response received.
+     * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
+     * @var SDH_T::CTL
+     * Offset: 0x820  SD Control and Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |COEN      |Command Output Enable Bit
+     * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
+     * |        |          |1 = Enabled, SD host will output a command to SD card.
+     * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
+     * |[1]     |RIEN      |Response Input Enable Bit
+     * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
+     * |        |          |1 = Enabled, SD host will wait to receive a response from SD card.
+     * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
+     * |[2]     |DIEN      |Data Input Enable Bit
+     * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
+     * |        |          |1 = Enabled, SD host will wait to receive block data and the CRC16 value from SD card.
+     * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
+     * |[3]     |DOEN      |Data Output Enable Bit
+     * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
+     * |        |          |1 = Enabled, SD host will transfer block data and the CRC16 value to SD card.
+     * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
+     * |[4]     |R2EN      |Response R2 Input Enable Bit
+     * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
+     * |        |          |1 = Enabled, SD host will wait to receive a response R2 from SD card and store the response data into DMC's flash buffer (exclude CRC7).
+     * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
+     * |[5]     |CLK74OEN  |Initial 74 Clock Cycles Output Enable Bit
+     * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
+     * |        |          |1 = Enabled, SD host will output 74 clock cycles to SD card.
+     * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
+     * |[6]     |CLK8OEN   |Generating 8 Clock Cycles Output Enable Bit
+     * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
+     * |        |          |1 = Enabled, SD host will output 8 clock cycles.
+     * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
+     * |[7]     |CLKKEEP   |SD Clock Enable Control
+     * |        |          |0 = SD host decided when to output clock and when to disable clock output automatically.
+     * |        |          |1 = SD clock always keeps free running.
+     * |[13:8]  |CMDCODE   |SD Command Code
+     * |        |          |This register contains the SD command code (0x00 - 0x3F).
+     * |[14]    |CTLRST    |Software Engine Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset the internal state machine and counters
+     * |        |          |The contents of control register will not be cleared (but RIEN, DIEN, DOEN and R2_EN will be cleared)
+     * |        |          |This bit will be auto cleared after few clock cycles.
+     * |[15]    |DBW       |SD Data Bus Width (for 1-bit / 4-bit Selection)
+     * |        |          |0 = Data bus width is 1-bit.
+     * |        |          |1 = Data bus width is 4-bit.
+     * |[23:16] |BLKCNT    |Block Counts to Be Transferred or Received
+     * |        |          |This field contains the block counts for data-in and data-out transfer
+     * |        |          |For READ_MULTIPLE_BLOCK and WRITE_MULTIPLE_BLOCK command, software can use this function to accelerate data transfer and improve performance
+     * |        |          |Don't fill 0x0 to this field.
+     * |        |          |Note: For READ_MULTIPLE_BLOCK and WRITE_MULTIPLE_BLOCK command, the actual total length is BLKCNT * (BLKLEN +1).
+     * |[27:24] |SDNWR     |NWR Parameter for Block Write Operation
+     * |        |          |This value indicates the NWR parameter for data block write operation in SD clock counts
+     * |        |          |The actual clock cycle will be SDNWR+1.
+     * @var SDH_T::CMDARG
+     * Offset: 0x824  SD Command Argument Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |ARGUMENT  |SD Command Argument
+     * |        |          |This register contains a 32-bit value specifies the argument of SD command from host controller to SD card
+     * |        |          |Before trigger COEN (SDH_CTL [0]), software should fill argument in this field.
+     * @var SDH_T::INTEN
+     * Offset: 0x828  SD Interrupt Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |BLKDIEN   |Block Transfer Done Interrupt Enable Bit
+     * |        |          |0 = BLKDIF (SDH_INTEN[0]) trigger interrupt Disable.
+     * |        |          |1 = BLKDIF (SDH_INTEN[0]) trigger interrupt Enabled.
+     * |[1]     |CRCIEN    |CRC7, CRC16 and CRC Status Error Interrupt Enable Bit
+     * |        |          |0 = CRCIF (SDH_INTEN[1]) trigger interrupt Disable.
+     * |        |          |1 = CRCIF (SDH_INTEN[1]) trigger interrupt Enabled.
+     * |[8]     |CDIEN     |SD Card Detection Interrupt Enable Bit
+     * |        |          |Enable/Disable interrupts generation of SD controller when card is inserted or removed.
+     * |        |          |0 = CDIF (SDH_INTEN[8]) trigger interrupt Disable.
+     * |        |          |1 = CDIF (SDH_INTEN[8]) trigger interrupt Enabled.
+     * |[12]    |RTOIEN    |Response Time-out Interrupt Enable Bit
+     * |        |          |Enable/Disable interrupts generation of SD controller when receiving response or R2 time-out
+     * |        |          |Time-out value is specified at TOUT register.
+     * |        |          |0 = RTOIF (SDH_INTEN[12]) trigger interrupt Disabled.
+     * |        |          |1 = RTOIF (SDH_INTEN[12]) trigger interrupt Enabled.
+     * |[13]    |DITOIEN   |Data Input Time-out Interrupt Enable Bit
+     * |        |          |Enable/Disable interrupts generation of SD controller when data input time-out
+     * |        |          |Time-out value is specified at TOUT register.
+     * |        |          |0 = DITOIF (SDH_INTEN[13]) trigger interrupt Disabled.
+     * |        |          |1 = DITOIF (SDH_INTEN[13]) trigger interrupt Enabled.
+     * |[14]    |WKIEN     |Wake-up Signal Generating Enable Bit
+     * |        |          |Enable/Disable wake-up signal generating of SD host when current using SD card issues an interrupt (wake-up) via DAT [1] to host.
+     * |        |          |0 = SD Card interrupt to wake-up chip Disabled.
+     * |        |          |1 = SD Card interrupt to wake-up chip Enabled.
+     * |[30]    |CDSRC     |SD Card Detect Source Selection
+     * |        |          |0 = From SD card's DAT3 pin.
+     * |        |          |Host need clock to got data on pin DAT3
+     * |        |          |Please make sure CLKKEEP (SDH_CTL[7]) is 1 in order to generate free running clock for DAT3 pin.
+     * |        |          |1 = From GPIO pin.
+     * @var SDH_T::INTSTS
+     * Offset: 0x82C  SD Interrupt Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |BLKDIF    |Block Transfer Done Interrupt Flag (Read Only)
+     * |        |          |This bit indicates that SD host has finished all data-in or data-out block transfer
+     * |        |          |If there is a CRC16 error or incorrect CRC status during multiple block data transfer, the transfer will be broken and this bit will also be set.
+     * |        |          |0 = Not finished yet.
+     * |        |          |1 = Done.
+     * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
+     * |[1]     |CRCIF     |CRC7, CRC16 and CRC Status Error Interrupt Flag (Read Only)
+     * |        |          |This bit indicates that SD host has occurred CRC error during response in, data-in or data-out (CRC status error) transfer
+     * |        |          |When CRC error is occurred, software should reset SD engine
+     * |        |          |Some response (ex
+     * |        |          |R3) doesn't have CRC7 information with it; SD host will still calculate CRC7, get CRC error and set this flag
+     * |        |          |In this condition, software should ignore CRC error and clears this bit manually.
+     * |        |          |0 = No CRC error is occurred.
+     * |        |          |1 = CRC error is occurred.
+     * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
+     * |[2]     |CRC7      |CRC7 Check Status (Read Only)
+     * |        |          |SD host will check CRC7 correctness during each response in
+     * |        |          |If that response does not contain CRC7 information (ex
+     * |        |          |R3), then software should turn off CRCIEN (SDH_INTEN[1]) and ignore this bit.
+     * |        |          |0 = Fault.
+     * |        |          |1 = OK.
+     * |[3]     |CRC16     |CRC16 Check Status of Data-in Transfer (Read Only)
+     * |        |          |SD host will check CRC16 correctness after data-in transfer.
+     * |        |          |0 = Fault.
+     * |        |          |1 = OK.
+     * |[6:4]   |CRCSTS    |CRC Status Value of Data-out Transfer (Read Only)
+     * |        |          |SD host will record CRC status of data-out transfer
+     * |        |          |Software could use this value to identify what type of error is during data-out transfer.
+     * |        |          |010 = Positive CRC status.
+     * |        |          |101 = Negative CRC status.
+     * |        |          |111 = SD card programming error occurs.
+     * |[7]     |DAT0STS   |DAT0 Pin Status of Current Selected SD Port (Read Only)
+     * |        |          |This bit is the DAT0 pin status of current selected SD port.
+     * |[8]     |CDIF      |SD Card Detection Interrupt Flag (Read Only)
+     * |        |          |This bit indicates that SD card is inserted or removed
+     * |        |          |Only when CDIEN (SDH_INTEN[8]) is set to 1, this bit is active.
+     * |        |          |0 = No card is inserted or removed.
+     * |        |          |1 = There is a card inserted in or removed from SD.
+     * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
+     * |[12]    |RTOIF     |Response Time-out Interrupt Flag (Read Only)
+     * |        |          |This bit indicates that SD host counts to time-out value when receiving response or R2 (waiting start bit).
+     * |        |          |0 = Not time-out.
+     * |        |          |1 = Response time-out.
+     * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
+     * |[13]    |DITOIF    |Data Input Time-out Interrupt Flag (Read Only)
+     * |        |          |This bit indicates that SD host counts to time-out value when receiving data (waiting start bit).
+     * |        |          |0 = Not time-out.
+     * |        |          |1 = Data input time-out.
+     * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
+     * |[16]    |CDSTS     |Card Detect Status of SD (Read Only)
+     * |        |          |This bit indicates the card detect pin status of SD, and is used for card detection
+     * |        |          |When there is a card inserted in or removed from SD, software should check this bit to confirm if there is really a card insertion or removal.
+     * |        |          |If CDSRC (SDH_INTEN[30]) = 0, to select DAT3 for card detection:.
+     * |        |          |0 = Card removed.
+     * |        |          |1 = Card inserted.
+     * |        |          |If CDSRC (SDH_INTEN[30]) = 1, to select GPIO for card detection:.
+     * |        |          |0 = Card inserted.
+     * |        |          |1 = Card removed.
+     * |[18]    |DAT1STS   |DAT1 Pin Status of SD Port (Read Only)
+     * |        |          |This bit indicates the DAT1 pin status of SD port.
+     * @var SDH_T::RESP0
+     * Offset: 0x830  SD Receiving Response Token Register 0
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |RESPTK0   |SD Receiving Response Token 0
+     * |        |          |SD host controller will receive a response token for getting a reply from SD card when RIEN (SDH_CTL[1]) is set
+     * |        |          |This field contains response bit 47-16 of the response token.
+     * @var SDH_T::RESP1
+     * Offset: 0x834  SD Receiving Response Token Register 1
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[7:0]   |RESPTK1   |SD Receiving Response Token 1
+     * |        |          |SD host controller will receive a response token for getting a reply from SD card when RIEN (SDH_CTL[1]) is set
+     * |        |          |This register contains the bit 15-8 of the response token.
+     * @var SDH_T::BLEN
+     * Offset: 0x838  SD Block Length Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[10:0]  |BLKLEN    |SD BLOCK LENGTH in Byte Unit
+     * |        |          |An 11-bit value specifies the SD transfer byte count of a block
+     * |        |          |The actual byte count is equal to BLKLEN+1.
+     * |        |          |Note: The default SD block length is 512 bytes
+     * @var SDH_T::TOUT
+     * Offset: 0x83C  SD Response/Data-in Time-out Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[23:0]  |TOUT      |SD Response/Data-in Time-out Value
+     * |        |          |A 24-bit value specifies the time-out counts of response and data input
+     * |        |          |SD host controller will wait start bit of response or data-in until this value reached
+     * |        |          |The time period depends on SD engine clock frequency
+     * |        |          |Do not write a small number into this field, or you may never get response or data due to time-out.
+     * |        |          |Note: Filling 0x0 into this field will disable hardware time-out function.
+     */
+
+    __IO uint32_t FB[32];                /*!< Shared Buffer (FIFO)                                                      */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE0[224];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t DMACTL;                /*!< [0x0400] DMA Control and Status Register                                  */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE1[1];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t DMASA;                 /*!< [0x0408] DMA Transfer Starting Address Register                           */
+    __I  uint32_t DMABCNT;               /*!< [0x040c] DMA Transfer Byte Count Register                                 */
+    __IO uint32_t DMAINTEN;              /*!< [0x0410] DMA Interrupt Enable Control Register                            */
+    __IO uint32_t DMAINTSTS;             /*!< [0x0414] DMA Interrupt Status Register                                    */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE2[250];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t GCTL;                  /*!< [0x0800] Global Control and Status Register                               */
+    __IO uint32_t GINTEN;                /*!< [0x0804] Global Interrupt Control Register                                */
+    __I  uint32_t GINTSTS;               /*!< [0x0808] Global Interrupt Status Register                                 */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE3[5];
+    /// @endcond //HIDDEN_SYMBOLS
+    __IO uint32_t CTL;                   /*!< [0x0820] SD Control and Status Register                                   */
+    __IO uint32_t CMDARG;                /*!< [0x0824] SD Command Argument Register                                     */
+    __IO uint32_t INTEN;                 /*!< [0x0828] SD Interrupt Control Register                                    */
+    __IO uint32_t INTSTS;                /*!< [0x082c] SD Interrupt Status Register                                     */
+    __I  uint32_t RESP0;                 /*!< [0x0830] SD Receiving Response Token Register 0                           */
+    __I  uint32_t RESP1;                 /*!< [0x0834] SD Receiving Response Token Register 1                           */
+    __IO uint32_t BLEN;                  /*!< [0x0838] SD Block Length Register                                         */
+    __IO uint32_t TOUT;                  /*!< [0x083c] SD Response/Data-in Time-out Register                            */
+
+} SDH_T;
+
+
+/**
+    @addtogroup SDH_CONST SDH Bit Field Definition
+    Constant Definitions for SDH Controller
+@{ */
+
+#define SDH_DMACTL_DMAEN_Pos             (0)                                               /*!< SDH_T::DMACTL: DMAEN Position          */
+#define SDH_DMACTL_DMAEN_Msk             (0x1ul << SDH_DMACTL_DMAEN_Pos)                   /*!< SDH_T::DMACTL: DMAEN Mask              */
+
+#define SDH_DMACTL_DMARST_Pos            (1)                                               /*!< SDH_T::DMACTL: DMARST Position         */
+#define SDH_DMACTL_DMARST_Msk            (0x1ul << SDH_DMACTL_DMARST_Pos)                  /*!< SDH_T::DMACTL: DMARST Mask             */
+
+#define SDH_DMACTL_SGEN_Pos              (3)                                               /*!< SDH_T::DMACTL: SGEN Position           */
+#define SDH_DMACTL_SGEN_Msk              (0x1ul << SDH_DMACTL_SGEN_Pos)                    /*!< SDH_T::DMACTL: SGEN Mask               */
+
+#define SDH_DMACTL_DMABUSY_Pos           (9)                                               /*!< SDH_T::DMACTL: DMABUSY Position        */
+#define SDH_DMACTL_DMABUSY_Msk           (0x1ul << SDH_DMACTL_DMABUSY_Pos)                 /*!< SDH_T::DMACTL: DMABUSY Mask            */
+
+#define SDH_DMASA_ORDER_Pos              (0)                                               /*!< SDH_T::DMASA: ORDER Position           */
+#define SDH_DMASA_ORDER_Msk              (0x1ul << SDH_DMASA_ORDER_Pos)                    /*!< SDH_T::DMASA: ORDER Mask               */
+
+#define SDH_DMASA_DMASA_Pos              (1)                                               /*!< SDH_T::DMASA: DMASA Position           */
+#define SDH_DMASA_DMASA_Msk              (0x7ffffffful << SDH_DMASA_DMASA_Pos)             /*!< SDH_T::DMASA: DMASA Mask               */
+
+#define SDH_DMABCNT_BCNT_Pos             (0)                                               /*!< SDH_T::DMABCNT: BCNT Position          */
+#define SDH_DMABCNT_BCNT_Msk             (0x3fffffful << SDH_DMABCNT_BCNT_Pos)             /*!< SDH_T::DMABCNT: BCNT Mask              */
+
+#define SDH_DMAINTEN_ABORTIEN_Pos        (0)                                               /*!< SDH_T::DMAINTEN: ABORTIEN Position     */
+#define SDH_DMAINTEN_ABORTIEN_Msk        (0x1ul << SDH_DMAINTEN_ABORTIEN_Pos)              /*!< SDH_T::DMAINTEN: ABORTIEN Mask         */
+
+#define SDH_DMAINTEN_WEOTIEN_Pos         (1)                                               /*!< SDH_T::DMAINTEN: WEOTIEN Position      */
+#define SDH_DMAINTEN_WEOTIEN_Msk         (0x1ul << SDH_DMAINTEN_WEOTIEN_Pos)               /*!< SDH_T::DMAINTEN: WEOTIEN Mask          */
+
+#define SDH_DMAINTSTS_ABORTIF_Pos        (0)                                               /*!< SDH_T::DMAINTSTS: ABORTIF Position     */
+#define SDH_DMAINTSTS_ABORTIF_Msk        (0x1ul << SDH_DMAINTSTS_ABORTIF_Pos)              /*!< SDH_T::DMAINTSTS: ABORTIF Mask         */
+
+#define SDH_DMAINTSTS_WEOTIF_Pos         (1)                                               /*!< SDH_T::DMAINTSTS: WEOTIF Position      */
+#define SDH_DMAINTSTS_WEOTIF_Msk         (0x1ul << SDH_DMAINTSTS_WEOTIF_Pos)               /*!< SDH_T::DMAINTSTS: WEOTIF Mask          */
+
+#define SDH_GCTL_GCTLRST_Pos             (0)                                               /*!< SDH_T::GCTL: GCTLRST Position          */
+#define SDH_GCTL_GCTLRST_Msk             (0x1ul << SDH_GCTL_GCTLRST_Pos)                   /*!< SDH_T::GCTL: GCTLRST Mask              */
+
+#define SDH_GCTL_SDEN_Pos                (1)                                               /*!< SDH_T::GCTL: SDEN Position             */
+#define SDH_GCTL_SDEN_Msk                (0x1ul << SDH_GCTL_SDEN_Pos)                      /*!< SDH_T::GCTL: SDEN Mask                 */
+
+#define SDH_GINTEN_DTAIEN_Pos            (0)                                               /*!< SDH_T::GINTEN: DTAIEN Position         */
+#define SDH_GINTEN_DTAIEN_Msk            (0x1ul << SDH_GINTEN_DTAIEN_Pos)                  /*!< SDH_T::GINTEN: DTAIEN Mask             */
+
+#define SDH_GINTSTS_DTAIF_Pos            (0)                                               /*!< SDH_T::GINTSTS: DTAIF Position         */
+#define SDH_GINTSTS_DTAIF_Msk            (0x1ul << SDH_GINTSTS_DTAIF_Pos)                  /*!< SDH_T::GINTSTS: DTAIF Mask             */
+
+#define SDH_CTL_COEN_Pos                 (0)                                               /*!< SDH_T::CTL: COEN Position              */
+#define SDH_CTL_COEN_Msk                 (0x1ul << SDH_CTL_COEN_Pos)                       /*!< SDH_T::CTL: COEN Mask                  */
+
+#define SDH_CTL_RIEN_Pos                 (1)                                               /*!< SDH_T::CTL: RIEN Position              */
+#define SDH_CTL_RIEN_Msk                 (0x1ul << SDH_CTL_RIEN_Pos)                       /*!< SDH_T::CTL: RIEN Mask                  */
+
+#define SDH_CTL_DIEN_Pos                 (2)                                               /*!< SDH_T::CTL: DIEN Position              */
+#define SDH_CTL_DIEN_Msk                 (0x1ul << SDH_CTL_DIEN_Pos)                       /*!< SDH_T::CTL: DIEN Mask                  */
+
+#define SDH_CTL_DOEN_Pos                 (3)                                               /*!< SDH_T::CTL: DOEN Position              */
+#define SDH_CTL_DOEN_Msk                 (0x1ul << SDH_CTL_DOEN_Pos)                       /*!< SDH_T::CTL: DOEN Mask                  */
+
+#define SDH_CTL_R2EN_Pos                 (4)                                               /*!< SDH_T::CTL: R2EN Position              */
+#define SDH_CTL_R2EN_Msk                 (0x1ul << SDH_CTL_R2EN_Pos)                       /*!< SDH_T::CTL: R2EN Mask                  */
+
+#define SDH_CTL_CLK74OEN_Pos             (5)                                               /*!< SDH_T::CTL: CLK74OEN Position          */
+#define SDH_CTL_CLK74OEN_Msk             (0x1ul << SDH_CTL_CLK74OEN_Pos)                   /*!< SDH_T::CTL: CLK74OEN Mask              */
+
+#define SDH_CTL_CLK8OEN_Pos              (6)                                               /*!< SDH_T::CTL: CLK8OEN Position           */
+#define SDH_CTL_CLK8OEN_Msk              (0x1ul << SDH_CTL_CLK8OEN_Pos)                    /*!< SDH_T::CTL: CLK8OEN Mask               */
+
+#define SDH_CTL_CLKKEEP_Pos              (7)                                               /*!< SDH_T::CTL: CLKKEEP Position          */
+#define SDH_CTL_CLKKEEP_Msk              (0x1ul << SDH_CTL_CLKKEEP_Pos)                    /*!< SDH_T::CTL: CLKKEEP Mask              */
+
+#define SDH_CTL_CMDCODE_Pos              (8)                                               /*!< SDH_T::CTL: CMDCODE Position           */
+#define SDH_CTL_CMDCODE_Msk              (0x3ful << SDH_CTL_CMDCODE_Pos)                   /*!< SDH_T::CTL: CMDCODE Mask               */
+
+#define SDH_CTL_CTLRST_Pos               (14)                                              /*!< SDH_T::CTL: CTLRST Position            */
+#define SDH_CTL_CTLRST_Msk               (0x1ul << SDH_CTL_CTLRST_Pos)                     /*!< SDH_T::CTL: CTLRST Mask                */
+
+#define SDH_CTL_DBW_Pos                  (15)                                              /*!< SDH_T::CTL: DBW Position               */
+#define SDH_CTL_DBW_Msk                  (0x1ul << SDH_CTL_DBW_Pos)                        /*!< SDH_T::CTL: DBW Mask                   */
+
+#define SDH_CTL_BLKCNT_Pos               (16)                                              /*!< SDH_T::CTL: BLKCNT Position            */
+#define SDH_CTL_BLKCNT_Msk               (0xfful << SDH_CTL_BLKCNT_Pos)                    /*!< SDH_T::CTL: BLKCNT Mask                */
+
+#define SDH_CTL_SDNWR_Pos                (24)                                              /*!< SDH_T::CTL: SDNWR Position             */
+#define SDH_CTL_SDNWR_Msk                (0xful << SDH_CTL_SDNWR_Pos)                      /*!< SDH_T::CTL: SDNWR Mask                 */
+
+#define SDH_CMDARG_ARGUMENT_Pos          (0)                                               /*!< SDH_T::CMDARG: ARGUMENT Position       */
+#define SDH_CMDARG_ARGUMENT_Msk          (0xfffffffful << SDH_CMDARG_ARGUMENT_Pos)         /*!< SDH_T::CMDARG: ARGUMENT Mask           */
+
+#define SDH_INTEN_BLKDIEN_Pos            (0)                                               /*!< SDH_T::INTEN: BLKDIEN Position         */
+#define SDH_INTEN_BLKDIEN_Msk            (0x1ul << SDH_INTEN_BLKDIEN_Pos)                  /*!< SDH_T::INTEN: BLKDIEN Mask             */
+
+#define SDH_INTEN_CRCIEN_Pos             (1)                                               /*!< SDH_T::INTEN: CRCIEN Position          */
+#define SDH_INTEN_CRCIEN_Msk             (0x1ul << SDH_INTEN_CRCIEN_Pos)                   /*!< SDH_T::INTEN: CRCIEN Mask              */
+
+#define SDH_INTEN_CDIEN_Pos              (8)                                               /*!< SDH_T::INTEN: CDIEN Position          */
+#define SDH_INTEN_CDIEN_Msk              (0x1ul << SDH_INTEN_CDIEN_Pos)                    /*!< SDH_T::INTEN: CDIEN Mask              */
+
+#define SDH_INTEN_RTOIEN_Pos             (12)                                              /*!< SDH_T::INTEN: RTOIEN Position          */
+#define SDH_INTEN_RTOIEN_Msk             (0x1ul << SDH_INTEN_RTOIEN_Pos)                   /*!< SDH_T::INTEN: RTOIEN Mask              */
+
+#define SDH_INTEN_DITOIEN_Pos            (13)                                              /*!< SDH_T::INTEN: DITOIEN Position         */
+#define SDH_INTEN_DITOIEN_Msk            (0x1ul << SDH_INTEN_DITOIEN_Pos)                  /*!< SDH_T::INTEN: DITOIEN Mask             */
+
+#define SDH_INTEN_WKIEN_Pos              (14)                                              /*!< SDH_T::INTEN: WKIEN Position           */
+#define SDH_INTEN_WKIEN_Msk              (0x1ul << SDH_INTEN_WKIEN_Pos)                    /*!< SDH_T::INTEN: WKIEN Mask               */
+
+#define SDH_INTEN_CDSRC_Pos              (30)                                              /*!< SDH_T::INTEN: CDSRC Position          */
+#define SDH_INTEN_CDSRC_Msk              (0x1ul << SDH_INTEN_CDSRC_Pos)                    /*!< SDH_T::INTEN: CDSRC Mask              */
+
+#define SDH_INTSTS_BLKDIF_Pos            (0)                                               /*!< SDH_T::INTSTS: BLKDIF Position         */
+#define SDH_INTSTS_BLKDIF_Msk            (0x1ul << SDH_INTSTS_BLKDIF_Pos)                  /*!< SDH_T::INTSTS: BLKDIF Mask             */
+
+#define SDH_INTSTS_CRCIF_Pos             (1)                                               /*!< SDH_T::INTSTS: CRCIF Position          */
+#define SDH_INTSTS_CRCIF_Msk             (0x1ul << SDH_INTSTS_CRCIF_Pos)                   /*!< SDH_T::INTSTS: CRCIF Mask              */
+
+#define SDH_INTSTS_CRC7_Pos              (2)                                               /*!< SDH_T::INTSTS: CRC7 Position           */
+#define SDH_INTSTS_CRC7_Msk              (0x1ul << SDH_INTSTS_CRC7_Pos)                    /*!< SDH_T::INTSTS: CRC7 Mask               */
+
+#define SDH_INTSTS_CRC16_Pos             (3)                                               /*!< SDH_T::INTSTS: CRC16 Position          */
+#define SDH_INTSTS_CRC16_Msk             (0x1ul << SDH_INTSTS_CRC16_Pos)                   /*!< SDH_T::INTSTS: CRC16 Mask              */
+
+#define SDH_INTSTS_CRCSTS_Pos            (4)                                               /*!< SDH_T::INTSTS: CRCSTS Position         */
+#define SDH_INTSTS_CRCSTS_Msk            (0x7ul << SDH_INTSTS_CRCSTS_Pos)                  /*!< SDH_T::INTSTS: CRCSTS Mask             */
+
+#define SDH_INTSTS_DAT0STS_Pos           (7)                                               /*!< SDH_T::INTSTS: DAT0STS Position        */
+#define SDH_INTSTS_DAT0STS_Msk           (0x1ul << SDH_INTSTS_DAT0STS_Pos)                 /*!< SDH_T::INTSTS: DAT0STS Mask            */
+
+#define SDH_INTSTS_CDIF_Pos              (8)                                               /*!< SDH_T::INTSTS: CDIF Position          */
+#define SDH_INTSTS_CDIF_Msk              (0x1ul << SDH_INTSTS_CDIF_Pos)                    /*!< SDH_T::INTSTS: CDIF Mask              */
+
+#define SDH_INTSTS_RTOIF_Pos             (12)                                              /*!< SDH_T::INTSTS: RTOIF Position          */
+#define SDH_INTSTS_RTOIF_Msk             (0x1ul << SDH_INTSTS_RTOIF_Pos)                   /*!< SDH_T::INTSTS: RTOIF Mask              */
+
+#define SDH_INTSTS_DITOIF_Pos            (13)                                              /*!< SDH_T::INTSTS: DITOIF Position         */
+#define SDH_INTSTS_DITOIF_Msk            (0x1ul << SDH_INTSTS_DITOIF_Pos)                  /*!< SDH_T::INTSTS: DITOIF Mask             */
+
+#define SDH_INTSTS_CDSTS_Pos             (16)                                              /*!< SDH_T::INTSTS: CDSTS Position         */
+#define SDH_INTSTS_CDSTS_Msk             (0x1ul << SDH_INTSTS_CDSTS_Pos)                   /*!< SDH_T::INTSTS: CDSTS Mask             */
+
+#define SDH_INTSTS_DAT1STS_Pos           (18)                                              /*!< SDH_T::INTSTS: DAT1STS Position        */
+#define SDH_INTSTS_DAT1STS_Msk           (0x1ul << SDH_INTSTS_DAT1STS_Pos)                 /*!< SDH_T::INTSTS: DAT1STS Mask            */
+
+#define SDH_RESP0_RESPTK0_Pos            (0)                                               /*!< SDH_T::RESP0: RESPTK0 Position         */
+#define SDH_RESP0_RESPTK0_Msk            (0xfffffffful << SDH_RESP0_RESPTK0_Pos)           /*!< SDH_T::RESP0: RESPTK0 Mask             */
+
+#define SDH_RESP1_RESPTK1_Pos            (0)                                               /*!< SDH_T::RESP1: RESPTK1 Position         */
+#define SDH_RESP1_RESPTK1_Msk            (0xfful << SDH_RESP1_RESPTK1_Pos)                 /*!< SDH_T::RESP1: RESPTK1 Mask             */
+
+#define SDH_BLEN_BLKLEN_Pos              (0)                                               /*!< SDH_T::BLEN: BLKLEN Position           */
+#define SDH_BLEN_BLKLEN_Msk              (0x7fful << SDH_BLEN_BLKLEN_Pos)                  /*!< SDH_T::BLEN: BLKLEN Mask               */
+
+#define SDH_TOUT_TOUT_Pos                (0)                                               /*!< SDH_T::TOUT: TOUT Position             */
+#define SDH_TOUT_TOUT_Msk                (0xfffffful << SDH_TOUT_TOUT_Pos)                 /*!< SDH_T::TOUT: TOUT Mask                 */
+
+/**@}*/ /* SDH_CONST */
+/**@}*/ /* end of SDH register group */
+/**@}*/ /* end of REGISTER group */
+
+#define SDH0                 ((SDH_T *)   FMI_BA)
+#define SDH1                 ((SDH_T *)   SDH_BA)
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup SDH_Driver SDH Driver
+  @{
+*/
+
+
+/** @addtogroup SDH_EXPORTED_CONSTANTS SDH Exported Constants
+  @{
+*/
+
+#define SDH_ERR_ID       0xFFFF0100ul /*!< SDH error ID  \hideinitializer */
+
+#define SDH_TIMEOUT      (SDH_ERR_ID|0x01ul) /*!< Timeout  \hideinitializer */
+#define SDH_NO_MEMORY    (SDH_ERR_ID|0x02ul) /*!< OOM  \hideinitializer */
+
+/*--- define type of SD card or MMC */
+#define SDH_TYPE_UNKNOWN     0ul /*!< Unknown card type  \hideinitializer */
+#define SDH_TYPE_SD_HIGH     1ul /*!< SDHC card  \hideinitializer */
+#define SDH_TYPE_SD_LOW      2ul /*!< SD card  \hideinitializer */
+#define SDH_TYPE_MMC         3ul /*!< MMC card  \hideinitializer */
+#define SDH_TYPE_EMMC        4ul /*!< eMMC card  \hideinitializer */
+
+/* SD error */
+#define SDH_NO_SD_CARD       (SDH_ERR_ID|0x10ul) /*!< Card removed  \hideinitializer */
+#define SDH_ERR_DEVICE       (SDH_ERR_ID|0x11ul) /*!< Device error  \hideinitializer */
+#define SDH_INIT_TIMEOUT     (SDH_ERR_ID|0x12ul) /*!< Card init timeout  \hideinitializer */
+#define SDH_SELECT_ERROR     (SDH_ERR_ID|0x13ul) /*!< Card select error  \hideinitializer */
+#define SDH_WRITE_PROTECT    (SDH_ERR_ID|0x14ul) /*!< Card write protect  \hideinitializer */
+#define SDH_INIT_ERROR       (SDH_ERR_ID|0x15ul) /*!< Card init error  \hideinitializer */
+#define SDH_CRC7_ERROR       (SDH_ERR_ID|0x16ul) /*!< CRC 7 error  \hideinitializer */
+#define SDH_CRC16_ERROR      (SDH_ERR_ID|0x17ul) /*!< CRC 16 error  \hideinitializer */
+#define SDH_CRC_ERROR        (SDH_ERR_ID|0x18ul) /*!< CRC error  \hideinitializer */
+#define SDH_CMD8_ERROR       (SDH_ERR_ID|0x19ul) /*!< Command 8 error  \hideinitializer */
+
+#define MMC_FREQ        20000ul   /*!< output 20MHz to MMC  \hideinitializer */
+#define SD_FREQ         25000ul   /*!< output 25MHz to SD  \hideinitializer */
+#define SDHC_FREQ       50000ul   /*!< output 50MHz to SDH \hideinitializer */
+
+#define SD_PORT0        (1 << 0)  /*!< Card select SD0 \hideinitializer */
+#define SD_PORT1        (1 << 2)  /*!< Card select SD1 \hideinitializer */
+#define CardDetect_From_GPIO  (1ul << 8)   /*!< Card detection pin is GPIO \hideinitializer */
+#define CardDetect_From_DAT3  (1ul << 9)   /*!< Card detection pin is DAT3 \hideinitializer */
+
+/*@}*/ /* end of group SDH_EXPORTED_CONSTANTS */
+
+/** @addtogroup SDH_EXPORTED_TYPEDEF SDH Exported Type Defines
+  @{
+*/
+typedef struct SDH_info_t
+{
+    unsigned char   IsCardInsert;   /*!< Card insert state */
+    unsigned char   R3Flag;
+    unsigned char   R7Flag;
+    unsigned char volatile DataReadyFlag;
+    unsigned int    CardType;       /*!< SDHC, SD, or MMC */
+    unsigned int    RCA;            /*!< Relative card address */
+    unsigned int    totalSectorN;   /*!< Total sector number */
+    unsigned int    diskSize;       /*!< Disk size in K bytes */
+    int             sectorSize;     /*!< Sector size in bytes */
+    unsigned char   *dmabuf;
+} SDH_INFO_T;                      /*!< Structure holds SD card info */
+
+/*@}*/ /* end of group SDH_EXPORTED_TYPEDEF */
+
+/// @cond HIDDEN_SYMBOLS
+extern SDH_INFO_T SD0, SD1;
+
+/// @endcond HIDDEN_SYMBOLS
+
+/** @addtogroup SDH_EXPORTED_FUNCTIONS SDH Exported Functions
+  @{
+*/
+
+/**
+ *  @brief    Enable specified interrupt.
+ *
+ *  @param[in]    sdh    Select SDH0 or SDH1.
+ *  @param[in]    u32IntMask    Interrupt type mask:
+ *                           \ref SDH_INTEN_BLKDIEN_Msk / \ref SDH_INTEN_CRCIEN_Msk / \ref SDH_INTEN_CDIEN_Msk /
+ *                           \ref SDH_INTEN_CDSRC_Msk \ref SDH_INTEN_RTOIEN_Msk / \ref SDH_INTEN_DITOIEN_Msk /
+ *                           \ref SDH_INTEN_WKIEN_Msk
+ *
+ *  @return   None.
+ * \hideinitializer
+ */
+#define SDH_ENABLE_INT(sdh, u32IntMask)    ((sdh)->INTEN |= (u32IntMask))
+
+/**
+ *  @brief    Disable specified interrupt.
+ *
+ *  @param[in]    sdh    Select SDH0 or SDH1.
+ *  @param[in]    u32IntMask    Interrupt type mask:
+ *                           \ref SDH_INTEN_BLKDIEN_Msk / \ref SDH_INTEN_CRCIEN_Msk / \ref SDH_INTEN_CDIEN_Msk /
+ *                           \ref SDH_INTEN_RTOIEN_Msk / \ref SDH_INTEN_DITOIEN_Msk / \ref SDH_INTEN_WKIEN_Msk / \ref SDH_INTEN_CDSRC_Msk /
+ *
+ *  @return   None.
+ * \hideinitializer
+ */
+#define SDH_DISABLE_INT(sdh, u32IntMask)    ((sdh)->INTEN &= ~(u32IntMask))
+
+/**
+ *  @brief    Get specified interrupt flag/status.
+ *
+ *  @param[in]    sdh    Select SDH0 or SDH1.
+ *  @param[in]    u32IntMask    Interrupt type mask:
+ *                           \ref SDH_INTSTS_BLKDIF_Msk / \ref SDH_INTSTS_CRCIF_Msk / \ref SDH_INTSTS_CRC7_Msk /
+ *                           \ref SDH_INTSTS_CRC16_Msk / \ref SDH_INTSTS_CRCSTS_Msk / \ref SDH_INTSTS_DAT0STS_Msk /
+ *                           \ref SDH_INTSTS_CDIF_Msk \ref SDH_INTSTS_RTOIF_Msk /
+ *                           \ref SDH_INTSTS_DITOIF_Msk / \ref SDH_INTSTS_CDSTS_Msk /
+ *                           \ref SDH_INTSTS_DAT1STS_Msk
+ *
+ *
+ *  @return  0 = The specified interrupt is not happened.
+ *            1 = The specified interrupt is happened.
+ * \hideinitializer
+ */
+#define SDH_GET_INT_FLAG(sdh, u32IntMask) (((sdh)->INTSTS & (u32IntMask))?1:0)
+
+
+/**
+ *  @brief    Clear specified interrupt flag/status.
+ *
+ *  @param[in]    sdh    Select SDH0 or SDH1.
+ *  @param[in]    u32IntMask    Interrupt type mask:
+ *                           \ref SDH_INTSTS_BLKDIF_Msk / \ref SDH_INTSTS_CRCIF_Msk / \ref SDH_INTSTS_CDIF_Msk /
+ *                           \ref SDH_INTSTS_RTOIF_Msk / \ref SDH_INTSTS_DITOIF_Msk
+ *
+ *
+ *  @return   None.
+ * \hideinitializer
+ */
+#define SDH_CLR_INT_FLAG(sdh, u32IntMask) ((sdh)->INTSTS = (u32IntMask))
+
+
+/**
+ *  @brief    Check SD Card inserted or removed.
+ *
+ *  @param[in]    sdh    Select SDH0 or SDH1.
+ *
+ *  @return   1: Card inserted.
+ *            0: Card removed.
+ * \hideinitializer
+ */
+#define SDH_IS_CARD_PRESENT(sdh) (((sdh) == SDH0)? SD0.IsCardInsert : SD1.IsCardInsert)
+
+/**
+ *  @brief    Get SD Card capacity.
+ *
+ *  @param[in]    sdh    Select SDH0 or SDH1.
+ *
+ *  @return   SD Card capacity. (unit: KByte)
+ * \hideinitializer
+ */
+#define SDH_GET_CARD_CAPACITY(sdh)  (((sdh) == SDH0)? SD0.diskSize : SD1.diskSize)
+
+
+void SDH_Open(SDH_T *sdh, uint32_t u32CardDetSrc);
+uint32_t SDH_Probe(SDH_T *sdh);
+uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount);
+uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount);
+
+uint32_t SDH_CardDetection(SDH_T *sdh);
+void SDH_Open_Disk(SDH_T *sdh, uint32_t u32CardDetSrc);
+void SDH_Close_Disk(SDH_T *sdh);
+
+
+/*@}*/ /* end of group SDH_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group SDH_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#endif  //end of __NU_SDH_H__

+ 852 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_spi.h

@@ -0,0 +1,852 @@
+/**************************************************************************//**
+ * @file     spi.h
+ * @brief    NUC980 series SPI driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+#ifndef __NU_SPI_H__
+#define __NU_SPI_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+   @addtogroup REGISTER Control Register
+   @{
+*/
+
+/**
+    @addtogroup SPI Serial Peripheral Interface Controller(SPI)
+    Memory Mapped Structure for SPI Controller
+@{ */
+
+typedef struct
+{
+
+
+    /**
+     * @var SPI_T::CTL
+     * Offset: 0x00  SPI Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |SPIEN     |SPI Transfer Control Enable Bit
+     * |        |          |In Master mode, the transfer will start when there is data in the FIFO buffer after this bit is set to 1
+     * |        |          |In Slave mode, this device is ready to receive data when this bit is set to 1.
+     * |        |          |0 = Transfer control Disabled.
+     * |        |          |1 = Transfer control Enabled.
+     * |        |          |Note: Before changing the configurations of SPIx_CTL, SPIx_CLKDIV, SPIx_SSCTL and SPIx_FIFOCTL registers, user shall clear the SPIEN (SPIx_CTL[0]) and confirm the SPIENSTS (SPIx_STATUS[15]) is 0.
+     * |[1]     |RXNEG     |Receive on Negative Edge
+     * |        |          |0 = Received data input signal is latched on the rising edge of SPI bus clock.
+     * |        |          |1 = Received data input signal is latched on the falling edge of SPI bus clock.
+     * |[2]     |TXNEG     |Transmit on Negative Edge
+     * |        |          |0 = Transmitted data output signal is changed on the rising edge of SPI bus clock.
+     * |        |          |1 = Transmitted data output signal is changed on the falling edge of SPI bus clock.
+     * |[3]     |CLKPOL    |Clock Polarity
+     * |        |          |0 = SPI bus clock is idle low.
+     * |        |          |1 = SPI bus clock is idle high.
+     * |[7:4]   |SUSPITV   |Suspend Interval (Master Only)
+     * |        |          |The four bits provide configurable suspend interval between two successive transmit/receive transaction in a transfer
+     * |        |          |The definition of the suspend interval is the interval between the last clock edge of the preceding transaction word and the first clock edge of the following transaction word
+     * |        |          |The default value is 0x3
+     * |        |          |The period of the suspend interval is obtained according to the following equation.
+     * |        |          |(SUSPITV[3:0] + 0.5) * period of SPICLK clock cycle
+     * |        |          |Example:
+     * |        |          |SUSPITV = 0x0 .... 0.5 SPICLK clock cycle.
+     * |        |          |SUSPITV = 0x1 .... 1.5 SPICLK clock cycle.
+     * |        |          |.....
+     * |        |          |SUSPITV = 0xE .... 14.5 SPICLK clock cycle.
+     * |        |          |SUSPITV = 0xF .... 15.5 SPICLK clock cycle.
+     * |[12:8]  |DWIDTH    |Data Width
+     * |        |          |This field specifies how many bits can be transmitted / received in one transaction
+     * |        |          |The minimum bit length is 8 bits and can up to 32 bits.
+     * |        |          |DWIDTH = 0x08 .... 8 bits.
+     * |        |          |DWIDTH = 0x09 .... 9 bits.
+     * |        |          |.....
+     * |        |          |DWIDTH = 0x1F .... 31 bits.
+     * |        |          |DWIDTH = 0x00 .... 32 bits.
+     * |        |          |Note: For SPI1~SPI4, this bit field will decide the depth of TX/RX FIFO configuration in SPI mode
+     * |        |          |Therefore, changing this bit field will clear TX/RX FIFO by hardware automatically in SPI1~SPI4.
+     * |[13]    |LSB       |Send LSB First
+     * |        |          |0 = The MSB, which bit of transmit/receive register depends on the setting of DWIDTH, is transmitted/received first.
+     * |        |          |1 = The LSB, bit 0 of the SPI TX register, is sent first to the SPI data output pin, and the first bit received from the SPI data input pin will be put in the LSB position of the RX register (bit 0 of SPI_RX).
+     * |[14]    |HALFDPX   |SPI Half-duplex Transfer Enable Bit
+     * |        |          |This bit is used to select full-duplex or half-duplex for SPI transfer
+     * |        |          |The bit field DATDIR (SPIx_CTL[20]) can be used to set the data direction in half-duplex transfer.
+     * |        |          |0 = SPI operates in full-duplex transfer.
+     * |        |          |1 = SPI operates in half-duplex transfer.
+     * |[15]    |RXONLY    |Receive-only Mode Enable Bit (Master Only)
+     * |        |          |This bit field is only available in Master mode
+     * |        |          |In receive-only mode, SPI Master will generate SPI bus clock continuously for receiving data bit from SPI slave device and assert the BUSY status.
+     * |        |          |0 = Receive-only mode Disabled.
+     * |        |          |1 = Receive-only mode Enabled.
+     * |[17]    |UNITIEN   |Unit Transfer Interrupt Enable Bit
+     * |        |          |0 = SPI unit transfer interrupt Disabled.
+     * |        |          |1 = SPI unit transfer interrupt Enabled.
+     * |[18]    |SLAVE     |Slave Mode Control
+     * |        |          |0 = Master mode.
+     * |        |          |1 = Slave mode.
+     * |[19]    |REORDER   |Byte Reorder Function Enable Bit
+     * |        |          |0 = Byte Reorder function Disabled.
+     * |        |          |1 = Byte Reorder function Enabled
+     * |        |          |A byte suspend interval will be inserted among each byte
+     * |        |          |The period of the byte suspend interval depends on the setting of SUSPITV.
+     * |        |          |Note: Byte Reorder function is only available if DWIDTH is defined as 16, 24, and 32 bits.
+     * |[20]    |DATDIR    |Data Port Direction Control
+     * |        |          |This bit is used to select the data input/output direction in half-duplex transfer and Dual/Quad transfer
+     * |        |          |0 = SPI data is input direction.
+     * |        |          |1 = SPI data is output direction.
+     * @var SPI_T::CLKDIV
+     * Offset: 0x04  SPI Clock Divider Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[8:0]   |DIVIDER   |Clock Divider
+     * |        |          |The value in this field is the frequency divider for generating the peripheral clock, fspi_eclk, and the SPI bus clock of SPI Master
+     * |        |          |The frequency is obtained according to the following equation.
+     * |        |          |where
+     * |        |          |is the peripheral clock source, which is defined in the clock control register, CLK_CLKSEL2.
+     * |        |          |Note: Not supported in I2S mode.
+     * @var SPI_T::SSCTL
+     * Offset: 0x08  SPI Slave Select Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |SS        |Slave Selection Control (Master Only)
+     * |        |          |If AUTOSS bit is cleared to 0,
+     * |        |          |0 = set the SPIx_SS line to inactive state.
+     * |        |          |1 = set the SPIx_SS line to active state.
+     * |        |          |If the AUTOSS bit is set to 1,
+     * |        |          |0 = Keep the SPIx_SS line at inactive state.
+     * |        |          |1 = SPIx_SS line will be automatically driven to active state for the duration of data transfer, and will be driven to inactive state for the rest of the time
+     * |        |          |The active state of SPIx_SS is specified in SSACTPOL (SPIx_SSCTL[2]).
+     * |[2]     |SSACTPOL  |Slave Selection Active Polarity
+     * |        |          |This bit defines the active polarity of slave selection signal (SPIx_SS).
+     * |        |          |0 = The slave selection signal SPIx_SS is active low.
+     * |        |          |1 = The slave selection signal SPIx_SS is active high.
+     * |[3]     |AUTOSS    |Automatic Slave Selection Function Enable Bit (Master Only)
+     * |        |          |0 = Automatic slave selection function Disabled
+     * |        |          |Slave selection signal will be asserted/de-asserted according to SS (SPIx_SSCTL[0]).
+     * |        |          |1 = Automatic slave selection function Enabled.
+     * |[8]     |SLVBEIEN  |Slave Mode Bit Count Error Interrupt Enable Bit
+     * |        |          |0 = Slave mode bit count error interrupt Disabled.
+     * |        |          |1 = Slave mode bit count error interrupt Enabled.
+     * |[9]     |SLVURIEN  |Slave Mode TX Under Run Interrupt Enable Bit
+     * |        |          |0 = Slave mode TX under run interrupt Disabled.
+     * |        |          |1 = Slave mode TX under run interrupt Enabled.
+     * |[12]    |SSACTIEN  |Slave Select Active Interrupt Enable Bit
+     * |        |          |0 = Slave select active interrupt Disabled.
+     * |        |          |1 = Slave select active interrupt Enabled.
+     * |[13]    |SSINAIEN  |Slave Select Inactive Interrupt Enable Bit
+     * |        |          |0 = Slave select inactive interrupt Disabled.
+     * |        |          |1 = Slave select inactive interrupt Enabled.
+     * @var SPI_T::PDMACTL
+     * Offset: 0x0C  SPI PDMA Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |TXPDMAEN  |Transmit PDMA Enable Bit
+     * |        |          |0 = Transmit PDMA function Disabled.
+     * |        |          |1 = Transmit PDMA function Enabled.
+     * |        |          |Note: In SPI Master mode with full duplex transfer, if both TX and RX PDMA functions are enabled, RX PDMA function cannot be enabled prior to TX PDMA function
+     * |        |          |User can enable TX PDMA function firstly or enable both functions simultaneously.
+     * |[1]     |RXPDMAEN  |Receive PDMA Enable Bit
+     * |        |          |0 = Receive PDMA function Disabled.
+     * |        |          |1 = Receive PDMA function Enabled.
+     * |[2]     |PDMARST   |PDMA Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset the PDMA control logic of the SPI controller. This bit will be automatically cleared to 0.
+     * @var SPI_T::FIFOCTL
+     * Offset: 0x10  SPI FIFO Control Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |RXRST     |Receive Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset receive FIFO pointer and receive circuit
+     * |        |          |The RXFULL bit will be cleared to 0 and the RXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 3 system clock cycles + 2 peripheral clock cycles after it is set to 1
+     * |        |          |User can read TXRXRST (SPIx_STATUS[23]) to check if reset is accomplished or not.
+     * |[1]     |TXRST     |Transmit Reset
+     * |        |          |0 = No effect.
+     * |        |          |1 = Reset transmit FIFO pointer and transmit circuit
+     * |        |          |The TXFULL bit will be cleared to 0 and the TXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 3 system clock cycles + 2 peripheral clock cycles after it is set to 1
+     * |        |          |User can read TXRXRST (SPIx_STATUS[23]) to check if reset is accomplished or not.
+     * |        |          |Note: If TX underflow event occurs in SPI Slave mode, this bit can be used to make SPI return to idle state.
+     * |[2]     |RXTHIEN   |Receive FIFO Threshold Interrupt Enable Bit
+     * |        |          |0 = RX FIFO threshold interrupt Disabled.
+     * |        |          |1 = RX FIFO threshold interrupt Enabled.
+     * |[3]     |TXTHIEN   |Transmit FIFO Threshold Interrupt Enable Bit
+     * |        |          |0 = TX FIFO threshold interrupt Disabled.
+     * |        |          |1 = TX FIFO threshold interrupt Enabled.
+     * |[4]     |RXTOIEN   |Slave Receive Time-out Interrupt Enable Bit
+     * |        |          |0 = Receive time-out interrupt Disabled.
+     * |        |          |1 = Receive time-out interrupt Enabled.
+     * |[5]     |RXOVIEN   |Receive FIFO Overrun Interrupt Enable Bit
+     * |        |          |0 = Receive FIFO overrun interrupt Disabled.
+     * |        |          |1 = Receive FIFO overrun interrupt Enabled.
+     * |[6]     |TXUFPOL   |TX Underflow Data Polarity
+     * |        |          |0 = The SPI data out is keep 0 if there is TX underflow event in Slave mode.
+     * |        |          |1 = The SPI data out is keep 1 if there is TX underflow event in Slave mode.
+     * |        |          |Note:
+     * |        |          |1. The TX underflow event occurs if there is no any data in TX FIFO when the slave selection signal is active.
+     * |        |          |2. This bit should be set as 0 in I2S mode.
+     * |        |          |3. When TX underflow event occurs, SPIx_MISO pin state will be determined by this setting even though TX FIFO is not empty afterward
+     * |        |          |Data stored in TX FIFO will be sent through SPIx_MISO pin in the next transfer frame.
+     * |[7]     |TXUFIEN   |TX Underflow Interrupt Enable Bit
+     * |        |          |When TX underflow event occurs in Slave mode, TXUFIF (SPIx_STATUS[19]) will be set to 1
+     * |        |          |This bit is used to enable the TX underflow interrupt.
+     * |        |          |0 = Slave TX underflow interrupt Disabled.
+     * |        |          |1 = Slave TX underflow interrupt Enabled.
+     * |[8]     |RXFBCLR   |Receive FIFO Buffer Clear
+     * |        |          |0 = No effect.
+     * |        |          |1 = Clear receive FIFO pointer
+     * |        |          |The RXFULL bit will be cleared to 0 and the RXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 1 system clock after it is set to 1.
+     * |        |          |Note: The RX shift register will not be cleared.
+     * |[9]     |TXFBCLR   |Transmit FIFO Buffer Clear
+     * |        |          |0 = No effect.
+     * |        |          |1 = Clear transmit FIFO pointer
+     * |        |          |The TXFULL bit will be cleared to 0 and the TXEMPTY bit will be set to 1
+     * |        |          |This bit will be cleared to 0 by hardware about 1 system clock after it is set to 1.
+     * |        |          |Note: The TX shift register will not be cleared.
+     * |[26:24] |RXTH      |Receive FIFO Threshold
+     * |        |          |If the valid data count of the receive FIFO buffer is larger than the RXTH setting, the RXTHIF bit will be set to 1, else the RXTHIF bit will be cleared to 0
+     * |        |          |For SPI1~SPI4, the MSB of this bit field is only meaningful while SPI mode 8~16 bits of data length.
+     * |[30:28] |TXTH      |Transmit FIFO Threshold
+     * |        |          |If the valid data count of the transmit FIFO buffer is less than or equal to the TXTH setting, the TXTHIF bit will be set to 1, else the TXTHIF bit will be cleared to 0
+     * |        |          |For SPI1~SPI4, the MSB of this bit field is only meaningful while SPI mode 8~16 bits of data length
+     * @var SPI_T::STATUS
+     * Offset: 0x14  SPI Status Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[0]     |BUSY      |Busy Status (Read Only)
+     * |        |          |0 = SPI controller is in idle state.
+     * |        |          |1 = SPI controller is in busy state.
+     * |        |          |The following listing are the bus busy conditions:
+     * |        |          |a. SPIx_CTL[0] = 1 and TXEMPTY = 0.
+     * |        |          |b
+     * |        |          |For SPI Master mode, SPIx_CTL[0] = 1 and TXEMPTY = 1 but the current transaction is not finished yet.
+     * |        |          |c. For SPI Master mode, SPIx_CTL[0] = 1 and RXONLY = 1.
+     * |        |          |d
+     * |        |          |For SPI Slave mode, the SPIx_CTL[0] = 1 and there is serial clock input into the SPI core logic when slave select is active.
+     * |        |          |For SPI Slave mode, the SPIx_CTL[0] = 1 and the transmit buffer or transmit shift register is not empty even if the slave select is inactive.
+     * |[1]     |UNITIF    |Unit Transfer Interrupt Flag
+     * |        |          |0 = No transaction has been finished since this bit was cleared to 0.
+     * |        |          |1 = SPI controller has finished one unit transfer.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[2]     |SSACTIF   |Slave Select Active Interrupt Flag
+     * |        |          |0 = Slave select active interrupt was cleared or not occurred.
+     * |        |          |1 = Slave select active interrupt event occurred.
+     * |        |          |Note: Only available in Slave mode. This bit will be cleared by writing 1 to it.
+     * |[3]     |SSINAIF   |Slave Select Inactive Interrupt Flag
+     * |        |          |0 = Slave select inactive interrupt was cleared or not occurred.
+     * |        |          |1 = Slave select inactive interrupt event occurred.
+     * |        |          |Note: Only available in Slave mode. This bit will be cleared by writing 1 to it.
+     * |[4]     |SSLINE    |Slave Select Line Bus Status (Read Only)
+     * |        |          |0 = The slave select line status is 0.
+     * |        |          |1 = The slave select line status is 1.
+     * |        |          |Note: This bit is only available in Slave mode
+     * |        |          |If SSACTPOL (SPIx_SSCTL[2]) is set 0, and the SSLINE is 1, the SPI slave select is in inactive status.
+     * |[6]     |SLVBEIF   |Slave Mode Bit Count Error Interrupt Flag
+     * |        |          |In Slave mode, when the slave select line goes to inactive state, if bit counter is mismatch with DWIDTH, this interrupt flag will be set to 1.
+     * |        |          |0 = No Slave mode bit count error event.
+     * |        |          |1 = Slave mode bit count error event occurs.
+     * |        |          |Note: If the slave select active but there is no any bus clock input, the SLVBEIF also active when the slave select goes to inactive state
+     * |        |          |This bit will be cleared by writing 1 to it.
+     * |[7]     |SLVURIF   |Slave Mode TX Under Run Interrupt Flag
+     * |        |          |In Slave mode, if TX underflow event occurs and the slave select line goes to inactive state, this interrupt flag will be set to 1.
+     * |        |          |0 = No Slave TX under run event.
+     * |        |          |1 = Slave TX under run event occurs.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[8]     |RXEMPTY   |Receive FIFO Buffer Empty Indicator (Read Only)
+     * |        |          |0 = Receive FIFO buffer is not empty.
+     * |        |          |1 = Receive FIFO buffer is empty.
+     * |[9]     |RXFULL    |Receive FIFO Buffer Full Indicator (Read Only)
+     * |        |          |0 = Receive FIFO buffer is not full.
+     * |        |          |1 = Receive FIFO buffer is full.
+     * |[10]    |RXTHIF    |Receive FIFO Threshold Interrupt Flag (Read Only)
+     * |        |          |0 = The valid data count within the receive FIFO buffer is smaller than or equal to the setting value of RXTH.
+     * |        |          |1 = The valid data count within the receive FIFO buffer is larger than the setting value of RXTH.
+     * |[11]    |RXOVIF    |Receive FIFO Overrun Interrupt Flag
+     * |        |          |When the receive FIFO buffer is full, the follow-up data will be dropped and this bit will be set to 1.
+     * |        |          |0 = No FIFO is overrun.
+     * |        |          |1 = Receive FIFO is overrun.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[12]    |RXTOIF    |Receive Time-out Interrupt Flag
+     * |        |          |0 = No receive FIFO time-out event.
+     * |        |          |1 = Receive FIFO buffer is not empty and no read operation on receive FIFO buffer over 64 SPI peripheral clock periods in Master mode or over 576 SPI peripheral clock periods in Slave mode
+     * |        |          |When the received FIFO buffer is read by software, the time-out status will be cleared automatically.
+     * |        |          |Note: This bit will be cleared by writing 1 to it.
+     * |[15]    |SPIENSTS  |SPI Enable Status (Read Only)
+     * |        |          |0 = The SPI controller is disabled.
+     * |        |          |1 = The SPI controller is enabled.
+     * |        |          |Note: The SPI peripheral clock is asynchronous with the system clock
+     * |        |          |In order to make sure the SPI control logic is disabled, this bit indicates the real status of SPI controller.
+     * |[16]    |TXEMPTY   |Transmit FIFO Buffer Empty Indicator (Read Only)
+     * |        |          |0 = Transmit FIFO buffer is not empty.
+     * |        |          |1 = Transmit FIFO buffer is empty.
+     * |[17]    |TXFULL    |Transmit FIFO Buffer Full Indicator (Read Only)
+     * |        |          |0 = Transmit FIFO buffer is not full.
+     * |        |          |1 = Transmit FIFO buffer is full.
+     * |[18]    |TXTHIF    |Transmit FIFO Threshold Interrupt Flag (Read Only)
+     * |        |          |0 = The valid data count within the transmit FIFO buffer is larger than the setting value of TXTH.
+     * |        |          |1 = The valid data count within the transmit FIFO buffer is less than or equal to the setting value of TXTH.
+     * |[19]    |TXUFIF    |TX Underflow Interrupt Flag
+     * |        |          |When the TX underflow event occurs, this bit will be set to 1, the state of data output pin depends on the setting of TXUFPOL.
+     * |        |          |0 = No effect.
+     * |        |          |1 = No data in Transmit FIFO and TX shift register when the slave selection signal is active.
+     * |        |          |Note 1: This bit will be cleared by writing 1 to it.
+     * |        |          |Note 2: If reset slave's transmission circuit when slave selection signal is active, this flag will be set to 1 after 2 peripheral clock cycles + 3 system clock cycles since the reset operation is done.
+     * |[23]    |TXRXRST   |TX or RX Reset Status (Read Only)
+     * |        |          |0 = The reset function of TXRST or RXRST is done.
+     * |        |          |1 = Doing the reset function of TXRST or RXRST.
+     * |        |          |Note: Both the reset operations of TXRST and RXRST need 3 system clock cycles + 2 peripheral clock cycles
+     * |        |          |User can check the status of this bit to monitor the reset function is doing or done.
+     * |[27:24] |RXCNT     |Receive FIFO Data Count (Read Only)
+     * |        |          |This bit field indicates the valid data count of receive FIFO buffer.
+     * |[31:28] |TXCNT     |Transmit FIFO Data Count (Read Only)
+     * |        |          |This bit field indicates the valid data count of transmit FIFO buffer.
+     * @var SPI_T::TX
+     * Offset: 0x20  SPI Data Transmit Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |TX        |Data Transmit Register
+     * |        |          |The data transmit registers pass through the transmitted data into the 4-level transmit FIFO buffers
+     * |        |          |The number of valid bits depends on the setting of DWIDTH (SPIx_CTL[12:8]) in SPI mode or WDWIDTH (SPIx_I2SCTL[5:4]) in I2S mode.
+     * |        |          |In SPI mode, if DWIDTH is set to 0x08, the bits TX[7:0] will be transmitted
+     * |        |          |If DWIDTH is set to 0x00 , the SPI controller will perform a 32-bit transfer.
+     * |        |          |In I2S mode, if WDWIDTH (SPIx_I2SCTL[5:4]) is set to 0x2, the data width of audio channel is 24-bit and corresponding to TX[23:0]
+     * |        |          |If WDWIDTH is set as 0x0, 0x1, or 0x3, all bits of this field are valid and referred to the data arrangement in I2S mode FIFO operation section
+     * |        |          |Note: In Master mode, SPI controller will start to transfer the SPI bus clock after 1 APB clock and 6 peripheral clock cycles after user writes to this register.
+     * @var SPI_T::RX
+     * Offset: 0x30  SPI Data Receive Register
+     * ---------------------------------------------------------------------------------------------------
+     * |Bits    |Field     |Descriptions
+     * | :----: | :----:   | :---- |
+     * |[31:0]  |RX        |Data Receive Register
+     * |        |          |There are 4-level FIFO buffers in this controller
+     * |        |          |The data receive register holds the data received from SPI data input pin
+     * |        |          |If the RXEMPTY (SPIx_STATUS[8] or SPIx_I2SSTS[8]) is not set to 1, the receive FIFO buffers can be accessed through software by reading this register
+     * |        |          |This is a read only register.
+     */
+    __IO uint32_t CTL;                   /*!< [0x0000] SPI Control Register                                             */
+    __IO uint32_t CLKDIV;                /*!< [0x0004] SPI Clock Divider Register                                       */
+    __IO uint32_t SSCTL;                 /*!< [0x0008] SPI Slave Select Control Register                                */
+    __IO uint32_t PDMACTL;               /*!< [0x000c] SPI PDMA Control Register                                        */
+    __IO uint32_t FIFOCTL;               /*!< [0x0010] SPI FIFO Control Register                                        */
+    __IO uint32_t STATUS;                /*!< [0x0014] SPI Status Register                                              */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE0[2];
+    /// @endcond //HIDDEN_SYMBOLS
+    __O  uint32_t TX;                    /*!< [0x0020] SPI Data Transmit Register                                       */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE1[3];
+    /// @endcond //HIDDEN_SYMBOLS
+    __I  uint32_t RX;                    /*!< [0x0030] SPI Data Receive Register                                        */
+    /// @cond HIDDEN_SYMBOLS
+    __I  uint32_t RESERVE2[11];
+    /// @endcond //HIDDEN_SYMBOLS
+
+} SPI_T;
+
+/**
+    @addtogroup SPI_CONST SPI Bit Field Definition
+    Constant Definitions for SPI Controller
+@{ */
+
+#define SPI_CTL_SPIEN_Pos                (0)                                               /*!< SPI_T::CTL: SPIEN Position             */
+#define SPI_CTL_SPIEN_Msk                (0x1ul << SPI_CTL_SPIEN_Pos)                      /*!< SPI_T::CTL: SPIEN Mask                 */
+
+#define SPI_CTL_RXNEG_Pos                (1)                                               /*!< SPI_T::CTL: RXNEG Position             */
+#define SPI_CTL_RXNEG_Msk                (0x1ul << SPI_CTL_RXNEG_Pos)                      /*!< SPI_T::CTL: RXNEG Mask                 */
+
+#define SPI_CTL_TXNEG_Pos                (2)                                               /*!< SPI_T::CTL: TXNEG Position             */
+#define SPI_CTL_TXNEG_Msk                (0x1ul << SPI_CTL_TXNEG_Pos)                      /*!< SPI_T::CTL: TXNEG Mask                 */
+
+#define SPI_CTL_CLKPOL_Pos               (3)                                               /*!< SPI_T::CTL: CLKPOL Position            */
+#define SPI_CTL_CLKPOL_Msk               (0x1ul << SPI_CTL_CLKPOL_Pos)                     /*!< SPI_T::CTL: CLKPOL Mask                */
+
+#define SPI_CTL_SUSPITV_Pos              (4)                                               /*!< SPI_T::CTL: SUSPITV Position           */
+#define SPI_CTL_SUSPITV_Msk              (0xful << SPI_CTL_SUSPITV_Pos)                    /*!< SPI_T::CTL: SUSPITV Mask               */
+
+#define SPI_CTL_DWIDTH_Pos               (8)                                               /*!< SPI_T::CTL: DWIDTH Position            */
+#define SPI_CTL_DWIDTH_Msk               (0x1ful << SPI_CTL_DWIDTH_Pos)                    /*!< SPI_T::CTL: DWIDTH Mask                */
+
+#define SPI_CTL_LSB_Pos                  (13)                                              /*!< SPI_T::CTL: LSB Position               */
+#define SPI_CTL_LSB_Msk                  (0x1ul << SPI_CTL_LSB_Pos)                        /*!< SPI_T::CTL: LSB Mask                   */
+
+#define SPI_CTL_HALFDPX_Pos              (14)                                              /*!< SPI_T::CTL: HALFDPX Position           */
+#define SPI_CTL_HALFDPX_Msk              (0x1ul << SPI_CTL_HALFDPX_Pos)                    /*!< SPI_T::CTL: HALFDPX Mask               */
+
+#define SPI_CTL_RXONLY_Pos               (15)                                              /*!< SPI_T::CTL: RXONLY Position            */
+#define SPI_CTL_RXONLY_Msk               (0x1ul << SPI_CTL_RXONLY_Pos)                     /*!< SPI_T::CTL: RXONLY Mask                */
+
+#define SPI_CTL_UNITIEN_Pos              (17)                                              /*!< SPI_T::CTL: UNITIEN Position           */
+#define SPI_CTL_UNITIEN_Msk              (0x1ul << SPI_CTL_UNITIEN_Pos)                    /*!< SPI_T::CTL: UNITIEN Mask               */
+
+#define SPI_CTL_SLAVE_Pos                (18)                                              /*!< SPI_T::CTL: SLAVE Position             */
+#define SPI_CTL_SLAVE_Msk                (0x1ul << SPI_CTL_SLAVE_Pos)                      /*!< SPI_T::CTL: SLAVE Mask                 */
+
+#define SPI_CTL_REORDER_Pos              (19)                                              /*!< SPI_T::CTL: REORDER Position           */
+#define SPI_CTL_REORDER_Msk              (0x1ul << SPI_CTL_REORDER_Pos)                    /*!< SPI_T::CTL: REORDER Mask               */
+
+#define SPI_CTL_DATDIR_Pos               (20)                                              /*!< SPI_T::CTL: DATDIR Position            */
+#define SPI_CTL_DATDIR_Msk               (0x1ul << SPI_CTL_DATDIR_Pos)                     /*!< SPI_T::CTL: DATDIR Mask                */
+
+#define SPI_CLKDIV_DIVIDER_Pos           (0)                                               /*!< SPI_T::CLKDIV: DIVIDER Position        */
+#define SPI_CLKDIV_DIVIDER_Msk           (0x1fful << SPI_CLKDIV_DIVIDER_Pos)               /*!< SPI_T::CLKDIV: DIVIDER Mask            */
+
+#define SPI_SSCTL_SS_Pos                 (0)                                               /*!< SPI_T::SSCTL: SS Position              */
+#define SPI_SSCTL_SS_Msk                 (0x1ul << SPI_SSCTL_SS_Pos)                       /*!< SPI_T::SSCTL: SS Mask                  */
+
+#define SPI_SSCTL_SSACTPOL_Pos           (2)                                               /*!< SPI_T::SSCTL: SSACTPOL Position        */
+#define SPI_SSCTL_SSACTPOL_Msk           (0x1ul << SPI_SSCTL_SSACTPOL_Pos)                 /*!< SPI_T::SSCTL: SSACTPOL Mask            */
+
+#define SPI_SSCTL_AUTOSS_Pos             (3)                                               /*!< SPI_T::SSCTL: AUTOSS Position          */
+#define SPI_SSCTL_AUTOSS_Msk             (0x1ul << SPI_SSCTL_AUTOSS_Pos)                   /*!< SPI_T::SSCTL: AUTOSS Mask              */
+
+#define SPI_SSCTL_SLVBEIEN_Pos           (8)                                               /*!< SPI_T::SSCTL: SLVBEIEN Position        */
+#define SPI_SSCTL_SLVBEIEN_Msk           (0x1ul << SPI_SSCTL_SLVBEIEN_Pos)                 /*!< SPI_T::SSCTL: SLVBEIEN Mask            */
+
+#define SPI_SSCTL_SLVURIEN_Pos           (9)                                               /*!< SPI_T::SSCTL: SLVURIEN Position        */
+#define SPI_SSCTL_SLVURIEN_Msk           (0x1ul << SPI_SSCTL_SLVURIEN_Pos)                 /*!< SPI_T::SSCTL: SLVURIEN Mask            */
+
+#define SPI_SSCTL_SSACTIEN_Pos           (12)                                              /*!< SPI_T::SSCTL: SSACTIEN Position        */
+#define SPI_SSCTL_SSACTIEN_Msk           (0x1ul << SPI_SSCTL_SSACTIEN_Pos)                 /*!< SPI_T::SSCTL: SSACTIEN Mask            */
+
+#define SPI_SSCTL_SSINAIEN_Pos           (13)                                              /*!< SPI_T::SSCTL: SSINAIEN Position        */
+#define SPI_SSCTL_SSINAIEN_Msk           (0x1ul << SPI_SSCTL_SSINAIEN_Pos)                 /*!< SPI_T::SSCTL: SSINAIEN Mask            */
+
+#define SPI_SSCTL_SLVTOCNT_Pos           (16)                                              /*!< SPI_T::SSCTL: SLVTOCNT Position        */
+#define SPI_SSCTL_SLVTOCNT_Msk           (0xfffful << SPI_SSCTL_SLVTOCNT_Pos)              /*!< SPI_T::SSCTL: SLVTOCNT Mask            */
+
+#define SPI_PDMACTL_TXPDMAEN_Pos         (0)                                               /*!< SPI_T::PDMACTL: TXPDMAEN Position      */
+#define SPI_PDMACTL_TXPDMAEN_Msk         (0x1ul << SPI_PDMACTL_TXPDMAEN_Pos)               /*!< SPI_T::PDMACTL: TXPDMAEN Mask          */
+
+#define SPI_PDMACTL_RXPDMAEN_Pos         (1)                                               /*!< SPI_T::PDMACTL: RXPDMAEN Position      */
+#define SPI_PDMACTL_RXPDMAEN_Msk         (0x1ul << SPI_PDMACTL_RXPDMAEN_Pos)               /*!< SPI_T::PDMACTL: RXPDMAEN Mask          */
+
+#define SPI_PDMACTL_PDMARST_Pos          (2)                                               /*!< SPI_T::PDMACTL: PDMARST Position       */
+#define SPI_PDMACTL_PDMARST_Msk          (0x1ul << SPI_PDMACTL_PDMARST_Pos)                /*!< SPI_T::PDMACTL: PDMARST Mask           */
+
+#define SPI_FIFOCTL_RXRST_Pos            (0)                                               /*!< SPI_T::FIFOCTL: RXRST Position         */
+#define SPI_FIFOCTL_RXRST_Msk            (0x1ul << SPI_FIFOCTL_RXRST_Pos)                  /*!< SPI_T::FIFOCTL: RXRST Mask             */
+
+#define SPI_FIFOCTL_TXRST_Pos            (1)                                               /*!< SPI_T::FIFOCTL: TXRST Position         */
+#define SPI_FIFOCTL_TXRST_Msk            (0x1ul << SPI_FIFOCTL_TXRST_Pos)                  /*!< SPI_T::FIFOCTL: TXRST Mask             */
+
+#define SPI_FIFOCTL_RXTHIEN_Pos          (2)                                               /*!< SPI_T::FIFOCTL: RXTHIEN Position       */
+#define SPI_FIFOCTL_RXTHIEN_Msk          (0x1ul << SPI_FIFOCTL_RXTHIEN_Pos)                /*!< SPI_T::FIFOCTL: RXTHIEN Mask           */
+
+#define SPI_FIFOCTL_TXTHIEN_Pos          (3)                                               /*!< SPI_T::FIFOCTL: TXTHIEN Position       */
+#define SPI_FIFOCTL_TXTHIEN_Msk          (0x1ul << SPI_FIFOCTL_TXTHIEN_Pos)                /*!< SPI_T::FIFOCTL: TXTHIEN Mask           */
+
+#define SPI_FIFOCTL_RXTOIEN_Pos          (4)                                               /*!< SPI_T::FIFOCTL: RXTOIEN Position       */
+#define SPI_FIFOCTL_RXTOIEN_Msk          (0x1ul << SPI_FIFOCTL_RXTOIEN_Pos)                /*!< SPI_T::FIFOCTL: RXTOIEN Mask           */
+
+#define SPI_FIFOCTL_RXOVIEN_Pos          (5)                                               /*!< SPI_T::FIFOCTL: RXOVIEN Position       */
+#define SPI_FIFOCTL_RXOVIEN_Msk          (0x1ul << SPI_FIFOCTL_RXOVIEN_Pos)                /*!< SPI_T::FIFOCTL: RXOVIEN Mask           */
+
+#define SPI_FIFOCTL_TXUFPOL_Pos          (6)                                               /*!< SPI_T::FIFOCTL: TXUFPOL Position       */
+#define SPI_FIFOCTL_TXUFPOL_Msk          (0x1ul << SPI_FIFOCTL_TXUFPOL_Pos)                /*!< SPI_T::FIFOCTL: TXUFPOL Mask           */
+
+#define SPI_FIFOCTL_TXUFIEN_Pos          (7)                                               /*!< SPI_T::FIFOCTL: TXUFIEN Position       */
+#define SPI_FIFOCTL_TXUFIEN_Msk          (0x1ul << SPI_FIFOCTL_TXUFIEN_Pos)                /*!< SPI_T::FIFOCTL: TXUFIEN Mask           */
+
+#define SPI_FIFOCTL_RXFBCLR_Pos          (8)                                               /*!< SPI_T::FIFOCTL: RXFBCLR Position       */
+#define SPI_FIFOCTL_RXFBCLR_Msk          (0x1ul << SPI_FIFOCTL_RXFBCLR_Pos)                /*!< SPI_T::FIFOCTL: RXFBCLR Mask           */
+
+#define SPI_FIFOCTL_TXFBCLR_Pos          (9)                                               /*!< SPI_T::FIFOCTL: TXFBCLR Position       */
+#define SPI_FIFOCTL_TXFBCLR_Msk          (0x1ul << SPI_FIFOCTL_TXFBCLR_Pos)                /*!< SPI_T::FIFOCTL: TXFBCLR Mask           */
+
+#define SPI_FIFOCTL_RXTH_Pos             (24)                                              /*!< SPI_T::FIFOCTL: RXTH Position          */
+#define SPI_FIFOCTL_RXTH_Msk             (0x7ul << SPI_FIFOCTL_RXTH_Pos)                   /*!< SPI_T::FIFOCTL: RXTH Mask              */
+
+#define SPI_FIFOCTL_TXTH_Pos             (28)                                              /*!< SPI_T::FIFOCTL: TXTH Position          */
+#define SPI_FIFOCTL_TXTH_Msk             (0x7ul << SPI_FIFOCTL_TXTH_Pos)                   /*!< SPI_T::FIFOCTL: TXTH Mask              */
+
+#define SPI_STATUS_BUSY_Pos              (0)                                               /*!< SPI_T::STATUS: BUSY Position           */
+#define SPI_STATUS_BUSY_Msk              (0x1ul << SPI_STATUS_BUSY_Pos)                    /*!< SPI_T::STATUS: BUSY Mask               */
+
+#define SPI_STATUS_UNITIF_Pos            (1)                                               /*!< SPI_T::STATUS: UNITIF Position         */
+#define SPI_STATUS_UNITIF_Msk            (0x1ul << SPI_STATUS_UNITIF_Pos)                  /*!< SPI_T::STATUS: UNITIF Mask             */
+
+#define SPI_STATUS_SSACTIF_Pos           (2)                                               /*!< SPI_T::STATUS: SSACTIF Position        */
+#define SPI_STATUS_SSACTIF_Msk           (0x1ul << SPI_STATUS_SSACTIF_Pos)                 /*!< SPI_T::STATUS: SSACTIF Mask            */
+
+#define SPI_STATUS_SSINAIF_Pos           (3)                                               /*!< SPI_T::STATUS: SSINAIF Position        */
+#define SPI_STATUS_SSINAIF_Msk           (0x1ul << SPI_STATUS_SSINAIF_Pos)                 /*!< SPI_T::STATUS: SSINAIF Mask            */
+
+#define SPI_STATUS_SSLINE_Pos            (4)                                               /*!< SPI_T::STATUS: SSLINE Position         */
+#define SPI_STATUS_SSLINE_Msk            (0x1ul << SPI_STATUS_SSLINE_Pos)                  /*!< SPI_T::STATUS: SSLINE Mask             */
+
+#define SPI_STATUS_SLVBEIF_Pos           (6)                                               /*!< SPI_T::STATUS: SLVBEIF Position        */
+#define SPI_STATUS_SLVBEIF_Msk           (0x1ul << SPI_STATUS_SLVBEIF_Pos)                 /*!< SPI_T::STATUS: SLVBEIF Mask            */
+
+#define SPI_STATUS_SLVURIF_Pos           (7)                                               /*!< SPI_T::STATUS: SLVURIF Position        */
+#define SPI_STATUS_SLVURIF_Msk           (0x1ul << SPI_STATUS_SLVURIF_Pos)                 /*!< SPI_T::STATUS: SLVURIF Mask            */
+
+#define SPI_STATUS_RXEMPTY_Pos           (8)                                               /*!< SPI_T::STATUS: RXEMPTY Position        */
+#define SPI_STATUS_RXEMPTY_Msk           (0x1ul << SPI_STATUS_RXEMPTY_Pos)                 /*!< SPI_T::STATUS: RXEMPTY Mask            */
+
+#define SPI_STATUS_RXFULL_Pos            (9)                                               /*!< SPI_T::STATUS: RXFULL Position         */
+#define SPI_STATUS_RXFULL_Msk            (0x1ul << SPI_STATUS_RXFULL_Pos)                  /*!< SPI_T::STATUS: RXFULL Mask             */
+
+#define SPI_STATUS_RXTHIF_Pos            (10)                                              /*!< SPI_T::STATUS: RXTHIF Position         */
+#define SPI_STATUS_RXTHIF_Msk            (0x1ul << SPI_STATUS_RXTHIF_Pos)                  /*!< SPI_T::STATUS: RXTHIF Mask             */
+
+#define SPI_STATUS_RXOVIF_Pos            (11)                                              /*!< SPI_T::STATUS: RXOVIF Position         */
+#define SPI_STATUS_RXOVIF_Msk            (0x1ul << SPI_STATUS_RXOVIF_Pos)                  /*!< SPI_T::STATUS: RXOVIF Mask             */
+
+#define SPI_STATUS_RXTOIF_Pos            (12)                                              /*!< SPI_T::STATUS: RXTOIF Position         */
+#define SPI_STATUS_RXTOIF_Msk            (0x1ul << SPI_STATUS_RXTOIF_Pos)                  /*!< SPI_T::STATUS: RXTOIF Mask             */
+
+#define SPI_STATUS_SPIENSTS_Pos          (15)                                              /*!< SPI_T::STATUS: SPIENSTS Position       */
+#define SPI_STATUS_SPIENSTS_Msk          (0x1ul << SPI_STATUS_SPIENSTS_Pos)                /*!< SPI_T::STATUS: SPIENSTS Mask           */
+
+#define SPI_STATUS_TXEMPTY_Pos           (16)                                              /*!< SPI_T::STATUS: TXEMPTY Position        */
+#define SPI_STATUS_TXEMPTY_Msk           (0x1ul << SPI_STATUS_TXEMPTY_Pos)                 /*!< SPI_T::STATUS: TXEMPTY Mask            */
+
+#define SPI_STATUS_TXFULL_Pos            (17)                                              /*!< SPI_T::STATUS: TXFULL Position         */
+#define SPI_STATUS_TXFULL_Msk            (0x1ul << SPI_STATUS_TXFULL_Pos)                  /*!< SPI_T::STATUS: TXFULL Mask             */
+
+#define SPI_STATUS_TXTHIF_Pos            (18)                                              /*!< SPI_T::STATUS: TXTHIF Position         */
+#define SPI_STATUS_TXTHIF_Msk            (0x1ul << SPI_STATUS_TXTHIF_Pos)                  /*!< SPI_T::STATUS: TXTHIF Mask             */
+
+#define SPI_STATUS_TXUFIF_Pos            (19)                                              /*!< SPI_T::STATUS: TXUFIF Position         */
+#define SPI_STATUS_TXUFIF_Msk            (0x1ul << SPI_STATUS_TXUFIF_Pos)                  /*!< SPI_T::STATUS: TXUFIF Mask             */
+
+#define SPI_STATUS_TXRXRST_Pos           (23)                                              /*!< SPI_T::STATUS: TXRXRST Position        */
+#define SPI_STATUS_TXRXRST_Msk           (0x1ul << SPI_STATUS_TXRXRST_Pos)                 /*!< SPI_T::STATUS: TXRXRST Mask            */
+
+#define SPI_STATUS_RXCNT_Pos             (24)                                              /*!< SPI_T::STATUS: RXCNT Position          */
+#define SPI_STATUS_RXCNT_Msk             (0xful << SPI_STATUS_RXCNT_Pos)                   /*!< SPI_T::STATUS: RXCNT Mask              */
+
+#define SPI_STATUS_TXCNT_Pos             (28)                                              /*!< SPI_T::STATUS: TXCNT Position          */
+#define SPI_STATUS_TXCNT_Msk             (0xful << SPI_STATUS_TXCNT_Pos)                   /*!< SPI_T::STATUS: TXCNT Mask              */
+
+#define SPI_TX_TX_Pos                    (0)                                               /*!< SPI_T::TX: TX Position                 */
+#define SPI_TX_TX_Msk                    (0xfffffffful << SPI_TX_TX_Pos)                   /*!< SPI_T::TX: TX Mask                     */
+
+#define SPI_RX_RX_Pos                    (0)                                               /*!< SPI_T::RX: RX Position                 */
+#define SPI_RX_RX_Msk                    (0xfffffffful << SPI_RX_RX_Pos)                   /*!< SPI_T::RX: RX Mask                     */
+
+/**@}*/ /* SPI_CONST */
+/**@}*/ /* end of SPI register group */
+/**@}*/ /* end of REGISTER group */
+
+#define SPI0                  ((SPI_T *)   SPI0_BA)
+#define SPI1                  ((SPI_T *)   SPI1_BA)
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup SPI_Driver SPI Driver
+  @{
+*/
+
+/** @addtogroup SPI_EXPORTED_CONSTANTS SPI Exported Constants
+  @{
+*/
+#define SPI_MODE_0        (SPI_CTL_TXNEG_Msk)                             /*!< CLKPOL=0; RXNEG=0; TXNEG=1 \hideinitializer */
+#define SPI_MODE_1        (SPI_CTL_RXNEG_Msk)                             /*!< CLKPOL=0; RXNEG=1; TXNEG=0 \hideinitializer */
+#define SPI_MODE_2        (SPI_CTL_CLKPOL_Msk | SPI_CTL_RXNEG_Msk)        /*!< CLKPOL=1; RXNEG=1; TXNEG=0 \hideinitializer */
+#define SPI_MODE_3        (SPI_CTL_CLKPOL_Msk | SPI_CTL_TXNEG_Msk)        /*!< CLKPOL=1; RXNEG=0; TXNEG=1 \hideinitializer */
+
+#define SPI_SLAVE         (SPI_CTL_SLAVE_Msk)                             /*!< Set as slave \hideinitializer */
+#define SPI_MASTER        (0x0U)                                          /*!< Set as master \hideinitializer */
+
+#define SPI_SS                (SPI_SSCTL_SS_Msk)                          /*!< Set SS \hideinitializer */
+#define SPI_SS_ACTIVE_HIGH    (SPI_SSCTL_SSACTPOL_Msk)                    /*!< SS active high \hideinitializer */
+#define SPI_SS_ACTIVE_LOW     (0x0U)                                      /*!< SS active low \hideinitializer */
+
+/* SPI Interrupt Mask */
+#define SPI_UNIT_INT_MASK                (0x001U)                          /*!< Unit transfer interrupt mask \hideinitializer */
+#define SPI_SSACT_INT_MASK               (0x002U)                          /*!< Slave selection signal active interrupt mask \hideinitializer */
+#define SPI_SSINACT_INT_MASK             (0x004U)                          /*!< Slave selection signal inactive interrupt mask \hideinitializer */
+#define SPI_SLVUR_INT_MASK               (0x008U)                          /*!< Slave under run interrupt mask \hideinitializer */
+#define SPI_SLVBE_INT_MASK               (0x010U)                          /*!< Slave bit count error interrupt mask \hideinitializer */
+#define SPI_TXUF_INT_MASK                (0x040U)                          /*!< Slave TX underflow interrupt mask \hideinitializer */
+#define SPI_FIFO_TXTH_INT_MASK           (0x080U)                          /*!< FIFO TX threshold interrupt mask \hideinitializer */
+#define SPI_FIFO_RXTH_INT_MASK           (0x100U)                          /*!< FIFO RX threshold interrupt mask \hideinitializer */
+#define SPI_FIFO_RXOV_INT_MASK           (0x200U)                          /*!< FIFO RX overrun interrupt mask \hideinitializer */
+#define SPI_FIFO_RXTO_INT_MASK           (0x400U)                          /*!< FIFO RX time-out interrupt mask \hideinitializer */
+
+/* SPI Status Mask */
+#define SPI_BUSY_MASK                    (0x01U)                           /*!< Busy status mask \hideinitializer */
+#define SPI_RX_EMPTY_MASK                (0x02U)                           /*!< RX empty status mask \hideinitializer */
+#define SPI_RX_FULL_MASK                 (0x04U)                           /*!< RX full status mask \hideinitializer */
+#define SPI_TX_EMPTY_MASK                (0x08U)                           /*!< TX empty status mask \hideinitializer */
+#define SPI_TX_FULL_MASK                 (0x10U)                           /*!< TX full status mask \hideinitializer */
+#define SPI_TXRX_RESET_MASK              (0x20U)                           /*!< TX or RX reset status mask \hideinitializer */
+#define SPI_SPIEN_STS_MASK               (0x40U)                           /*!< SPIEN status mask \hideinitializer */
+#define SPI_SSLINE_STS_MASK              (0x80U)                           /*!< SPIx_SS line status mask \hideinitializer */
+
+/*@}*/ /* end of group SPI_EXPORTED_CONSTANTS */
+
+
+/** @addtogroup SPI_EXPORTED_FUNCTIONS SPI Exported Functions
+  @{
+*/
+
+/**
+  * @brief      Clear the unit transfer interrupt flag.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Write 1 to UNITIF bit of SPI_STATUS register to clear the unit transfer interrupt flag.
+  * \hideinitializer
+  */
+#define SPI_CLR_UNIT_TRANS_INT_FLAG(spi)   ((spi)->STATUS = SPI_STATUS_UNITIF_Msk)
+
+/**
+  * @brief      Trigger RX PDMA function.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Set RXPDMAEN bit of SPI_PDMACTL register to enable RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define SPI_TRIGGER_RX_PDMA(spi)   ((spi)->PDMACTL |= SPI_PDMACTL_RXPDMAEN_Msk)
+
+/**
+  * @brief      Trigger TX PDMA function.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Set TXPDMAEN bit of SPI_PDMACTL register to enable TX PDMA transfer function.
+  * \hideinitializer
+  */
+#define SPI_TRIGGER_TX_PDMA(spi)   ((spi)->PDMACTL |= SPI_PDMACTL_TXPDMAEN_Msk)
+
+/**
+  * @brief      Trigger TX and RX PDMA function.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Set TXPDMAEN bit and RXPDMAEN bit of SPI_PDMACTL register to enable TX and RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define SPI_TRIGGER_TX_RX_PDMA(spi)   ((spi)->PDMACTL |= (SPI_PDMACTL_TXPDMAEN_Msk | SPI_PDMACTL_RXPDMAEN_Msk))
+
+/**
+  * @brief      Disable RX PDMA transfer.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Clear RXPDMAEN bit of SPI_PDMACTL register to disable RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define SPI_DISABLE_RX_PDMA(spi) ( (spi)->PDMACTL &= ~SPI_PDMACTL_RXPDMAEN_Msk )
+
+/**
+  * @brief      Disable TX PDMA transfer.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Clear TXPDMAEN bit of SPI_PDMACTL register to disable TX PDMA transfer function.
+  * \hideinitializer
+  */
+#define SPI_DISABLE_TX_PDMA(spi) ( (spi)->PDMACTL &= ~SPI_PDMACTL_TXPDMAEN_Msk )
+
+/**
+  * @brief      Disable TX and RX PDMA transfer.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Clear TXPDMAEN bit and RXPDMAEN bit of SPI_PDMACTL register to disable TX and RX PDMA transfer function.
+  * \hideinitializer
+  */
+#define SPI_DISABLE_TX_RX_PDMA(spi) ( (spi)->PDMACTL &= ~(SPI_PDMACTL_TXPDMAEN_Msk | SPI_PDMACTL_RXPDMAEN_Msk) )
+
+/**
+  * @brief      Get the count of available data in RX FIFO.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     The count of available data in RX FIFO.
+  * @details    Read RXCNT (SPI_STATUS[27:24]) to get the count of available data in RX FIFO.
+  * \hideinitializer
+  */
+#define SPI_GET_RX_FIFO_COUNT(spi)   (((spi)->STATUS & SPI_STATUS_RXCNT_Msk) >> SPI_STATUS_RXCNT_Pos)
+
+/**
+  * @brief      Get the RX FIFO empty flag.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @retval     0 RX FIFO is not empty.
+  * @retval     1 RX FIFO is empty.
+  * @details    Read RXEMPTY bit of SPI_STATUS register to get the RX FIFO empty flag.
+  * \hideinitializer
+  */
+#define SPI_GET_RX_FIFO_EMPTY_FLAG(spi)   (((spi)->STATUS & SPI_STATUS_RXEMPTY_Msk)>>SPI_STATUS_RXEMPTY_Pos)
+
+/**
+  * @brief      Get the TX FIFO empty flag.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @retval     0 TX FIFO is not empty.
+  * @retval     1 TX FIFO is empty.
+  * @details    Read TXEMPTY bit of SPI_STATUS register to get the TX FIFO empty flag.
+  * \hideinitializer
+  */
+#define SPI_GET_TX_FIFO_EMPTY_FLAG(spi)   (((spi)->STATUS & SPI_STATUS_TXEMPTY_Msk)>>SPI_STATUS_TXEMPTY_Pos)
+
+/**
+  * @brief      Get the TX FIFO full flag.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @retval     0 TX FIFO is not full.
+  * @retval     1 TX FIFO is full.
+  * @details    Read TXFULL bit of SPI_STATUS register to get the TX FIFO full flag.
+  * \hideinitializer
+  */
+#define SPI_GET_TX_FIFO_FULL_FLAG(spi)   (((spi)->STATUS & SPI_STATUS_TXFULL_Msk)>>SPI_STATUS_TXFULL_Pos)
+
+/**
+  * @brief      Get the datum read from RX register.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     Data in RX register.
+  * @details    Read SPI_RX register to get the received datum.
+  * \hideinitializer
+  */
+#define SPI_READ_RX(spi)   ((spi)->RX)
+
+/**
+  * @brief      Write datum to TX register.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @param[in]  u32TxData The datum which user attempt to transfer through SPI bus.
+  * @return     None.
+  * @details    Write u32TxData to SPI_TX register.
+  * \hideinitializer
+  */
+#define SPI_WRITE_TX(spi, u32TxData)   ((spi)->TX = (u32TxData))
+
+/**
+  * @brief      Set SPIx_SS pin to high state.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Disable automatic slave selection function and set SPIx_SS pin to high state.
+  * \hideinitializer
+  */
+#define SPI_SET_SS_HIGH(spi)   ((spi)->SSCTL = ((spi)->SSCTL & (~SPI_SSCTL_AUTOSS_Msk)) | (SPI_SSCTL_SSACTPOL_Msk | SPI_SSCTL_SS_Msk))
+
+/**
+  * @brief      Set SPIx_SS pin to low state.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Disable automatic slave selection function and set SPIx_SS pin to low state.
+  * \hideinitializer
+  */
+#define SPI_SET_SS_LOW(spi)   ((spi)->SSCTL = ((spi)->SSCTL & (~(SPI_SSCTL_AUTOSS_Msk | SPI_SSCTL_SSACTPOL_Msk))) | SPI_SSCTL_SS_Msk)
+
+/**
+  * @brief      Enable Byte Reorder function.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Enable Byte Reorder function. The suspend interval depends on the setting of SUSPITV (SPI_CTL[7:4]).
+  * \hideinitializer
+  */
+#define SPI_ENABLE_BYTE_REORDER(spi)   ((spi)->CTL |=  SPI_CTL_REORDER_Msk)
+
+/**
+  * @brief      Disable Byte Reorder function.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Clear REORDER bit field of SPI_CTL register to disable Byte Reorder function.
+  * \hideinitializer
+  */
+#define SPI_DISABLE_BYTE_REORDER(spi)   ((spi)->CTL &= ~SPI_CTL_REORDER_Msk)
+
+/**
+  * @brief      Set the length of suspend interval.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @param[in]  u32SuspCycle Decides the length of suspend interval. It could be 0 ~ 15.
+  * @return     None.
+  * @details    Set the length of suspend interval according to u32SuspCycle.
+  *             The length of suspend interval is ((u32SuspCycle + 0.5) * the length of one SPI bus clock cycle).
+  * \hideinitializer
+  */
+#define SPI_SET_SUSPEND_CYCLE(spi, u32SuspCycle)   ((spi)->CTL = ((spi)->CTL & ~SPI_CTL_SUSPITV_Msk) | ((u32SuspCycle) << SPI_CTL_SUSPITV_Pos))
+
+/**
+  * @brief      Set the SPI transfer sequence with LSB first.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Set LSB bit of SPI_CTL register to set the SPI transfer sequence with LSB first.
+  * \hideinitializer
+  */
+#define SPI_SET_LSB_FIRST(spi)   ((spi)->CTL |= SPI_CTL_LSB_Msk)
+
+/**
+  * @brief      Set the SPI transfer sequence with MSB first.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Clear LSB bit of SPI_CTL register to set the SPI transfer sequence with MSB first.
+  * \hideinitializer
+  */
+#define SPI_SET_MSB_FIRST(spi)   ((spi)->CTL &= ~SPI_CTL_LSB_Msk)
+
+/**
+  * @brief      Set the data width of a SPI transaction.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @param[in]  u32Width The bit width of one transaction.
+  * @return     None.
+  * @details    The data width can be 8 ~ 32 bits.
+  * \hideinitializer
+  */
+#define SPI_SET_DATA_WIDTH(spi, u32Width)   ((spi)->CTL = ((spi)->CTL & ~SPI_CTL_DWIDTH_Msk) | (((u32Width)&0x1F) << SPI_CTL_DWIDTH_Pos))
+
+/**
+  * @brief      Get the SPI busy state.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @retval     0 SPI controller is not busy.
+  * @retval     1 SPI controller is busy.
+  * @details    This macro will return the busy state of SPI controller.
+  * \hideinitializer
+  */
+#define SPI_IS_BUSY(spi)   ( ((spi)->STATUS & SPI_STATUS_BUSY_Msk)>>SPI_STATUS_BUSY_Pos )
+
+/**
+  * @brief      Enable SPI controller.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Set SPIEN (SPI_CTL[0]) to enable SPI controller.
+  * \hideinitializer
+  */
+#define SPI_ENABLE(spi)   ((spi)->CTL |= SPI_CTL_SPIEN_Msk)
+
+/**
+  * @brief      Disable SPI controller.
+  * @param[in]  spi The pointer of the specified SPI module.
+  * @return     None.
+  * @details    Clear SPIEN (SPI_CTL[0]) to disable SPI controller.
+  * \hideinitializer
+  */
+#define SPI_DISABLE(spi)   ((spi)->CTL &= ~SPI_CTL_SPIEN_Msk)
+
+
+/* Function prototype declaration */
+uint32_t SPI_Open(SPI_T *spi, uint32_t u32MasterSlave, uint32_t u32SPIMode, uint32_t u32DataWidth, uint32_t u32BusClock);
+void SPI_Close(SPI_T *spi);
+void SPI_ClearRxFIFO(SPI_T *spi);
+void SPI_ClearTxFIFO(SPI_T *spi);
+void SPI_DisableAutoSS(SPI_T *spi);
+void SPI_EnableAutoSS(SPI_T *spi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel);
+void SPI_SetFIFO(SPI_T *spi, uint32_t u32TxThreshold, uint32_t u32RxThreshold);
+uint32_t SPI_GetBusClock(SPI_T *spi);
+void SPI_EnableInt(SPI_T *spi, uint32_t u32Mask);
+void SPI_DisableInt(SPI_T *spi, uint32_t u32Mask);
+uint32_t SPI_GetIntFlag(SPI_T *spi, uint32_t u32Mask);
+void SPI_ClearIntFlag(SPI_T *spi, uint32_t u32Mask);
+uint32_t SPI_GetStatus(SPI_T *spi, uint32_t u32Mask);
+
+/*@}*/ /* end of group SPI_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group SPI_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

+ 838 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_sys.h

@@ -0,0 +1,838 @@
+/**************************************************************************//**
+ * @file     sys.h
+ * @brief    SYS driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+
+#ifndef __NU_SYS_H__
+#define __NU_SYS_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup SYS_Driver SYS Driver
+  @{
+*/
+
+
+/** @addtogroup SYS_EXPORTED_CONSTANTS SYS Exported Constants
+  @{
+*/
+
+
+/**
+ * @details  Interrupt Number Definition.
+ */
+typedef enum IRQn
+{
+    IRQ_WDT = 1,        // Watch Dog Timer
+    IRQ_WWDT = 2,       // Windowed-WDT Interrupt
+    IRQ_LVD = 3,        // LVD Interrupt
+    IRQ_EXTI0 = 4,      // External Interrupt 0
+    IRQ_EXTI1 = 5,      // External Interrupt 1
+    IRQ_EXTI2 = 6,      // External Interrupt 2
+    IRQ_EXTI3 = 7,      // External Interrupt 3
+    IRQ_GPA = 8,        // GPA Interrupt
+    IRQ_GPB = 9,        // GPB Interrupt
+    IRQ_GPC = 10,       // GPC Interrupt
+    IRQ_GPD = 11,       // GPD Interrupt
+    IRQ_I2S = 12,       // I2S Interrupt
+    IRQ_CAP0 = 14,      // Sensor Interface Controller Interrupt
+    IRQ_RTC = 15,       // RTC interrupt
+    IRQ_TIMER0 = 16,    // Timer 0 interrupt
+    IRQ_TIMER1 = 17,    // Timer 1 interrupt
+    IRQ_ADC = 18,       // ADC interrupt
+    IRQ_EMC0_RX = 19,   // EMC 0 RX Interrupt
+    IRQ_EMC1_RX = 20,   // EMC 1 RX Interrupt
+    IRQ_EMC0_TX = 21,   // EMC 0 TX Interrupt
+    IRQ_EMC1_TX = 22,   // EMC 1 TX Interrupt
+    IRQ_EHCI = 23,      // USB 2.0 Host Controller Interrupt
+    IRQ_OHCI = 24,      // USB 1.1 Host Controller Interrupt
+    IRQ_PDMA0 = 25,     // PDMA Channel 0 Interrupt
+    IRQ_PDMA1 = 26,     // PDMA Channel 1 Interrupt
+    IRQ_SDH = 27,       // SD Host Interrupt
+    IRQ_FMI = 28,       // NAND/eMMC Interrupt
+    IRQ_UDC = 29,       // USB Device Controller Interrupt
+    IRQ_TIMER2 = 30,    // Timer 2 interrupt
+    IRQ_TIMER3 = 31,    // Timer 3 interrupt
+    IRQ_TIMER4 = 32,    // Timer 4 interrupt
+    IRQ_CAP1 = 33,      // VCAP1 Engine Interrupt
+    IRQ_TIMER5 = 34,    // Timer 5 interrupt
+    IRQ_CRYPTO = 35,    // CRYPTO Engine Interrupt
+    IRQ_UART0 = 36,     // UART 0 interrupt
+    IRQ_UART1 = 37,     // UART 1 interrupt
+    IRQ_UART2 = 38,     // UART 2 interrupt
+    IRQ_UART4 = 39,     // UART 4 interrupt
+    IRQ_UART6 = 40,     // UART 6 interrupt
+    IRQ_UART8 = 41,     // UART 8 interrupt
+    IRQ_CAN3  = 42,     // CAN  3 interrupt
+    IRQ_UART3 = 43,     // UART 3 interrupt
+    IRQ_UART5 = 44,     // UART 5 interrupt
+    IRQ_UART7 = 45,     // UART 7 interrupt
+    IRQ_UART9 = 46,     // UART 9 interrupt
+    IRQ_I2C2 = 47,      // I2C 2 interrupt
+    IRQ_I2C3 = 48,      // I2C 3 interrupt
+    IRQ_GPE = 49,       // GPE interrupt
+    IRQ_SPI1 = 50,      // SPI 1 interrupt
+    IRQ_QSPI0 = 51,     // QSPI 0 interrupt
+    IRQ_SPI0 = 52,      // SPI 0 interrupt
+    IRQ_I2C0 = 53,      // I2C 0 Interrupt
+    IRQ_I2C1 = 54,      // I2C 1 Interrupt
+    IRQ_SMC0 = 55,      // SmartCard 0 Interrupt
+    IRQ_SMC1 = 56,      // SmartCard 1 Interrupt
+    IRQ_GPF = 57,       // GPF interrupt
+    IRQ_CAN0 = 58,      // CAN 0 interrupt
+    IRQ_CAN1 = 59,      // CAN 1 interrupt
+    IRQ_PWM0 = 60,      // PWM 0 interrupt
+    IRQ_PWM1 = 61,      // PWM 1 interrupt
+    IRQ_CAN2 = 62,      // CAN 2 interrupt
+    IRQ_GPG = 63,       // GPG interrupt
+}
+IRQn_Type;
+
+/* Define constants for use AIC in service parameters.  */
+#define SYS_SWI                     0
+#define SYS_D_ABORT                 1
+#define SYS_I_ABORT                 2
+#define SYS_UNDEFINE                3
+
+/* The parameters for sysSetInterruptPriorityLevel() and
+   sysInstallISR() use */
+#define FIQ_LEVEL_0     0       /*!< FIQ Level 0 */
+#define IRQ_LEVEL_1     1       /*!< IRQ Level 1 */
+#define IRQ_LEVEL_2     2       /*!< IRQ Level 2 */
+#define IRQ_LEVEL_3     3       /*!< IRQ Level 3 */
+#define IRQ_LEVEL_4     4       /*!< IRQ Level 4 */
+#define IRQ_LEVEL_5     5       /*!< IRQ Level 5 */
+#define IRQ_LEVEL_6     6       /*!< IRQ Level 6 */
+#define IRQ_LEVEL_7     7       /*!< IRQ Level 7 */
+
+
+/* The parameters for sysSetLocalInterrupt() use */
+#define ENABLE_IRQ        0x7F  /*!< Enable I-bit of CP15  */
+#define ENABLE_FIQ        0xBF  /*!< Enable F-bit of CP15  */
+#define ENABLE_FIQ_IRQ    0x3F  /*!< Enable I-bit and F-bit of CP15  */
+#define DISABLE_IRQ       0x80  /*!< Disable I-bit of CP15  */
+#define DISABLE_FIQ       0x40  /*!< Disable F-bit of CP15  */
+#define DISABLE_FIQ_IRQ   0xC0  /*!< Disable I-bit and F-bit of CP15  */
+
+/* Define Cache type  */
+#define CACHE_WRITE_BACK        0     /*!< Cache Write-back mode  */
+#define CACHE_WRITE_THROUGH     1     /*!< Cache Write-through mode  */
+#define CACHE_DISABLE           -1    /*!< Cache Disable  */
+
+/** \brief  Structure type of clock source
+ */
+typedef enum CLKn
+{
+
+    SYS_UPLL     = 1,   /*!< UPLL clock */
+    SYS_APLL     = 2,   /*!< APLL clock */
+    SYS_SYSTEM   = 3,   /*!< System clock */
+    SYS_HCLK     = 4,   /*!< HCLK1 clock */
+    SYS_PCLK01   = 5,   /*!< HCLK234 clock */
+    SYS_PCLK2    = 6,   /*!< PCLK clock */
+    SYS_CPU      = 7,   /*!< CPU clock */
+
+}  CLK_Type;
+
+/* The parameters for sysSetInterruptType() use */
+#define LOW_LEVEL_SENSITIVE        0x00
+#define HIGH_LEVEL_SENSITIVE       0x40
+#define NEGATIVE_EDGE_TRIGGER      0x80
+#define POSITIVE_EDGE_TRIGGER      0xC0
+
+/* The parameters for sysSetGlobalInterrupt() use */
+#define ENABLE_ALL_INTERRUPTS      0
+#define DISABLE_ALL_INTERRUPTS     1
+
+#define MMU_DIRECT_MAPPING  0
+
+/* Define constants for use Cache in service parameters.  */
+#define I_CACHE         6
+#define D_CACHE         7
+#define I_D_CACHE       8
+
+
+/// @endcond HIDDEN_SYMBOLS
+
+/*@}*/ /* end of group SYS_EXPORTED_CONSTANTS */
+
+/*---------------------- System Manger Controller -------------------------*/
+/**
+    @addtogroup SYS System Manger Controller(SYS)
+    Memory Mapped Structure for SYS Controller
+@{ */
+
+#define SYS                  ((SYS_T *)   SYS_BA)
+
+typedef struct
+{
+    __I  uint32_t PDID;          /* Offset: 0x00  */
+    __IO uint32_t PWRON;         /* Offset: 0x04  */
+    __IO uint32_t ARBCON;        /* Offset: 0x08  */
+    __I  uint32_t RESERVE0[5];
+    __IO uint32_t LVRDCR;        /* Offset: 0x20  */
+    __I  uint32_t RESERVE1[3];
+    __IO uint32_t MISCFCR;       /* Offset: 0x30  */
+    __I  uint32_t RESERVE2[3];
+    __IO uint32_t MISCIER;       /* Offset: 0x40  */
+    __IO uint32_t MISCISR;       /* Offset: 0x44  */
+    __I  uint32_t RESERVE3[2];
+    __IO uint32_t WKUPSER0;      /* Offset: 0x50  */
+    __IO uint32_t WKUPSER1;      /* Offset: 0x54  */
+    __IO uint32_t WKUPSSR0;      /* Offset: 0x58  */
+    __IO uint32_t WKUPSSR1;      /* Offset: 0x5C  */
+    __IO uint32_t AHBIPRST;      /* Offset: 0x60  */
+    __IO uint32_t APBIPRST0;     /* Offset: 0x64  */
+    __IO uint32_t APBIPRST1;     /* Offset: 0x68  */
+    __IO uint32_t RSTSTS;        /* Offset: 0x6C  */
+    __IO uint32_t GPA_MFPL;      /* Offset: 0x70  */
+    __IO uint32_t GPA_MFPH;      /* Offset: 0x74  */
+    __IO uint32_t GPB_MFPL;      /* Offset: 0x78  */
+    __IO uint32_t GPB_MFPH;      /* Offset: 0x7C  */
+    __IO uint32_t GPC_MFPL;      /* Offset: 0x80  */
+    __IO uint32_t GPC_MFPH;      /* Offset: 0x84  */
+    __IO uint32_t GPD_MFPL;      /* Offset: 0x88  */
+    __IO uint32_t GPD_MFPH;      /* Offset: 0x8C  */
+    __IO uint32_t GPE_MFPL;      /* Offset: 0x90  */
+    __IO uint32_t GPE_MFPH;      /* Offset: 0x94  */
+    __IO uint32_t GPF_MFPL;      /* Offset: 0x98  */
+    __IO uint32_t GPF_MFPH;      /* Offset: 0x9c  */
+    __IO uint32_t GPG_MFPL;      /* Offset: 0xA0  */
+    __IO uint32_t GPG_MFPH;      /* Offset: 0xA4  */
+    __I  uint32_t RESERVE4[18];
+    __IO uint32_t DDR_DSCTL;     /* Offset: 0xF0  */
+    __I  uint32_t RESERVE5[3];
+    __IO uint32_t PORDISCR;      /* Offset: 0x100 */
+    __IO uint32_t ICEDBGCR;      /* Offset: 0x104 */
+    __IO uint32_t ERRADDCR;  /* Offset: 0x108 */
+    __I  uint32_t RESERVE6[59];
+    __IO uint32_t IRCTCTL;       /* Offset: 0x1F8 */
+    __IO uint32_t REGWPCTL;      /* Offset: 0x1FC */
+
+
+} SYS_T;
+
+
+/* SYS GPA_MFPL Bit Field Definitions */
+#define SYS_GPA_MFPL_PA0MFP_Pos          (0)                                               /*!< SYS_T::GPA_MFPL: PA0MFP Position          */
+#define SYS_GPA_MFPL_PA0MFP_Msk          (0xful << SYS_GPA_MFPL_PA0MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA0MFP Mask              */
+
+#define SYS_GPA_MFPL_PA1MFP_Pos          (4)                                               /*!< SYS_T::GPA_MFPL: PA1MFP Position          */
+#define SYS_GPA_MFPL_PA1MFP_Msk          (0xful << SYS_GPA_MFPL_PA1MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA1MFP Mask              */
+
+#define SYS_GPA_MFPL_PA2MFP_Pos          (8)                                               /*!< SYS_T::GPA_MFPL: PA2MFP Position          */
+#define SYS_GPA_MFPL_PA2MFP_Msk          (0xful << SYS_GPA_MFPL_PA2MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA2MFP Mask              */
+
+#define SYS_GPA_MFPL_PA3MFP_Pos          (12)                                              /*!< SYS_T::GPA_MFPL: PA3MFP Position          */
+#define SYS_GPA_MFPL_PA3MFP_Msk          (0xful << SYS_GPA_MFPL_PA3MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA3MFP Mask              */
+
+#define SYS_GPA_MFPL_PA4MFP_Pos          (16)                                              /*!< SYS_T::GPA_MFPL: PA4MFP Position          */
+#define SYS_GPA_MFPL_PA4MFP_Msk          (0xful << SYS_GPA_MFPL_PA4MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA4MFP Mask              */
+
+#define SYS_GPA_MFPL_PA5MFP_Pos          (20)                                              /*!< SYS_T::GPA_MFPL: PA5MFP Position          */
+#define SYS_GPA_MFPL_PA5MFP_Msk          (0xful << SYS_GPA_MFPL_PA5MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA5MFP Mask              */
+
+#define SYS_GPA_MFPL_PA6MFP_Pos          (24)                                              /*!< SYS_T::GPA_MFPL: PA6MFP Position          */
+#define SYS_GPA_MFPL_PA6MFP_Msk          (0xful << SYS_GPA_MFPL_PA6MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA6MFP Mask              */
+
+#define SYS_GPA_MFPL_PA7MFP_Pos          (28)                                              /*!< SYS_T::GPA_MFPL: PA7MFP Position          */
+#define SYS_GPA_MFPL_PA7MFP_Msk          (0xful << SYS_GPA_MFPL_PA7MFP_Pos)                /*!< SYS_T::GPA_MFPL: PA7MFP Mask              */
+
+/* SYS GPA_MFPH Bit Field Definitions */
+#define SYS_GPA_MFPH_PA8MFP_Pos          (0)                                               /*!< SYS_T::GPA_MFPH: PA8MFP Position          */
+#define SYS_GPA_MFPH_PA8MFP_Msk          (0xful << SYS_GPA_MFPH_PA8MFP_Pos)                /*!< SYS_T::GPA_MFPH: PA8MFP Mask              */
+
+#define SYS_GPA_MFPH_PA9MFP_Pos          (4)                                               /*!< SYS_T::GPA_MFPH: PA9MFP Position          */
+#define SYS_GPA_MFPH_PA9MFP_Msk          (0xful << SYS_GPA_MFPH_PA9MFP_Pos)                /*!< SYS_T::GPA_MFPH: PA9MFP Mask              */
+
+#define SYS_GPA_MFPH_PA10MFP_Pos         (8)                                               /*!< SYS_T::GPA_MFPH: PA10MFP Position         */
+#define SYS_GPA_MFPH_PA10MFP_Msk         (0xful << SYS_GPA_MFPH_PA10MFP_Pos)               /*!< SYS_T::GPA_MFPH: PA10MFP Mask             */
+
+#define SYS_GPA_MFPH_PA11MFP_Pos         (12)                                              /*!< SYS_T::GPA_MFPH: PA11MFP Position         */
+#define SYS_GPA_MFPH_PA11MFP_Msk         (0xful << SYS_GPA_MFPH_PA11MFP_Pos)               /*!< SYS_T::GPA_MFPH: PA11MFP Mask             */
+
+#define SYS_GPA_MFPH_PA12MFP_Pos         (16)                                              /*!< SYS_T::GPA_MFPH: PA12MFP Position         */
+#define SYS_GPA_MFPH_PA12MFP_Msk         (0xful << SYS_GPA_MFPH_PA12MFP_Pos)               /*!< SYS_T::GPA_MFPH: PA12MFP Mask             */
+
+#define SYS_GPA_MFPH_PA13MFP_Pos         (20)                                              /*!< SYS_T::GPA_MFPH: PA13MFP Position         */
+#define SYS_GPA_MFPH_PA13MFP_Msk         (0xful << SYS_GPA_MFPH_PA13MFP_Pos)               /*!< SYS_T::GPA_MFPH: PA13MFP Mask             */
+
+#define SYS_GPA_MFPH_PA14MFP_Pos         (24)                                              /*!< SYS_T::GPA_MFPH: PA14MFP Position         */
+#define SYS_GPA_MFPH_PA14MFP_Msk         (0xful << SYS_GPA_MFPH_PA14MFP_Pos)               /*!< SYS_T::GPA_MFPH: PA14MFP Mask             */
+
+#define SYS_GPA_MFPH_PA15MFP_Pos         (28)                                              /*!< SYS_T::GPA_MFPH: PA15MFP Position         */
+#define SYS_GPA_MFPH_PA15MFP_Msk         (0xful << SYS_GPA_MFPH_PA15MFP_Pos)               /*!< SYS_T::GPA_MFPH: PA15MFP Mask             */
+
+/* SYS GPB_MFPL Bit Field Definitions */
+#define SYS_GPB_MFPL_PB0MFP_Pos          (0)                                               /*!< SYS_T::GPB_MFPL: PB0MFP Position          */
+#define SYS_GPB_MFPL_PB0MFP_Msk          (0xful << SYS_GPB_MFPL_PB0MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB0MFP Mask              */
+
+#define SYS_GPB_MFPL_PB1MFP_Pos          (4)                                               /*!< SYS_T::GPB_MFPL: PB1MFP Position          */
+#define SYS_GPB_MFPL_PB1MFP_Msk          (0xful << SYS_GPB_MFPL_PB1MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB1MFP Mask              */
+
+#define SYS_GPB_MFPL_PB2MFP_Pos          (8)                                               /*!< SYS_T::GPB_MFPL: PB2MFP Position          */
+#define SYS_GPB_MFPL_PB2MFP_Msk          (0xful << SYS_GPB_MFPL_PB2MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB2MFP Mask              */
+
+#define SYS_GPB_MFPL_PB3MFP_Pos          (12)                                              /*!< SYS_T::GPB_MFPL: PB3MFP Position          */
+#define SYS_GPB_MFPL_PB3MFP_Msk          (0xful << SYS_GPB_MFPL_PB3MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB3MFP Mask              */
+
+#define SYS_GPB_MFPL_PB4MFP_Pos          (16)                                              /*!< SYS_T::GPB_MFPL: PB4MFP Position          */
+#define SYS_GPB_MFPL_PB4MFP_Msk          (0xful << SYS_GPB_MFPL_PB4MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB4MFP Mask              */
+
+#define SYS_GPB_MFPL_PB5MFP_Pos          (20)                                              /*!< SYS_T::GPB_MFPL: PB5MFP Position          */
+#define SYS_GPB_MFPL_PB5MFP_Msk          (0xful << SYS_GPB_MFPL_PB5MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB5MFP Mask              */
+
+#define SYS_GPB_MFPL_PB6MFP_Pos          (24)                                              /*!< SYS_T::GPB_MFPL: PB6MFP Position          */
+#define SYS_GPB_MFPL_PB6MFP_Msk          (0xful << SYS_GPB_MFPL_PB6MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB6MFP Mask              */
+
+#define SYS_GPB_MFPL_PB7MFP_Pos          (28)                                              /*!< SYS_T::GPB_MFPL: PB7MFP Position          */
+#define SYS_GPB_MFPL_PB7MFP_Msk          (0xful << SYS_GPB_MFPL_PB7MFP_Pos)                /*!< SYS_T::GPB_MFPL: PB7MFP Mask              */
+
+/* SYS GPB_MFPH Bit Field Definitions */
+#define SYS_GPB_MFPH_PB8MFP_Pos          (0)                                               /*!< SYS_T::GPB_MFPH: PB8MFP Position          */
+#define SYS_GPB_MFPH_PB8MFP_Msk          (0xful << SYS_GPB_MFPH_PB8MFP_Pos)                /*!< SYS_T::GPB_MFPH: PB8MFP Mask              */
+
+#define SYS_GPB_MFPH_PB9MFP_Pos          (4)                                               /*!< SYS_T::GPB_MFPH: PB9MFP Position          */
+#define SYS_GPB_MFPH_PB9MFP_Msk          (0xful << SYS_GPB_MFPH_PB9MFP_Pos)                /*!< SYS_T::GPB_MFPH: PB9MFP Mask              */
+
+#define SYS_GPB_MFPH_PB10MFP_Pos         (8)                                               /*!< SYS_T::GPB_MFPH: PB10MFP Position         */
+#define SYS_GPB_MFPH_PB10MFP_Msk         (0xful << SYS_GPB_MFPH_PB10MFP_Pos)               /*!< SYS_T::GPB_MFPH: PB10MFP Mask             */
+
+#define SYS_GPB_MFPH_PB11MFP_Pos         (12)                                              /*!< SYS_T::GPB_MFPH: PB11MFP Position         */
+#define SYS_GPB_MFPH_PB11MFP_Msk         (0xful << SYS_GPB_MFPH_PB11MFP_Pos)               /*!< SYS_T::GPB_MFPH: PB11MFP Mask             */
+
+#define SYS_GPB_MFPH_PB12MFP_Pos         (16)                                              /*!< SYS_T::GPB_MFPH: PB12MFP Position         */
+#define SYS_GPB_MFPH_PB12MFP_Msk         (0xful << SYS_GPB_MFPH_PB12MFP_Pos)               /*!< SYS_T::GPB_MFPH: PB12MFP Mask             */
+
+#define SYS_GPB_MFPH_PB13MFP_Pos         (20)                                              /*!< SYS_T::GPB_MFPH: PB13MFP Position         */
+#define SYS_GPB_MFPH_PB13MFP_Msk         (0xful << SYS_GPB_MFPH_PB13MFP_Pos)               /*!< SYS_T::GPB_MFPH: PB13MFP Mask             */
+
+#define SYS_GPB_MFPH_PB14MFP_Pos         (24)                                              /*!< SYS_T::GPB_MFPH: PB14MFP Position         */
+#define SYS_GPB_MFPH_PB14MFP_Msk         (0xful << SYS_GPB_MFPH_PB14MFP_Pos)               /*!< SYS_T::GPB_MFPH: PB14MFP Mask             */
+
+#define SYS_GPB_MFPH_PB15MFP_Pos         (28)                                              /*!< SYS_T::GPB_MFPH: PB15MFP Position         */
+#define SYS_GPB_MFPH_PB15MFP_Msk         (0xful << SYS_GPB_MFPH_PB15MFP_Pos)               /*!< SYS_T::GPB_MFPH: PB15MFP Mask             */
+
+/* SYS GPC_MFPL Bit Field Definitions */
+#define SYS_GPC_MFPL_PC0MFP_Pos          (0)                                               /*!< SYS_T::GPC_MFPL: PC0MFP Position          */
+#define SYS_GPC_MFPL_PC0MFP_Msk          (0xful << SYS_GPC_MFPL_PC0MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC0MFP Mask              */
+
+#define SYS_GPC_MFPL_PC1MFP_Pos          (4)                                               /*!< SYS_T::GPC_MFPL: PC1MFP Position          */
+#define SYS_GPC_MFPL_PC1MFP_Msk          (0xful << SYS_GPC_MFPL_PC1MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC1MFP Mask              */
+
+#define SYS_GPC_MFPL_PC2MFP_Pos          (8)                                               /*!< SYS_T::GPC_MFPL: PC2MFP Position          */
+#define SYS_GPC_MFPL_PC2MFP_Msk          (0xful << SYS_GPC_MFPL_PC2MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC2MFP Mask              */
+
+#define SYS_GPC_MFPL_PC3MFP_Pos          (12)                                              /*!< SYS_T::GPC_MFPL: PC3MFP Position          */
+#define SYS_GPC_MFPL_PC3MFP_Msk          (0xful << SYS_GPC_MFPL_PC3MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC3MFP Mask              */
+
+#define SYS_GPC_MFPL_PC4MFP_Pos          (16)                                              /*!< SYS_T::GPC_MFPL: PC4MFP Position          */
+#define SYS_GPC_MFPL_PC4MFP_Msk          (0xful << SYS_GPC_MFPL_PC4MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC4MFP Mask              */
+
+#define SYS_GPC_MFPL_PC5MFP_Pos          (20)                                              /*!< SYS_T::GPC_MFPL: PC5MFP Position          */
+#define SYS_GPC_MFPL_PC5MFP_Msk          (0xful << SYS_GPC_MFPL_PC5MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC5MFP Mask              */
+
+#define SYS_GPC_MFPL_PC6MFP_Pos          (24)                                              /*!< SYS_T::GPC_MFPL: PC6MFP Position          */
+#define SYS_GPC_MFPL_PC6MFP_Msk          (0xful << SYS_GPC_MFPL_PC6MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC6MFP Mask              */
+
+#define SYS_GPC_MFPL_PC7MFP_Pos          (28)                                              /*!< SYS_T::GPC_MFPL: PC7MFP Position          */
+#define SYS_GPC_MFPL_PC7MFP_Msk          (0xful << SYS_GPC_MFPL_PC7MFP_Pos)                /*!< SYS_T::GPC_MFPL: PC7MFP Mask              */
+
+/* SYS GPC_MFPH Bit Field Definitions */
+#define SYS_GPC_MFPH_PC8MFP_Pos          (0)                                               /*!< SYS_T::GPC_MFPH: PC8MFP Position          */
+#define SYS_GPC_MFPH_PC8MFP_Msk          (0xful << SYS_GPC_MFPH_PC8MFP_Pos)                /*!< SYS_T::GPC_MFPH: PC8MFP Mask              */
+
+#define SYS_GPC_MFPH_PC9MFP_Pos          (4)                                               /*!< SYS_T::GPC_MFPH: PC9MFP Position          */
+#define SYS_GPC_MFPH_PC9MFP_Msk          (0xful << SYS_GPC_MFPH_PC9MFP_Pos)                /*!< SYS_T::GPC_MFPH: PC9MFP Mask              */
+
+#define SYS_GPC_MFPH_PC10MFP_Pos         (8)                                               /*!< SYS_T::GPC_MFPH: PC10MFP Position         */
+#define SYS_GPC_MFPH_PC10MFP_Msk         (0xful << SYS_GPC_MFPH_PC10MFP_Pos)               /*!< SYS_T::GPC_MFPH: PC10MFP Mask             */
+
+#define SYS_GPC_MFPH_PC11MFP_Pos         (12)                                              /*!< SYS_T::GPC_MFPH: PC11MFP Position         */
+#define SYS_GPC_MFPH_PC11MFP_Msk         (0xful << SYS_GPC_MFPH_PC11MFP_Pos)               /*!< SYS_T::GPC_MFPH: PC11MFP Mask             */
+
+#define SYS_GPC_MFPH_PC12MFP_Pos         (16)                                              /*!< SYS_T::GPC_MFPH: PC12MFP Position         */
+#define SYS_GPC_MFPH_PC12MFP_Msk         (0xful << SYS_GPC_MFPH_PC12MFP_Pos)               /*!< SYS_T::GPC_MFPH: PC12MFP Mask             */
+
+#define SYS_GPC_MFPH_PC13MFP_Pos         (20)                                              /*!< SYS_T::GPC_MFPH: PC13MFP Position         */
+#define SYS_GPC_MFPH_PC13MFP_Msk         (0xful << SYS_GPC_MFPH_PC13MFP_Pos)               /*!< SYS_T::GPC_MFPH: PC13MFP Mask             */
+
+#define SYS_GPC_MFPH_PC14MFP_Pos         (24)                                              /*!< SYS_T::GPC_MFPH: PC14MFP Position         */
+#define SYS_GPC_MFPH_PC14MFP_Msk         (0xful << SYS_GPC_MFPH_PC14MFP_Pos)               /*!< SYS_T::GPC_MFPH: PC14MFP Mask             */
+
+#define SYS_GPC_MFPH_PC15MFP_Pos         (28)                                              /*!< SYS_T::GPC_MFPH: PC15MFP Position         */
+#define SYS_GPC_MFPH_PC15MFP_Msk         (0xful << SYS_GPC_MFPH_PC15MFP_Pos)               /*!< SYS_T::GPC_MFPH: PC15MFP Mask             */
+
+/* SYS GPD_MFPL Bit Field Definitions */
+#define SYS_GPD_MFPL_PD0MFP_Pos          (0)                                               /*!< SYS_T::GPD_MFPL: PD0MFP Position          */
+#define SYS_GPD_MFPL_PD0MFP_Msk          (0xful << SYS_GPD_MFPL_PD0MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD0MFP Mask              */
+
+#define SYS_GPD_MFPL_PD1MFP_Pos          (4)                                               /*!< SYS_T::GPD_MFPL: PD1MFP Position          */
+#define SYS_GPD_MFPL_PD1MFP_Msk          (0xful << SYS_GPD_MFPL_PD1MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD1MFP Mask              */
+
+#define SYS_GPD_MFPL_PD2MFP_Pos          (8)                                               /*!< SYS_T::GPD_MFPL: PD2MFP Position          */
+#define SYS_GPD_MFPL_PD2MFP_Msk          (0xful << SYS_GPD_MFPL_PD2MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD2MFP Mask              */
+
+#define SYS_GPD_MFPL_PD3MFP_Pos          (12)                                              /*!< SYS_T::GPD_MFPL: PD3MFP Position          */
+#define SYS_GPD_MFPL_PD3MFP_Msk          (0xful << SYS_GPD_MFPL_PD3MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD3MFP Mask              */
+
+#define SYS_GPD_MFPL_PD4MFP_Pos          (16)                                              /*!< SYS_T::GPD_MFPL: PD4MFP Position          */
+#define SYS_GPD_MFPL_PD4MFP_Msk          (0xful << SYS_GPD_MFPL_PD4MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD4MFP Mask              */
+
+#define SYS_GPD_MFPL_PD5MFP_Pos          (20)                                              /*!< SYS_T::GPD_MFPL: PD5MFP Position          */
+#define SYS_GPD_MFPL_PD5MFP_Msk          (0xful << SYS_GPD_MFPL_PD5MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD5MFP Mask              */
+
+#define SYS_GPD_MFPL_PD6MFP_Pos          (24)                                              /*!< SYS_T::GPD_MFPL: PD6MFP Position          */
+#define SYS_GPD_MFPL_PD6MFP_Msk          (0xful << SYS_GPD_MFPL_PD6MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD6MFP Mask              */
+
+#define SYS_GPD_MFPL_PD7MFP_Pos          (28)                                              /*!< SYS_T::GPD_MFPL: PD7MFP Position          */
+#define SYS_GPD_MFPL_PD7MFP_Msk          (0xful << SYS_GPD_MFPL_PD7MFP_Pos)                /*!< SYS_T::GPD_MFPL: PD7MFP Mask              */
+
+/* SYS GPD_MFPH Bit Field Definitions */
+#define SYS_GPD_MFPH_PD8MFP_Pos          (0)                                               /*!< SYS_T::GPD_MFPH: PD8MFP Position          */
+#define SYS_GPD_MFPH_PD8MFP_Msk          (0xful << SYS_GPD_MFPH_PD8MFP_Pos)                /*!< SYS_T::GPD_MFPH: PD8MFP Mask              */
+
+#define SYS_GPD_MFPH_PD9MFP_Pos          (4)                                               /*!< SYS_T::GPD_MFPH: PD9MFP Position          */
+#define SYS_GPD_MFPH_PD9MFP_Msk          (0xful << SYS_GPD_MFPH_PD9MFP_Pos)                /*!< SYS_T::GPD_MFPH: PD9MFP Mask              */
+
+#define SYS_GPD_MFPH_PD10MFP_Pos         (8)                                               /*!< SYS_T::GPD_MFPH: PD10MFP Position         */
+#define SYS_GPD_MFPH_PD10MFP_Msk         (0xful << SYS_GPD_MFPH_PD10MFP_Pos)              /*!< SYS_T::GPD_MFPH: PD10MFP Mask              */
+
+#define SYS_GPD_MFPH_PD11MFP_Pos         (12)                                              /*!< SYS_T::GPD_MFPH: PD11MFP Position         */
+#define SYS_GPD_MFPH_PD11MFP_Msk         (0xful << SYS_GPD_MFPH_PD11MFP_Pos)               /*!< SYS_T::GPD_MFPH: PD11MFP Mask             */
+
+#define SYS_GPD_MFPH_PD12MFP_Pos         (16)                                              /*!< SYS_T::GPD_MFPH: PD12MFP Position         */
+#define SYS_GPD_MFPH_PD12MFP_Msk         (0xful << SYS_GPD_MFPH_PD12MFP_Pos)               /*!< SYS_T::GPD_MFPH: PD12MFP Mask             */
+
+#define SYS_GPD_MFPH_PD13MFP_Pos         (20)                                              /*!< SYS_T::GPD_MFPH: PD13MFP Position         */
+#define SYS_GPD_MFPH_PD13MFP_Msk         (0xful << SYS_GPD_MFPH_PD13MFP_Pos)               /*!< SYS_T::GPD_MFPH: PD13MFP Mask             */
+
+#define SYS_GPD_MFPH_PD14MFP_Pos         (24)                                              /*!< SYS_T::GPD_MFPH: PD14MFP Position         */
+#define SYS_GPD_MFPH_PD14MFP_Msk         (0xful << SYS_GPD_MFPH_PD14MFP_Pos)               /*!< SYS_T::GPD_MFPH: PD14MFP Mask             */
+
+#define SYS_GPD_MFPH_PD15MFP_Pos         (28)                                              /*!< SYS_T::GPD_MFPH: PD15MFP Position         */
+#define SYS_GPD_MFPH_PD15MFP_Msk         (0xful << SYS_GPD_MFPH_PD15MFP_Pos)               /*!< SYS_T::GPD_MFPH: PD15MFP Mask             */
+
+/* SYS GPE_MFPL Bit Field Definitions */
+#define SYS_GPE_MFPL_PE0MFP_Pos          (0)                                               /*!< SYS_T::GPE_MFPL: PE0MFP Position          */
+#define SYS_GPE_MFPL_PE0MFP_Msk          (0xful << SYS_GPE_MFPL_PE0MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE0MFP Mask              */
+
+#define SYS_GPE_MFPL_PE1MFP_Pos          (4)                                               /*!< SYS_T::GPE_MFPL: PE1MFP Position          */
+#define SYS_GPE_MFPL_PE1MFP_Msk          (0xful << SYS_GPE_MFPL_PE1MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE1MFP Mask              */
+
+#define SYS_GPE_MFPL_PE2MFP_Pos          (8)                                               /*!< SYS_T::GPE_MFPL: PE2MFP Position          */
+#define SYS_GPE_MFPL_PE2MFP_Msk          (0xful << SYS_GPE_MFPL_PE2MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE2MFP Mask              */
+
+#define SYS_GPE_MFPL_PE3MFP_Pos          (12)                                              /*!< SYS_T::GPE_MFPL: PE3MFP Position          */
+#define SYS_GPE_MFPL_PE3MFP_Msk          (0xful << SYS_GPE_MFPL_PE3MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE3MFP Mask              */
+
+#define SYS_GPE_MFPL_PE4MFP_Pos          (16)                                              /*!< SYS_T::GPE_MFPL: PE4MFP Position          */
+#define SYS_GPE_MFPL_PE4MFP_Msk          (0xful << SYS_GPE_MFPL_PE4MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE4MFP Mask              */
+
+#define SYS_GPE_MFPL_PE5MFP_Pos          (20)                                              /*!< SYS_T::GPE_MFPL: PE5MFP Position          */
+#define SYS_GPE_MFPL_PE5MFP_Msk          (0xful << SYS_GPE_MFPL_PE5MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE5MFP Mask              */
+
+#define SYS_GPE_MFPL_PE6MFP_Pos          (24)                                              /*!< SYS_T::GPE_MFPL: PE6MFP Position          */
+#define SYS_GPE_MFPL_PE6MFP_Msk          (0xful << SYS_GPE_MFPL_PE6MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE6MFP Mask              */
+
+#define SYS_GPE_MFPL_PE7MFP_Pos          (28)                                              /*!< SYS_T::GPE_MFPL: PE7MFP Position          */
+#define SYS_GPE_MFPL_PE7MFP_Msk          (0xful << SYS_GPE_MFPL_PE7MFP_Pos)                /*!< SYS_T::GPE_MFPL: PE7MFP Mask              */
+
+/* SYS GPE_MFPH Bit Field Definitions */
+#define SYS_GPE_MFPH_PE8MFP_Pos          (0)                                               /*!< SYS_T::GPE_MFPH: PE8MFP Position          */
+#define SYS_GPE_MFPH_PE8MFP_Msk          (0xful << SYS_GPE_MFPH_PE8MFP_Pos)                /*!< SYS_T::GPE_MFPH: PE8MFP Mask              */
+
+#define SYS_GPE_MFPH_PE9MFP_Pos          (4)                                               /*!< SYS_T::GPE_MFPH: PE9MFP Position          */
+#define SYS_GPE_MFPH_PE9MFP_Msk          (0xful << SYS_GPE_MFPH_PE9MFP_Pos)                /*!< SYS_T::GPE_MFPH: PE9MFP Mask              */
+
+#define SYS_GPE_MFPH_PE10MFP_Pos         (8)                                               /*!< SYS_T::GPE_MFPH: PE10MFP Position         */
+#define SYS_GPE_MFPH_PE10MFP_Msk         (0xful << SYS_GPE_MFPH_PE10MFP_Pos)               /*!< SYS_T::GPE_MFPH: PE10MFP Mask             */
+
+#define SYS_GPE_MFPH_PE11MFP_Pos         (12)                                              /*!< SYS_T::GPE_MFPH: PE11MFP Position         */
+#define SYS_GPE_MFPH_PE11MFP_Msk         (0xful << SYS_GPE_MFPH_PE11MFP_Pos)               /*!< SYS_T::GPE_MFPH: PE11MFP Mask             */
+
+#define SYS_GPE_MFPH_PE12MFP_Pos         (16)                                              /*!< SYS_T::GPE_MFPH: PE12MFP Position         */
+#define SYS_GPE_MFPH_PE12MFP_Msk         (0xful << SYS_GPE_MFPH_PE12MFP_Pos)               /*!< SYS_T::GPE_MFPH: PE12MFP Mask             */
+
+#define SYS_GPE_MFPH_PE13MFP_Pos         (20)                                              /*!< SYS_T::GPE_MFPH: PE13MFP Position         */
+#define SYS_GPE_MFPH_PE13MFP_Msk         (0xful << SYS_GPE_MFPH_PE13MFP_Pos)               /*!< SYS_T::GPE_MFPH: PE13MFP Mask             */
+
+#define SYS_GPE_MFPH_PE14MFP_Pos         (24)                                              /*!< SYS_T::GPE_MFPH: PE14MFP Position         */
+#define SYS_GPE_MFPH_PE14MFP_Msk         (0xful << SYS_GPE_MFPH_PE14MFP_Pos)               /*!< SYS_T::GPE_MFPH: PE14MFP Mask             */
+
+#define SYS_GPE_MFPH_PE15MFP_Pos         (28)                                              /*!< SYS_T::GPE_MFPH: PE15MFP Position         */
+#define SYS_GPE_MFPH_PE15MFP_Msk         (0xful << SYS_GPE_MFPH_PE15MFP_Pos)               /*!< SYS_T::GPE_MFPH: PE15MFP Mask             */
+
+/* SYS GPF_MFPL Bit Field Definitions */
+#define SYS_GPF_MFPL_PF0MFP_Pos          (0)                                               /*!< SYS_T::GPF_MFPL: PF0MFP Position          */
+#define SYS_GPF_MFPL_PF0MFP_Msk          (0xful << SYS_GPF_MFPL_PF0MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF0MFP Mask              */
+
+#define SYS_GPF_MFPL_PF1MFP_Pos          (4)                                               /*!< SYS_T::GPF_MFPL: PF1MFP Position          */
+#define SYS_GPF_MFPL_PF1MFP_Msk          (0xful << SYS_GPF_MFPL_PF1MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF1MFP Mask              */
+
+#define SYS_GPF_MFPL_PF2MFP_Pos          (8)                                               /*!< SYS_T::GPF_MFPL: PF2MFP Position          */
+#define SYS_GPF_MFPL_PF2MFP_Msk          (0xful << SYS_GPF_MFPL_PF2MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF2MFP Mask              */
+
+#define SYS_GPF_MFPL_PF3MFP_Pos          (12)                                              /*!< SYS_T::GPF_MFPL: PF3MFP Position          */
+#define SYS_GPF_MFPL_PF3MFP_Msk          (0xful << SYS_GPF_MFPL_PF3MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF3MFP Mask              */
+
+#define SYS_GPF_MFPL_PF4MFP_Pos          (16)                                              /*!< SYS_T::GPF_MFPL: PF4MFP Position          */
+#define SYS_GPF_MFPL_PF4MFP_Msk          (0xful << SYS_GPF_MFPL_PF4MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF4MFP Mask              */
+
+#define SYS_GPF_MFPL_PF5MFP_Pos          (20)                                              /*!< SYS_T::GPF_MFPL: PF5MFP Position          */
+#define SYS_GPF_MFPL_PF5MFP_Msk          (0xful << SYS_GPF_MFPL_PF5MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF5MFP Mask              */
+
+#define SYS_GPF_MFPL_PF6MFP_Pos          (24)                                              /*!< SYS_T::GPF_MFPL: PF6MFP Position          */
+#define SYS_GPF_MFPL_PF6MFP_Msk          (0xful << SYS_GPF_MFPL_PF6MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF6MFP Mask              */
+
+#define SYS_GPF_MFPL_PF7MFP_Pos          (28)                                              /*!< SYS_T::GPF_MFPL: PF7MFP Position          */
+#define SYS_GPF_MFPL_PF7MFP_Msk          (0xful << SYS_GPF_MFPL_PF7MFP_Pos)                /*!< SYS_T::GPF_MFPL: PF7MFP Mask              */
+
+/* SYS GPF_MFPH Bit Field Definitions */
+#define SYS_GPF_MFPH_PF8MFP_Pos          (0)                                               /*!< SYS_T::GPF_MFPH: PF8MFP Position          */
+#define SYS_GPF_MFPH_PF8MFP_Msk          (0xful << SYS_GPF_MFPH_PF8MFP_Pos)                /*!< SYS_T::GPF_MFPH: PF8MFP Mask              */
+
+#define SYS_GPF_MFPH_PF9MFP_Pos          (4)                                               /*!< SYS_T::GPF_MFPH: PF9MFP Position          */
+#define SYS_GPF_MFPH_PF9MFP_Msk          (0xful << SYS_GPF_MFPH_PF9MFP_Pos)                /*!< SYS_T::GPF_MFPH: PF9MFP Mask              */
+
+#define SYS_GPF_MFPH_PF10MFP_Pos         (8)                                               /*!< SYS_T::GPF_MFPH: PF10MFP Position         */
+#define SYS_GPF_MFPH_PF10MFP_Msk         (0xful << SYS_GPF_MFPH_PF10MFP_Pos)               /*!< SYS_T::GPF_MFPH: PF10MFP Mask             */
+
+#define SYS_GPF_MFPH_PF11MFP_Pos         (12)                                              /*!< SYS_T::GPF_MFPH: PF11MFP Position         */
+#define SYS_GPF_MFPH_PF11MFP_Msk         (0xful << SYS_GPF_MFPH_PF11MFP_Pos)               /*!< SYS_T::GPF_MFPH: PF11MFP Mask             */
+
+#define SYS_GPF_MFPH_PF12MFP_Pos         (16)                                              /*!< SYS_T::GPF_MFPH: PF12MFP Position         */
+#define SYS_GPF_MFPH_PF12MFP_Msk         (0xful << SYS_GPF_MFPH_PF12MFP_Pos)               /*!< SYS_T::GPF_MFPH: PF12MFP Mask             */
+
+#define SYS_GPF_MFPH_PF13MFP_Pos         (20)                                              /*!< SYS_T::GPF_MFPH: PF13MFP Position         */
+#define SYS_GPF_MFPH_PF13MFP_Msk         (0xful << SYS_GPF_MFPH_PF13MFP_Pos)               /*!< SYS_T::GPF_MFPH: PF13MFP Mask             */
+
+#define SYS_GPF_MFPH_PF14MFP_Pos         (24)                                              /*!< SYS_T::GPF_MFPH: PF14MFP Position         */
+#define SYS_GPF_MFPH_PF14MFP_Msk         (0xful << SYS_GPF_MFPH_PF14MFP_Pos)               /*!< SYS_T::GPF_MFPH: PF14MFP Mask             */
+
+#define SYS_GPF_MFPH_PF15MFP_Pos         (28)                                              /*!< SYS_T::GPF_MFPH: PF15MFP Position         */
+#define SYS_GPF_MFPH_PF15MFP_Msk         (0xful << SYS_GPF_MFPH_PF15MFP_Pos)               /*!< SYS_T::GPF_MFPH: PF15MFP Mask             */
+
+/* SYS GPG_MFPL Bit Field Definitions */
+#define SYS_GPG_MFPL_PG0MFP_Pos          (0)                                               /*!< SYS_T::GPG_MFPL: PG0MFP Position          */
+#define SYS_GPG_MFPL_PG0MFP_Msk          (0xful << SYS_GPG_MFPL_PG0MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG0MFP Mask              */
+
+#define SYS_GPG_MFPL_PG1MFP_Pos          (4)                                               /*!< SYS_T::GPG_MFPL: PG1MFP Position          */
+#define SYS_GPG_MFPL_PG1MFP_Msk          (0xful << SYS_GPG_MFPL_PG1MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG1MFP Mask              */
+
+#define SYS_GPG_MFPL_PG2MFP_Pos          (8)                                               /*!< SYS_T::GPG_MFPL: PG2MFP Position          */
+#define SYS_GPG_MFPL_PG2MFP_Msk          (0xful << SYS_GPG_MFPL_PG2MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG2MFP Mask              */
+
+#define SYS_GPG_MFPL_PG3MFP_Pos          (12)                                              /*!< SYS_T::GPG_MFPL: PG3MFP Position          */
+#define SYS_GPG_MFPL_PG3MFP_Msk          (0xful << SYS_GPG_MFPL_PG3MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG3MFP Mask              */
+
+#define SYS_GPG_MFPL_PG4MFP_Pos          (16)                                              /*!< SYS_T::GPG_MFPL: PG4MFP Position          */
+#define SYS_GPG_MFPL_PG4MFP_Msk          (0xful << SYS_GPG_MFPL_PG4MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG4MFP Mask              */
+
+#define SYS_GPG_MFPL_PG5MFP_Pos          (20)                                              /*!< SYS_T::GPG_MFPL: PG5MFP Position          */
+#define SYS_GPG_MFPL_PG5MFP_Msk          (0xful << SYS_GPG_MFPL_PG5MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG5MFP Mask              */
+
+#define SYS_GPG_MFPL_PG6MFP_Pos          (24)                                              /*!< SYS_T::GPG_MFPL: PG6MFP Position          */
+#define SYS_GPG_MFPL_PG6MFP_Msk          (0xful << SYS_GPG_MFPL_PG6MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG6MFP Mask              */
+
+#define SYS_GPG_MFPL_PG7MFP_Pos          (28)                                              /*!< SYS_T::GPG_MFPL: PG7MFP Position          */
+#define SYS_GPG_MFPL_PG7MFP_Msk          (0xful << SYS_GPG_MFPL_PG7MFP_Pos)                /*!< SYS_T::GPG_MFPL: PG7MFP Mask              */
+
+/* SYS GPG_MFPH Bit Field Definitions */
+#define SYS_GPG_MFPH_PG8MFP_Pos          (0)                                               /*!< SYS_T::GPG_MFPH: PG8MFP Position          */
+#define SYS_GPG_MFPH_PG8MFP_Msk          (0xful << SYS_GPG_MFPH_PG8MFP_Pos)                /*!< SYS_T::GPG_MFPH: PG8MFP Mask              */
+
+#define SYS_GPG_MFPH_PG9MFP_Pos          (4)                                               /*!< SYS_T::GPG_MFPH: PG9MFP Position          */
+#define SYS_GPG_MFPH_PG9MFP_Msk          (0xful << SYS_GPG_MFPH_PG9MFP_Pos)                /*!< SYS_T::GPG_MFPH: PG9MFP Mask              */
+
+#define SYS_GPG_MFPH_PG10MFP_Pos         (8)                                               /*!< SYS_T::GPG_MFPH: PG10MFP Position         */
+#define SYS_GPG_MFPH_PG10MFP_Msk         (0xful << SYS_GPG_MFPH_PG10MFP_Pos)               /*!< SYS_T::GPG_MFPH: PG10MFP Mask             */
+
+#define SYS_GPG_MFPH_PG11MFP_Pos         (12)                                              /*!< SYS_T::GPG_MFPH: PG11MFP Position         */
+#define SYS_GPG_MFPH_PG11MFP_Msk         (0xful << SYS_GPG_MFPH_PG11MFP_Pos)               /*!< SYS_T::GPG_MFPH: PG11MFP Mask             */
+
+#define SYS_GPG_MFPH_PG12MFP_Pos         (16)                                              /*!< SYS_T::GPG_MFPH: PG12MFP Position         */
+#define SYS_GPG_MFPH_PG12MFP_Msk         (0xful << SYS_GPG_MFPH_PG12MFP_Pos)               /*!< SYS_T::GPG_MFPH: PG12MFP Mask             */
+
+#define SYS_GPG_MFPH_PG13MFP_Pos         (20)                                              /*!< SYS_T::GPG_MFPH: PG13MFP Position         */
+#define SYS_GPG_MFPH_PG13MFP_Msk         (0xful << SYS_GPG_MFPH_PG13MFP_Pos)               /*!< SYS_T::GPG_MFPH: PG13MFP Mask             */
+
+#define SYS_GPG_MFPH_PG14MFP_Pos         (24)                                              /*!< SYS_T::GPG_MFPH: PG14MFP Position         */
+#define SYS_GPG_MFPH_PG14MFP_Msk         (0xful << SYS_GPG_MFPH_PG14MFP_Pos)               /*!< SYS_T::GPG_MFPH: PG14MFP Mask             */
+
+#define SYS_GPG_MFPH_PG15MFP_Pos         (28)                                              /*!< SYS_T::GPG_MFPH: PG15MFP Position         */
+#define SYS_GPG_MFPH_PG15MFP_Msk         (0xful << SYS_GPG_MFPH_PG15MFP_Pos)               /*!< SYS_T::GPG_MFPH: PG15MFP Mask             */
+
+/*@}*/ /* end of group NUC980_SYS_EXPORTED_CONSTANTS */
+
+
+/********************* Bit definition of GPA_MFPL register **********************/
+#define SYS_GPA_MFPL_PA0MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA0MFP_Pos)
+#define SYS_GPA_MFPL_PA1MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA1MFP_Pos)
+#define SYS_GPA_MFPL_PA1MFP_EBI_nCS2          (0x01UL<<SYS_GPA_MFPL_PA1MFP_Pos)
+#define SYS_GPA_MFPL_PA1MFP_EBI_MCLK          (0x02UL<<SYS_GPA_MFPL_PA1MFP_Pos)
+#define SYS_GPA_MFPL_PA2MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA2MFP_Pos)
+#define SYS_GPA_MFPL_PA3MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA3MFP_Pos)
+#define SYS_GPA_MFPL_PA4MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA4MFP_Pos)
+#define SYS_GPA_MFPL_PA5MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA5MFP_Pos)
+#define SYS_GPA_MFPL_PA6MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA6MFP_Pos)
+#define SYS_GPA_MFPL_PA6MFP_EBI_nCS1          (0x01UL<<SYS_GPA_MFPL_PA6MFP_Pos)
+#define SYS_GPA_MFPL_PA7MFP_GPIO              (0x00UL<<SYS_GPA_MFPL_PA7MFP_Pos)
+#define SYS_GPA_MFPL_PA7MFP_EBI_nWE           (0x01UL<<SYS_GPA_MFPL_PA7MFP_Pos)
+/********************* Bit definition of GPA_MFPH register **********************/
+#define SYS_GPA_MFPH_PA8MFP_GPIO              (0x00UL<<SYS_GPA_MFPH_PA8MFP_Pos)
+#define SYS_GPA_MFPH_PA8MFP_EBI_nRE           (0x01UL<<SYS_GPA_MFPH_PA8MFP_Pos)
+#define SYS_GPA_MFPH_PA9MFP_GPIO              (0x00UL<<SYS_GPA_MFPH_PA9MFP_Pos)
+#define SYS_GPA_MFPH_PA9MFP_EBI_nCS0          (0x01UL<<SYS_GPA_MFPH_PA9MFP_Pos)
+#define SYS_GPA_MFPH_PA10MFP_GPIO             (0x00UL<<SYS_GPA_MFPH_PA10MFP_Pos)
+#define SYS_GPA_MFPH_PA10MFP_EBI_ADDR10       (0x01UL<<SYS_GPA_MFPH_PA10MFP_Pos)
+#define SYS_GPA_MFPH_PA11MFP_GPIO             (0x00UL<<SYS_GPA_MFPH_PA11MFP_Pos)
+#define SYS_GPA_MFPH_PA11MFP_EBI_ADDR9        (0x01UL<<SYS_GPA_MFPH_PA11MFP_Pos)
+#define SYS_GPA_MFPH_PA12MFP_GPIO             (0x00UL<<SYS_GPA_MFPH_PA12MFP_Pos)
+#define SYS_GPA_MFPH_PA12MFP_EBI_ADDR8        (0x01UL<<SYS_GPA_MFPH_PA12MFP_Pos)
+#define SYS_GPA_MFPH_PA13MFP_GPIO             (0x00UL<<SYS_GPA_MFPH_PA13MFP_Pos)
+#define SYS_GPA_MFPH_PA13MFP_EBI_ADDR13       (0x01UL<<SYS_GPA_MFPH_PA13MFP_Pos)
+#define SYS_GPA_MFPH_PA14MFP_GPIO             (0x00UL<<SYS_GPA_MFPH_PA14MFP_Pos)
+#define SYS_GPA_MFPH_PA14MFP_EBI_ADDR14       (0x01UL<<SYS_GPA_MFPH_PA14MFP_Pos)
+#define SYS_GPA_MFPH_PA15MFP_GPIO             (0x00UL<<SYS_GPA_MFPH_PA15MFP_Pos)
+#define SYS_GPA_MFPH_PA15MFP_EBI_ADDR19       (0x01UL<<SYS_GPA_MFPH_PA15MFP_Pos)
+/********************* Bit definition of GPB_MFPL register **********************/
+#define SYS_GPB_MFPL_PB0MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB0MFP_Pos)
+#define SYS_GPB_MFPL_PB0MFP_EBI_ADDR12        (0x01UL<<SYS_GPB_MFPL_PB0MFP_Pos)
+#define SYS_GPB_MFPL_PB1MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB1MFP_Pos)
+#define SYS_GPB_MFPL_PB1MFP_EBI_ADDR17        (0x01UL<<SYS_GPB_MFPL_PB1MFP_Pos)
+#define SYS_GPB_MFPL_PB2MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB2MFP_Pos)
+#define SYS_GPB_MFPL_PB2MFP_EBI_ADDR2         (0x01UL<<SYS_GPB_MFPL_PB2MFP_Pos)
+#define SYS_GPB_MFPL_PB2MFP_EBI_MCLK          (0x03UL<<SYS_GPB_MFPL_PB2MFP_Pos)
+#define SYS_GPB_MFPL_PB3MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB3MFP_Pos)
+#define SYS_GPB_MFPL_PB3MFP_EBI_ADDR18        (0x01UL<<SYS_GPB_MFPL_PB3MFP_Pos)
+#define SYS_GPB_MFPL_PB4MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB4MFP_Pos)
+#define SYS_GPB_MFPL_PB4MFP_EBI_ADDR14        (0x01UL<<SYS_GPB_MFPL_PB4MFP_Pos)
+#define SYS_GPB_MFPL_PB5MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB5MFP_Pos)
+#define SYS_GPB_MFPL_PB5MFP_EBI_ADDR16        (0x01UL<<SYS_GPB_MFPL_PB5MFP_Pos)
+#define SYS_GPB_MFPL_PB6MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB6MFP_Pos)
+#define SYS_GPB_MFPL_PB6MFP_EBI_ADDR13        (0x01UL<<SYS_GPB_MFPL_PB6MFP_Pos)
+#define SYS_GPB_MFPL_PB7MFP_GPIO              (0x00UL<<SYS_GPB_MFPL_PB7MFP_Pos)
+#define SYS_GPB_MFPL_PB7MFP_EBI_ADDR15        (0x01UL<<SYS_GPB_MFPL_PB7MFP_Pos)
+/********************* Bit definition of GPB_MFPH register **********************/
+#define SYS_GPB_MFPH_PB8MFP_GPIO              (0x00UL<<SYS_GPB_MFPH_PB8MFP_Pos)
+#define SYS_GPB_MFPH_PB8MFP_EBI_ADDR11        (0x01UL<<SYS_GPB_MFPH_PB8MFP_Pos)
+#define SYS_GPB_MFPH_PB9MFP_GPIO              (0x00UL<<SYS_GPB_MFPH_PB9MFP_Pos)
+#define SYS_GPB_MFPH_PB10MFP_GPIO             (0x00UL<<SYS_GPB_MFPH_PB10MFP_Pos)
+#define SYS_GPB_MFPH_PB11MFP_GPIO             (0x00UL<<SYS_GPB_MFPH_PB11MFP_Pos)
+#define SYS_GPB_MFPH_PB12MFP_GPIO             (0x00UL<<SYS_GPB_MFPH_PB12MFP_Pos)
+#define SYS_GPB_MFPH_PB13MFP_GPIO             (0x00UL<<SYS_GPB_MFPH_PB13MFP_Pos)
+/********************* Bit definition of GPC_MFPL register **********************/
+#define SYS_GPC_MFPL_PC0MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC0MFP_Pos)
+#define SYS_GPC_MFPL_PC0MFP_EBI_DATA0         (0x01UL<<SYS_GPC_MFPL_PC0MFP_Pos)
+#define SYS_GPC_MFPL_PC1MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC1MFP_Pos)
+#define SYS_GPC_MFPL_PC1MFP_EBI_DATA1         (0x01UL<<SYS_GPC_MFPL_PC1MFP_Pos)
+#define SYS_GPC_MFPL_PC2MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC2MFP_Pos)
+#define SYS_GPC_MFPL_PC2MFP_EBI_DATA2         (0x01UL<<SYS_GPC_MFPL_PC2MFP_Pos)
+#define SYS_GPC_MFPL_PC3MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC3MFP_Pos)
+#define SYS_GPC_MFPL_PC3MFP_EBI_DATA3         (0x01UL<<SYS_GPC_MFPL_PC3MFP_Pos)
+#define SYS_GPC_MFPL_PC4MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC4MFP_Pos)
+#define SYS_GPC_MFPL_PC4MFP_EBI_DATA4         (0x01UL<<SYS_GPC_MFPL_PC4MFP_Pos)
+#define SYS_GPC_MFPL_PC5MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC5MFP_Pos)
+#define SYS_GPC_MFPL_PC5MFP_EBI_DATA5         (0x01UL<<SYS_GPC_MFPL_PC5MFP_Pos)
+#define SYS_GPC_MFPL_PC6MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC6MFP_Pos)
+#define SYS_GPC_MFPL_PC6MFP_EBI_DATA6         (0x01UL<<SYS_GPC_MFPL_PC6MFP_Pos)
+#define SYS_GPC_MFPL_PC7MFP_GPIO              (0x00UL<<SYS_GPC_MFPL_PC7MFP_Pos)
+#define SYS_GPC_MFPL_PC7MFP_EBI_DATA7         (0x01UL<<SYS_GPC_MFPL_PC7MFP_Pos)
+/********************* Bit definition of GPC_MFPH register **********************/
+#define SYS_GPC_MFPH_PC8MFP_GPIO              (0x00UL<<SYS_GPC_MFPH_PC8MFP_Pos)
+#define SYS_GPC_MFPH_PC8MFP_EBI_DATA8         (0x01UL<<SYS_GPC_MFPH_PC8MFP_Pos)
+#define SYS_GPC_MFPH_PC9MFP_GPIO              (0x00UL<<SYS_GPC_MFPH_PC9MFP_Pos)
+#define SYS_GPC_MFPH_PC9MFP_EBI_DATA9         (0x01UL<<SYS_GPC_MFPH_PC9MFP_Pos)
+#define SYS_GPC_MFPH_PC10MFP_GPIO             (0x00UL<<SYS_GPC_MFPH_PC10MFP_Pos)
+#define SYS_GPC_MFPH_PC10MFP_EBI_DATA10       (0x01UL<<SYS_GPC_MFPH_PC10MFP_Pos)
+#define SYS_GPC_MFPH_PC11MFP_GPIO             (0x00UL<<SYS_GPC_MFPH_PC11MFP_Pos)
+#define SYS_GPC_MFPH_PC11MFP_EBI_DATA11       (0x01UL<<SYS_GPC_MFPH_PC11MFP_Pos)
+#define SYS_GPC_MFPH_PC12MFP_GPIO             (0x00UL<<SYS_GPC_MFPH_PC12MFP_Pos)
+#define SYS_GPC_MFPH_PC12MFP_EBI_DATA12       (0x01UL<<SYS_GPC_MFPH_PC12MFP_Pos)
+#define SYS_GPC_MFPH_PC13MFP_GPIO             (0x00UL<<SYS_GPC_MFPH_PC13MFP_Pos)
+#define SYS_GPC_MFPH_PC13MFP_EBI_DATA13       (0x01UL<<SYS_GPC_MFPH_PC13MFP_Pos)
+#define SYS_GPC_MFPH_PC14MFP_GPIO             (0x00UL<<SYS_GPC_MFPH_PC14MFP_Pos)
+#define SYS_GPC_MFPH_PC14MFP_EBI_DATA14       (0x01UL<<SYS_GPC_MFPH_PC14MFP_Pos)
+#define SYS_GPC_MFPH_PC15MFP_GPIO             (0x00UL<<SYS_GPC_MFPH_PC15MFP_Pos)
+#define SYS_GPC_MFPH_PC15MFP_EBI_DATA15       (0x01UL<<SYS_GPC_MFPH_PC15MFP_Pos)
+/********************* Bit definition of GPD_MFPL register **********************/
+#define SYS_GPD_MFPL_PD0MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD0MFP_Pos)
+#define SYS_GPD_MFPL_PD1MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD1MFP_Pos)
+#define SYS_GPD_MFPL_PD2MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD2MFP_Pos)
+#define SYS_GPD_MFPL_PD3MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD3MFP_Pos)
+#define SYS_GPD_MFPL_PD4MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD4MFP_Pos)
+#define SYS_GPD_MFPL_PD5MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD5MFP_Pos)
+#define SYS_GPD_MFPL_PD6MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD6MFP_Pos)
+#define SYS_GPD_MFPL_PD7MFP_GPIO              (0x00UL<<SYS_GPD_MFPL_PD7MFP_Pos)
+/********************* Bit definition of GPD_MFPH register **********************/
+#define SYS_GPD_MFPH_PD8MFP_GPIO              (0x00UL<<SYS_GPD_MFPH_PD8MFP_Pos)
+#define SYS_GPD_MFPH_PD9MFP_GPIO              (0x00UL<<SYS_GPD_MFPH_PD9MFP_Pos)
+#define SYS_GPD_MFPH_PD10MFP_GPIO             (0x00UL<<SYS_GPD_MFPH_PD10MFP_Pos)
+#define SYS_GPD_MFPH_PD11MFP_GPIO             (0x00UL<<SYS_GPD_MFPH_PD11MFP_Pos)
+#define SYS_GPD_MFPH_PD12MFP_GPIO             (0x00UL<<SYS_GPD_MFPH_PD12MFP_Pos)
+#define SYS_GPD_MFPH_PD12MFP_EBI_DATA1        (0x08UL<<SYS_GPD_MFPH_PD12MFP_Pos)
+#define SYS_GPD_MFPH_PD13MFP_GPIO             (0x00UL<<SYS_GPD_MFPH_PD13MFP_Pos)
+#define SYS_GPD_MFPH_PD13MFP_EBI_DATA2        (0x08UL<<SYS_GPD_MFPH_PD13MFP_Pos)
+#define SYS_GPD_MFPH_PD14MFP_GPIO             (0x00UL<<SYS_GPD_MFPH_PD14MFP_Pos)
+#define SYS_GPD_MFPH_PD14MFP_EBI_DATA3        (0x08UL<<SYS_GPD_MFPH_PD14MFP_Pos)
+#define SYS_GPD_MFPH_PD15MFP_GPIO             (0x00UL<<SYS_GPD_MFPH_PD15MFP_Pos)
+#define SYS_GPD_MFPH_PD15MFP_EBI_DATA4        (0x08UL<<SYS_GPD_MFPH_PD15MFP_Pos)
+/********************* Bit definition of GPE_MFPL register **********************/
+#define SYS_GPE_MFPL_PE0MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE0MFP_Pos)
+#define SYS_GPE_MFPL_PE1MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE1MFP_Pos)
+#define SYS_GPE_MFPL_PE2MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE2MFP_Pos)
+#define SYS_GPE_MFPL_PE3MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE3MFP_Pos)
+#define SYS_GPE_MFPL_PE4MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE4MFP_Pos)
+#define SYS_GPE_MFPL_PE5MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE5MFP_Pos)
+#define SYS_GPE_MFPL_PE6MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE6MFP_Pos)
+#define SYS_GPE_MFPL_PE7MFP_GPIO              (0x00UL<<SYS_GPE_MFPL_PE7MFP_Pos)
+/********************* Bit definition of GPE_MFPH register **********************/
+#define SYS_GPE_MFPH_PE8MFP_GPIO              (0x00UL<<SYS_GPE_MFPH_PE8MFP_Pos)
+#define SYS_GPE_MFPH_PE9MFP_GPIO              (0x00UL<<SYS_GPE_MFPH_PE9MFP_Pos)
+#define SYS_GPE_MFPH_PE10MFP_GPIO             (0x00UL<<SYS_GPE_MFPH_PE10MFP_Pos)
+#define SYS_GPE_MFPH_PE11MFP_GPIO             (0x00UL<<SYS_GPE_MFPH_PE11MFP_Pos)
+#define SYS_GPE_MFPH_PE12MFP_GPIO             (0x00UL<<SYS_GPE_MFPH_PE12MFP_Pos)
+/********************* Bit definition of GPF_MFPL register **********************/
+#define SYS_GPF_MFPL_PF0MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF0MFP_Pos)
+#define SYS_GPF_MFPL_PF0MFP_EBI_DATA5         (0x08UL<<SYS_GPF_MFPL_PF0MFP_Pos)
+#define SYS_GPF_MFPL_PF1MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF1MFP_Pos)
+#define SYS_GPF_MFPL_PF1MFP_EBI_DATA6         (0x08UL<<SYS_GPF_MFPL_PF1MFP_Pos)
+#define SYS_GPF_MFPL_PF2MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF2MFP_Pos)
+#define SYS_GPF_MFPL_PF2MFP_EBI_DATA7         (0x08UL<<SYS_GPF_MFPL_PF2MFP_Pos)
+#define SYS_GPF_MFPL_PF3MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF3MFP_Pos)
+#define SYS_GPF_MFPL_PF3MFP_EBI_DATA8         (0x08UL<<SYS_GPF_MFPL_PF3MFP_Pos)
+#define SYS_GPF_MFPL_PF4MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF4MFP_Pos)
+#define SYS_GPF_MFPL_PF4MFP_EBI_DATA9         (0x08UL<<SYS_GPF_MFPL_PF4MFP_Pos)
+#define SYS_GPF_MFPL_PF5MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF5MFP_Pos)
+#define SYS_GPF_MFPL_PF5MFP_EBI_DATA10        (0x08UL<<SYS_GPF_MFPL_PF5MFP_Pos)
+#define SYS_GPF_MFPL_PF6MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF6MFP_Pos)
+#define SYS_GPF_MFPL_PF6MFP_EBI_DATA11        (0x08UL<<SYS_GPF_MFPL_PF6MFP_Pos)
+#define SYS_GPF_MFPL_PF7MFP_GPIO              (0x00UL<<SYS_GPF_MFPL_PF7MFP_Pos)
+#define SYS_GPF_MFPL_PF7MFP_EBI_DATA12        (0x08UL<<SYS_GPF_MFPL_PF7MFP_Pos)
+/********************* Bit definition of GPF_MFPH register **********************/
+#define SYS_GPF_MFPH_PF8MFP_GPIO              (0x00UL<<SYS_GPF_MFPH_PF8MFP_Pos)
+#define SYS_GPF_MFPH_PF8MFP_EBI_DATA13        (0x08UL<<SYS_GPF_MFPH_PF8MFP_Pos)
+#define SYS_GPF_MFPH_PF9MFP_GPIO              (0x00UL<<SYS_GPF_MFPH_PF9MFP_Pos)
+#define SYS_GPF_MFPH_PF9MFP_EBI_DATA14        (0x08UL<<SYS_GPF_MFPH_PF9MFP_Pos)
+#define SYS_GPF_MFPH_PF10MFP_GPIO             (0x00UL<<SYS_GPF_MFPH_PF10MFP_Pos)
+#define SYS_GPF_MFPH_PF10MFP_EBI_DATA15       (0x08UL<<SYS_GPF_MFPH_PF10MFP_Pos)
+#define SYS_GPF_MFPH_PF11MFP_GPIO             (0x00UL<<SYS_GPF_MFPH_PF11MFP_Pos)
+#define SYS_GPF_MFPH_PF12MFP_GPIO             (0x00UL<<SYS_GPF_MFPH_PF12MFP_Pos)
+/********************* Bit definition of GPG_MFPL register **********************/
+#define SYS_GPG_MFPL_PG0MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG0MFP_Pos)
+#define SYS_GPG_MFPL_PG0MFP_EBI_ADDR0         (0x01UL<<SYS_GPG_MFPL_PG0MFP_Pos)
+#define SYS_GPG_MFPL_PG1MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG1MFP_Pos)
+#define SYS_GPG_MFPL_PG1MFP_EBI_ADDR1         (0x01UL<<SYS_GPG_MFPL_PG1MFP_Pos)
+#define SYS_GPG_MFPL_PG2MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG2MFP_Pos)
+#define SYS_GPG_MFPL_PG2MFP_EBI_ADDR2         (0x01UL<<SYS_GPG_MFPL_PG2MFP_Pos)
+#define SYS_GPG_MFPL_PG3MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG3MFP_Pos)
+#define SYS_GPG_MFPL_PG3MFP_EBI_ADDR3         (0x01UL<<SYS_GPG_MFPL_PG3MFP_Pos)
+#define SYS_GPG_MFPL_PG4MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG4MFP_Pos)
+#define SYS_GPG_MFPL_PG4MFP_EBI_ADDR18        (0x01UL<<SYS_GPG_MFPL_PG4MFP_Pos)
+#define SYS_GPG_MFPL_PG5MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG5MFP_Pos)
+#define SYS_GPG_MFPL_PG5MFP_EBI_ADDR12        (0x01UL<<SYS_GPG_MFPL_PG5MFP_Pos)
+#define SYS_GPG_MFPL_PG6MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG6MFP_Pos)
+#define SYS_GPG_MFPL_PG6MFP_EBI_ADDR4         (0x01UL<<SYS_GPG_MFPL_PG6MFP_Pos)
+#define SYS_GPG_MFPL_PG7MFP_GPIO              (0x00UL<<SYS_GPG_MFPL_PG7MFP_Pos)
+#define SYS_GPG_MFPL_PG7MFP_EBI_ADDR5         (0x01UL<<SYS_GPG_MFPL_PG7MFP_Pos)
+/********************* Bit definition of GPG_MFPH register **********************/
+#define SYS_GPG_MFPH_PG8MFP_GPIO              (0x00UL<<SYS_GPG_MFPH_PG8MFP_Pos)
+#define SYS_GPG_MFPH_PG8MFP_EBI_ADDR6         (0x01UL<<SYS_GPG_MFPH_PG8MFP_Pos)
+#define SYS_GPG_MFPH_PG9MFP_GPIO              (0x00UL<<SYS_GPG_MFPH_PG9MFP_Pos)
+#define SYS_GPG_MFPH_PG9MFP_EBI_ADDR7         (0x01UL<<SYS_GPG_MFPH_PG9MFP_Pos)
+#define SYS_GPG_MFPH_PG10MFP_GPIO             (0x00UL<<SYS_GPG_MFPH_PG10MFP_Pos)
+#define SYS_GPG_MFPH_PG10MFP_EBI_DATA0        (0x01UL<<SYS_GPG_MFPH_PG10MFP_Pos)
+#define SYS_GPG_MFPH_PG11MFP_GPIO             (0x00UL<<SYS_GPG_MFPH_PG11MFP_Pos)
+#define SYS_GPG_MFPH_PG12MFP_GPIO             (0x00UL<<SYS_GPG_MFPH_PG12MFP_Pos)
+#define SYS_GPG_MFPH_PG13MFP_GPIO             (0x00UL<<SYS_GPG_MFPH_PG13MFP_Pos)
+#define SYS_GPG_MFPH_PG14MFP_GPIO             (0x00UL<<SYS_GPG_MFPH_PG14MFP_Pos)
+#define SYS_GPG_MFPH_PG15MFP_GPIO             (0x00UL<<SYS_GPG_MFPH_PG15MFP_Pos)
+
+/** @addtogroup SYS_EXPORTED_FUNCTIONS SYS Exported Functions
+  @{
+*/
+
+/**
+  * @brief      Disable register write-protection function
+  * @param      None
+  * @return     None
+  * @details    This function disable register write-protection function.
+  *             To unlock the protected register to allow write access.
+  */
+static __inline void SYS_UnlockReg(void)
+{
+    do
+    {
+        outpw(0xB00001FC, 0x59UL);
+        outpw(0xB00001FC, 0x16UL);
+        outpw(0xB00001FC, 0x88UL);
+    }
+    while (inpw(0xB00001FC) == 0UL);
+}
+
+/**
+  * @brief      Enable register write-protection function
+  * @param      None
+  * @return     None
+  * @details    This function is used to enable register write-protection function.
+  *             To lock the protected register to forbid write access.
+  */
+static __inline void SYS_LockReg(void)
+{
+    outpw(0xB00001FC, 0);
+}
+
+/* Define system library AIC functions */
+INT32   sysDisableInterrupt(IRQn_Type eIntNo);
+INT32   sysEnableInterrupt(IRQn_Type eIntNo);
+BOOL    sysGetIBitState(void);
+UINT32  sysGetInterruptEnableStatus(void);
+UINT32  sysGetInterruptEnableStatusH(void);
+PVOID   sysInstallExceptionHandler(INT32 nExceptType, PVOID pvNewHandler);
+PVOID   sysInstallFiqHandler(PVOID pvNewISR);
+PVOID   sysInstallIrqHandler(PVOID pvNewISR);
+PVOID   sysInstallISR(INT32 nIntTypeLevel, IRQn_Type eIntNo, PVOID pvNewISR);
+INT32   sysSetGlobalInterrupt(INT32 nIntState);
+INT32   sysSetInterruptPriorityLevel(IRQn_Type eIntNo, UINT32 uIntLevel);
+INT32   sysSetInterruptType(IRQn_Type eIntNo, UINT32 uIntSourceType);
+INT32   sysSetLocalInterrupt(INT32 nIntState);
+
+
+/* Define system library Cache functions */
+void    sysDisableCache(void);
+INT32   sysEnableCache(UINT32 uCacheOpMode);
+void    sysFlushCache(INT32 nCacheType);
+BOOL    sysGetCacheState(void);
+INT32   sysGetSdramSizebyMB(void);
+void    sysInvalidCache(void);
+
+UINT32 sysGetClock(CLK_Type clk);
+
+typedef void (*sys_pvFunPtr)();   /* function pointer */
+extern sys_pvFunPtr sysIrqHandlerTable[];
+extern UINT32 volatile _sys_bIsAICInitial;
+
+#ifdef __cplusplus
+}
+#endif
+
+/*@}*/ /* end of group SYS_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group SYS_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#endif //__SYS_H__
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

+ 888 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_uart.h

@@ -0,0 +1,888 @@
+/**************************************************************************//**
+ * @file     uart.h
+ * @version  V3.00
+ * @brief    NUC980 series UART driver header file
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * @copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.
+*****************************************************************************/
+#ifndef __NU_UART_H__
+#define __NU_UART_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "nuc980.h"
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup UART_Driver UART Driver
+  @{
+*/
+
+/** @addtogroup UART_EXPORTED_CONSTANTS UART Exported Constants
+  @{
+*/
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART FIFO size constants definitions                                                                    */
+/*---------------------------------------------------------------------------------------------------------*/
+
+#define UART0_FIFO_SIZE 16ul /*!< UART0 supports separated receive/transmit 16/16 bytes entry FIFO \hideinitializer */
+#define UART1_FIFO_SIZE 16ul /*!< UART1 supports separated receive/transmit 16/16 bytes entry FIFO \hideinitializer */
+#define UART2_FIFO_SIZE 16ul /*!< UART2 supports separated receive/transmit 16/16 bytes entry FIFO \hideinitializer */
+#define UART3_FIFO_SIZE 16ul /*!< UART3 supports separated receive/transmit 16/16 bytes entry FIFO \hideinitializer */
+#define UART4_FIFO_SIZE 16ul /*!< UART3 supports separated receive/transmit 16/16 bytes entry FIFO \hideinitializer */
+#define UART5_FIFO_SIZE 16ul /*!< UART3 supports separated receive/transmit 16/16 bytes entry FIFO \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART_FIFO constants definitions                                                                         */
+/*---------------------------------------------------------------------------------------------------------*/
+
+#define UART_FIFO_RFITL_1BYTE      (0x0ul << UART_FIFO_RFITL_Pos)   /*!< UART_FIFO setting to set RX FIFO Trigger Level to 1 byte \hideinitializer */
+#define UART_FIFO_RFITL_4BYTES     (0x1ul << UART_FIFO_RFITL_Pos)   /*!< UART_FIFO setting to set RX FIFO Trigger Level to 4 bytes \hideinitializer */
+#define UART_FIFO_RFITL_8BYTES     (0x2ul << UART_FIFO_RFITL_Pos)   /*!< UART_FIFO setting to set RX FIFO Trigger Level to 8 bytes \hideinitializer */
+#define UART_FIFO_RFITL_14BYTES    (0x3ul << UART_FIFO_RFITL_Pos)   /*!< UART_FIFO setting to set RX FIFO Trigger Level to 14 bytes \hideinitializer */
+
+#define UART_FIFO_RTSTRGLV_1BYTE      (0x0ul << UART_FIFO_RTSTRGLV_Pos)  /*!< UART_FIFO setting to set RTS Trigger Level to 1 byte \hideinitializer */
+#define UART_FIFO_RTSTRGLV_4BYTES     (0x1ul << UART_FIFO_RTSTRGLV_Pos)  /*!< UART_FIFO setting to set RTS Trigger Level to 4 bytes \hideinitializer */
+#define UART_FIFO_RTSTRGLV_8BYTES     (0x2ul << UART_FIFO_RTSTRGLV_Pos)  /*!< UART_FIFO setting to set RTS Trigger Level to 8 bytes \hideinitializer */
+#define UART_FIFO_RTSTRGLV_14BYTES    (0x3ul << UART_FIFO_RTSTRGLV_Pos)  /*!< UART_FIFO setting to set RTS Trigger Level to 14 bytes \hideinitializer */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART_LINE constants definitions                                                                         */
+/*---------------------------------------------------------------------------------------------------------*/
+#define UART_WORD_LEN_5     (0ul) /*!< UART_LINE setting to set UART word length to 5 bits \hideinitializer */
+#define UART_WORD_LEN_6     (1ul) /*!< UART_LINE setting to set UART word length to 6 bits \hideinitializer */
+#define UART_WORD_LEN_7     (2ul) /*!< UART_LINE setting to set UART word length to 7 bits \hideinitializer */
+#define UART_WORD_LEN_8     (3ul) /*!< UART_LINE setting to set UART word length to 8 bits \hideinitializer */
+
+#define UART_PARITY_NONE    (0x0ul << UART_LINE_PBE_Pos) /*!< UART_LINE setting to set UART as no parity   \hideinitializer */
+#define UART_PARITY_ODD     (0x1ul << UART_LINE_PBE_Pos) /*!< UART_LINE setting to set UART as odd parity  \hideinitializer */
+#define UART_PARITY_EVEN    (0x3ul << UART_LINE_PBE_Pos) /*!< UART_LINE setting to set UART as even parity \hideinitializer */
+#define UART_PARITY_MARK    (0x5ul << UART_LINE_PBE_Pos) /*!< UART_LINE setting to keep parity bit as '1'  \hideinitializer */
+#define UART_PARITY_SPACE   (0x7ul << UART_LINE_PBE_Pos) /*!< UART_LINE setting to keep parity bit as '0'  \hideinitializer */
+
+#define UART_STOP_BIT_1     (0x0ul << UART_LINE_NSB_Pos) /*!< UART_LINE setting for one stop bit  \hideinitializer */
+#define UART_STOP_BIT_1_5   (0x1ul << UART_LINE_NSB_Pos) /*!< UART_LINE setting for 1.5 stop bit when 5-bit word length  \hideinitializer */
+#define UART_STOP_BIT_2     (0x1ul << UART_LINE_NSB_Pos) /*!< UART_LINE setting for two stop bit when 6, 7, 8-bit word length \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART RTS ACTIVE LEVEL constants definitions                                                             */
+/*---------------------------------------------------------------------------------------------------------*/
+#define UART_RTS_IS_LOW_LEV_ACTIVE   (0x1ul << UART_MODEM_RTSACTLV_Pos) /*!< Set RTS is Low Level Active \hideinitializer */
+#define UART_RTS_IS_HIGH_LEV_ACTIVE  (0x0ul << UART_MODEM_RTSACTLV_Pos) /*!< Set RTS is High Level Active \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART_IRDA constants definitions                                                                         */
+/*---------------------------------------------------------------------------------------------------------*/
+#define UART_IRDA_TXEN      (0x1ul << UART_IRDA_TXEN_Pos) /*!< Set IrDA function Tx mode \hideinitializer */
+#define UART_IRDA_RXEN      (0x0ul << UART_IRDA_TXEN_Pos) /*!< Set IrDA function Rx mode \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART_FUNCSEL constants definitions                                                                      */
+/*---------------------------------------------------------------------------------------------------------*/
+#define UART_FUNCSEL_UART  (0x0ul << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set UART Function  (Default) \hideinitializer */
+#define UART_FUNCSEL_LIN   (0x1ul << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set LIN Function             \hideinitializer */
+#define UART_FUNCSEL_IrDA  (0x2ul << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set IrDA Function            \hideinitializer */
+#define UART_FUNCSEL_RS485 (0x3ul << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set RS485 Function           \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART_LINCTL constants definitions                                                                       */
+/*---------------------------------------------------------------------------------------------------------*/
+#define UART_LINCTL_BRKFL(x)    (((x)-1) << UART_LINCTL_BRKFL_Pos)  /*!< UART_LINCTL setting to set LIN Break Field Length, x = 10 ~ 15, default value is 12 \hideinitializer */
+#define UART_LINCTL_BSL(x)      (((x)-1) << UART_LINCTL_BSL_Pos)    /*!< UART_LINCTL setting to set LIN Break/Sync Delimiter Length, x = 1 ~ 4 \hideinitializer */
+#define UART_LINCTL_HSEL_BREAK             (0x0UL << UART_LINCTL_HSEL_Pos)    /*!< UART_LINCTL setting to set LIN Header Select to break field \hideinitializer */
+#define UART_LINCTL_HSEL_BREAK_SYNC        (0x1UL << UART_LINCTL_HSEL_Pos)    /*!< UART_LINCTL setting to set LIN Header Select to break field and sync field \hideinitializer */
+#define UART_LINCTL_HSEL_BREAK_SYNC_ID     (0x2UL << UART_LINCTL_HSEL_Pos)    /*!< UART_LINCTL setting to set LIN Header Select to break field, sync field and ID field \hideinitializer */
+#define UART_LINCTL_PID(x)      ((x) << UART_LINCTL_PID_Pos)       /*!< UART_LINCTL setting to set LIN PID value \hideinitializer */
+
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* UART BAUDRATE MODE constants definitions                                                                */
+/*---------------------------------------------------------------------------------------------------------*/
+#define UART_BAUD_MODE0     (0ul) /*!< Set UART Baudrate Mode is Mode0 \hideinitializer */
+#define UART_BAUD_MODE2     (UART_BAUD_BAUDM1_Msk | UART_BAUD_BAUDM0_Msk) /*!< Set UART Baudrate Mode is Mode2 \hideinitializer */
+
+
+/*@}*/ /* end of group UART_EXPORTED_CONSTANTS */
+
+typedef struct
+{
+    uint32_t DAT;                   /*!< [0x0000] UART Receive/Transmit Buffer Register                            */
+    uint32_t INTEN;                 /*!< [0x0004] UART Interrupt Enable Register                                   */
+    uint32_t FIFO;                  /*!< [0x0008] UART FIFO Control Register                                       */
+    uint32_t LINE;                  /*!< [0x000c] UART Line Control Register                                       */
+    uint32_t MODEM;                 /*!< [0x0010] UART Modem Control Register                                      */
+    uint32_t MODEMSTS;              /*!< [0x0014] UART Modem Status Register                                       */
+    uint32_t FIFOSTS;               /*!< [0x0018] UART FIFO Status Register                                        */
+    uint32_t INTSTS;                /*!< [0x001c] UART Interrupt Status Register                                   */
+    uint32_t TOUT;                  /*!< [0x0020] UART Time-out Register                                           */
+    uint32_t BAUD;                  /*!< [0x0024] UART Baud Rate Divider Register                                  */
+    uint32_t IRDA;                  /*!< [0x0028] UART IrDA Control Register                                       */
+    uint32_t ALTCTL;                /*!< [0x002c] UART Alternate Control/Status Register                           */
+    uint32_t FUNCSEL;               /*!< [0x0030] UART Function Select Register                                    */
+    uint32_t LINCTL;                /*!< [0x0034] UART LIN Control Register                                        */
+    uint32_t LINSTS;                /*!< [0x0038] UART LIN Status Register                                         */
+    uint32_t BRCOMP;                /*!< [0x003c] UART Baud Rate Compensation Register                             */
+    uint32_t WKCTL;                 /*!< [0x0040] UART Wake-up Control Register                                    */
+    uint32_t WKSTS;                 /*!< [0x0044] UART Wake-up Status Register                                     */
+    uint32_t DWKCOMP;               /*!< [0x0048] UART Incoming Data Wake-up Compensation Register                 */
+
+} UART_T;
+
+#define UART_DAT_DAT_Pos                 (0)                                               /*!< UART_T::DAT: DAT Position              */
+#define UART_DAT_DAT_Msk                 (0xfful << UART_DAT_DAT_Pos)                      /*!< UART_T::DAT: DAT Mask                  */
+
+#define UART_DAT_PARITY_Pos              (8)                                               /*!< UART_T::DAT: PARITY Position           */
+#define UART_DAT_PARITY_Msk              (0x1ul << UART_DAT_PARITY_Pos)                    /*!< UART_T::DAT: PARITY Mask               */
+
+#define UART_INTEN_RDAIEN_Pos            (0)                                               /*!< UART_T::INTEN: RDAIEN Position         */
+#define UART_INTEN_RDAIEN_Msk            (0x1ul << UART_INTEN_RDAIEN_Pos)                  /*!< UART_T::INTEN: RDAIEN Mask             */
+
+#define UART_INTEN_THREIEN_Pos           (1)                                               /*!< UART_T::INTEN: THREIEN Position        */
+#define UART_INTEN_THREIEN_Msk           (0x1ul << UART_INTEN_THREIEN_Pos)                 /*!< UART_T::INTEN: THREIEN Mask            */
+
+#define UART_INTEN_RLSIEN_Pos            (2)                                               /*!< UART_T::INTEN: RLSIEN Position         */
+#define UART_INTEN_RLSIEN_Msk            (0x1ul << UART_INTEN_RLSIEN_Pos)                  /*!< UART_T::INTEN: RLSIEN Mask             */
+
+#define UART_INTEN_MODEMIEN_Pos          (3)                                               /*!< UART_T::INTEN: MODEMIEN Position       */
+#define UART_INTEN_MODEMIEN_Msk          (0x1ul << UART_INTEN_MODEMIEN_Pos)                /*!< UART_T::INTEN: MODEMIEN Mask           */
+
+#define UART_INTEN_RXTOIEN_Pos           (4)                                               /*!< UART_T::INTEN: RXTOIEN Position        */
+#define UART_INTEN_RXTOIEN_Msk           (0x1ul << UART_INTEN_RXTOIEN_Pos)                 /*!< UART_T::INTEN: RXTOIEN Mask            */
+
+#define UART_INTEN_BUFERRIEN_Pos         (5)                                               /*!< UART_T::INTEN: BUFERRIEN Position      */
+#define UART_INTEN_BUFERRIEN_Msk         (0x1ul << UART_INTEN_BUFERRIEN_Pos)               /*!< UART_T::INTEN: BUFERRIEN Mask          */
+
+#define UART_INTEN_WKIEN_Pos             (6)                                               /*!< UART_T::INTEN: WKIEN Position          */
+#define UART_INTEN_WKIEN_Msk             (0x1ul << UART_INTEN_WKIEN_Pos)                   /*!< UART_T::INTEN: WKIEN Mask              */
+
+#define UART_INTEN_LINIEN_Pos            (8)                                               /*!< UART_T::INTEN: LINIEN Position         */
+#define UART_INTEN_LINIEN_Msk            (0x1ul << UART_INTEN_LINIEN_Pos)                  /*!< UART_T::INTEN: LINIEN Mask             */
+
+#define UART_INTEN_TOCNTEN_Pos           (11)                                              /*!< UART_T::INTEN: TOCNTEN Position        */
+#define UART_INTEN_TOCNTEN_Msk           (0x1ul << UART_INTEN_TOCNTEN_Pos)                 /*!< UART_T::INTEN: TOCNTEN Mask            */
+
+#define UART_INTEN_ATORTSEN_Pos          (12)                                              /*!< UART_T::INTEN: ATORTSEN Position       */
+#define UART_INTEN_ATORTSEN_Msk          (0x1ul << UART_INTEN_ATORTSEN_Pos)                /*!< UART_T::INTEN: ATORTSEN Mask           */
+
+#define UART_INTEN_ATOCTSEN_Pos          (13)                                              /*!< UART_T::INTEN: ATOCTSEN Position       */
+#define UART_INTEN_ATOCTSEN_Msk          (0x1ul << UART_INTEN_ATOCTSEN_Pos)                /*!< UART_T::INTEN: ATOCTSEN Mask           */
+
+#define UART_INTEN_TXPDMAEN_Pos          (14)                                              /*!< UART_T::INTEN: TXPDMAEN Position       */
+#define UART_INTEN_TXPDMAEN_Msk          (0x1ul << UART_INTEN_TXPDMAEN_Pos)                /*!< UART_T::INTEN: TXPDMAEN Mask           */
+
+#define UART_INTEN_RXPDMAEN_Pos          (15)                                              /*!< UART_T::INTEN: RXPDMAEN Position       */
+#define UART_INTEN_RXPDMAEN_Msk          (0x1ul << UART_INTEN_RXPDMAEN_Pos)                /*!< UART_T::INTEN: RXPDMAEN Mask           */
+
+#define UART_INTEN_ABRIEN_Pos            (18)                                              /*!< UART_T::INTEN: ABRIEN Position         */
+#define UART_INTEN_ABRIEN_Msk            (0x1ul << UART_INTEN_ABRIEN_Pos)                  /*!< UART_T::INTEN: ABRIEN Mask             */
+
+#define UART_INTEN_TXENDIEN_Pos          (22)                                              /*!< UART_T::INTEN: TXENDIEN Position       */
+#define UART_INTEN_TXENDIEN_Msk          (0x1ul << UART_INTEN_TXENDIEN_Pos)                /*!< UART_T::INTEN: TXENDIEN Mask           */
+
+#define UART_FIFO_RXRST_Pos              (1)                                               /*!< UART_T::FIFO: RXRST Position           */
+#define UART_FIFO_RXRST_Msk              (0x1ul << UART_FIFO_RXRST_Pos)                    /*!< UART_T::FIFO: RXRST Mask               */
+
+#define UART_FIFO_TXRST_Pos              (2)                                               /*!< UART_T::FIFO: TXRST Position           */
+#define UART_FIFO_TXRST_Msk              (0x1ul << UART_FIFO_TXRST_Pos)                    /*!< UART_T::FIFO: TXRST Mask               */
+
+#define UART_FIFO_RFITL_Pos              (4)                                               /*!< UART_T::FIFO: RFITL Position           */
+#define UART_FIFO_RFITL_Msk              (0xful << UART_FIFO_RFITL_Pos)                    /*!< UART_T::FIFO: RFITL Mask               */
+
+#define UART_FIFO_RXOFF_Pos              (8)                                               /*!< UART_T::FIFO: RXOFF Position           */
+#define UART_FIFO_RXOFF_Msk              (0x1ul << UART_FIFO_RXOFF_Pos)                    /*!< UART_T::FIFO: RXOFF Mask               */
+
+#define UART_FIFO_RTSTRGLV_Pos           (16)                                              /*!< UART_T::FIFO: RTSTRGLV Position        */
+#define UART_FIFO_RTSTRGLV_Msk           (0xful << UART_FIFO_RTSTRGLV_Pos)                 /*!< UART_T::FIFO: RTSTRGLV Mask            */
+
+#define UART_LINE_WLS_Pos                (0)                                               /*!< UART_T::LINE: WLS Position             */
+#define UART_LINE_WLS_Msk                (0x3ul << UART_LINE_WLS_Pos)                      /*!< UART_T::LINE: WLS Mask                 */
+
+#define UART_LINE_NSB_Pos                (2)                                               /*!< UART_T::LINE: NSB Position             */
+#define UART_LINE_NSB_Msk                (0x1ul << UART_LINE_NSB_Pos)                      /*!< UART_T::LINE: NSB Mask                 */
+
+#define UART_LINE_PBE_Pos                (3)                                               /*!< UART_T::LINE: PBE Position             */
+#define UART_LINE_PBE_Msk                (0x1ul << UART_LINE_PBE_Pos)                      /*!< UART_T::LINE: PBE Mask                 */
+
+#define UART_LINE_EPE_Pos                (4)                                               /*!< UART_T::LINE: EPE Position             */
+#define UART_LINE_EPE_Msk                (0x1ul << UART_LINE_EPE_Pos)                      /*!< UART_T::LINE: EPE Mask                 */
+
+#define UART_LINE_SPE_Pos                (5)                                               /*!< UART_T::LINE: SPE Position             */
+#define UART_LINE_SPE_Msk                (0x1ul << UART_LINE_SPE_Pos)                      /*!< UART_T::LINE: SPE Mask                 */
+
+#define UART_LINE_BCB_Pos                (6)                                               /*!< UART_T::LINE: BCB Position             */
+#define UART_LINE_BCB_Msk                (0x1ul << UART_LINE_BCB_Pos)                      /*!< UART_T::LINE: BCB Mask                 */
+
+#define UART_LINE_PSS_Pos                (7)                                               /*!< UART_T::LINE: PSS Position             */
+#define UART_LINE_PSS_Msk                (0x1ul << UART_LINE_PSS_Pos)                      /*!< UART_T::LINE: PSS Mask                 */
+
+#define UART_LINE_TXDINV_Pos             (8)                                               /*!< UART_T::LINE: TXDINV Position          */
+#define UART_LINE_TXDINV_Msk             (0x1ul << UART_LINE_TXDINV_Pos)                   /*!< UART_T::LINE: TXDINV Mask              */
+
+#define UART_LINE_RXDINV_Pos             (9)                                               /*!< UART_T::LINE: RXDINV Position          */
+#define UART_LINE_RXDINV_Msk             (0x1ul << UART_LINE_RXDINV_Pos)                   /*!< UART_T::LINE: RXDINV Mask              */
+
+#define UART_MODEM_RTS_Pos               (1)                                               /*!< UART_T::MODEM: RTS Position            */
+#define UART_MODEM_RTS_Msk               (0x1ul << UART_MODEM_RTS_Pos)                     /*!< UART_T::MODEM: RTS Mask                */
+
+#define UART_MODEM_RTSACTLV_Pos          (9)                                               /*!< UART_T::MODEM: RTSACTLV Position       */
+#define UART_MODEM_RTSACTLV_Msk          (0x1ul << UART_MODEM_RTSACTLV_Pos)                /*!< UART_T::MODEM: RTSACTLV Mask           */
+
+#define UART_MODEM_RTSSTS_Pos            (13)                                              /*!< UART_T::MODEM: RTSSTS Position         */
+#define UART_MODEM_RTSSTS_Msk            (0x1ul << UART_MODEM_RTSSTS_Pos)                  /*!< UART_T::MODEM: RTSSTS Mask             */
+
+#define UART_MODEMSTS_CTSDETF_Pos        (0)                                               /*!< UART_T::MODEMSTS: CTSDETF Position     */
+#define UART_MODEMSTS_CTSDETF_Msk        (0x1ul << UART_MODEMSTS_CTSDETF_Pos)              /*!< UART_T::MODEMSTS: CTSDETF Mask         */
+
+#define UART_MODEMSTS_CTSSTS_Pos         (4)                                               /*!< UART_T::MODEMSTS: CTSSTS Position      */
+#define UART_MODEMSTS_CTSSTS_Msk         (0x1ul << UART_MODEMSTS_CTSSTS_Pos)               /*!< UART_T::MODEMSTS: CTSSTS Mask          */
+
+#define UART_MODEMSTS_CTSACTLV_Pos       (8)                                               /*!< UART_T::MODEMSTS: CTSACTLV Position    */
+#define UART_MODEMSTS_CTSACTLV_Msk       (0x1ul << UART_MODEMSTS_CTSACTLV_Pos)             /*!< UART_T::MODEMSTS: CTSACTLV Mask        */
+
+#define UART_FIFOSTS_RXOVIF_Pos          (0)                                               /*!< UART_T::FIFOSTS: RXOVIF Position       */
+#define UART_FIFOSTS_RXOVIF_Msk          (0x1ul << UART_FIFOSTS_RXOVIF_Pos)                /*!< UART_T::FIFOSTS: RXOVIF Mask           */
+
+#define UART_FIFOSTS_ABRDIF_Pos          (1)                                               /*!< UART_T::FIFOSTS: ABRDIF Position       */
+#define UART_FIFOSTS_ABRDIF_Msk          (0x1ul << UART_FIFOSTS_ABRDIF_Pos)                /*!< UART_T::FIFOSTS: ABRDIF Mask           */
+
+#define UART_FIFOSTS_ABRDTOIF_Pos        (2)                                               /*!< UART_T::FIFOSTS: ABRDTOIF Position     */
+#define UART_FIFOSTS_ABRDTOIF_Msk        (0x1ul << UART_FIFOSTS_ABRDTOIF_Pos)              /*!< UART_T::FIFOSTS: ABRDTOIF Mask         */
+
+#define UART_FIFOSTS_ADDRDETF_Pos        (3)                                               /*!< UART_T::FIFOSTS: ADDRDETF Position     */
+#define UART_FIFOSTS_ADDRDETF_Msk        (0x1ul << UART_FIFOSTS_ADDRDETF_Pos)              /*!< UART_T::FIFOSTS: ADDRDETF Mask         */
+
+#define UART_FIFOSTS_PEF_Pos             (4)                                               /*!< UART_T::FIFOSTS: PEF Position          */
+#define UART_FIFOSTS_PEF_Msk             (0x1ul << UART_FIFOSTS_PEF_Pos)                   /*!< UART_T::FIFOSTS: PEF Mask              */
+
+#define UART_FIFOSTS_FEF_Pos             (5)                                               /*!< UART_T::FIFOSTS: FEF Position          */
+#define UART_FIFOSTS_FEF_Msk             (0x1ul << UART_FIFOSTS_FEF_Pos)                   /*!< UART_T::FIFOSTS: FEF Mask              */
+
+#define UART_FIFOSTS_BIF_Pos             (6)                                               /*!< UART_T::FIFOSTS: BIF Position          */
+#define UART_FIFOSTS_BIF_Msk             (0x1ul << UART_FIFOSTS_BIF_Pos)                   /*!< UART_T::FIFOSTS: BIF Mask              */
+
+#define UART_FIFOSTS_RXPTR_Pos           (8)                                               /*!< UART_T::FIFOSTS: RXPTR Position        */
+#define UART_FIFOSTS_RXPTR_Msk           (0x3ful << UART_FIFOSTS_RXPTR_Pos)                /*!< UART_T::FIFOSTS: RXPTR Mask            */
+
+#define UART_FIFOSTS_RXEMPTY_Pos         (14)                                              /*!< UART_T::FIFOSTS: RXEMPTY Position      */
+#define UART_FIFOSTS_RXEMPTY_Msk         (0x1ul << UART_FIFOSTS_RXEMPTY_Pos)               /*!< UART_T::FIFOSTS: RXEMPTY Mask          */
+
+#define UART_FIFOSTS_RXFULL_Pos          (15)                                              /*!< UART_T::FIFOSTS: RXFULL Position       */
+#define UART_FIFOSTS_RXFULL_Msk          (0x1ul << UART_FIFOSTS_RXFULL_Pos)                /*!< UART_T::FIFOSTS: RXFULL Mask           */
+
+#define UART_FIFOSTS_TXPTR_Pos           (16)                                              /*!< UART_T::FIFOSTS: TXPTR Position        */
+#define UART_FIFOSTS_TXPTR_Msk           (0x3ful << UART_FIFOSTS_TXPTR_Pos)                /*!< UART_T::FIFOSTS: TXPTR Mask            */
+
+#define UART_FIFOSTS_TXEMPTY_Pos         (22)                                              /*!< UART_T::FIFOSTS: TXEMPTY Position      */
+#define UART_FIFOSTS_TXEMPTY_Msk         (0x1ul << UART_FIFOSTS_TXEMPTY_Pos)               /*!< UART_T::FIFOSTS: TXEMPTY Mask          */
+
+#define UART_FIFOSTS_TXFULL_Pos          (23)                                              /*!< UART_T::FIFOSTS: TXFULL Position       */
+#define UART_FIFOSTS_TXFULL_Msk          (0x1ul << UART_FIFOSTS_TXFULL_Pos)                /*!< UART_T::FIFOSTS: TXFULL Mask           */
+
+#define UART_FIFOSTS_TXOVIF_Pos          (24)                                              /*!< UART_T::FIFOSTS: TXOVIF Position       */
+#define UART_FIFOSTS_TXOVIF_Msk          (0x1ul << UART_FIFOSTS_TXOVIF_Pos)                /*!< UART_T::FIFOSTS: TXOVIF Mask           */
+
+#define UART_FIFOSTS_TXEMPTYF_Pos        (28)                                              /*!< UART_T::FIFOSTS: TXEMPTYF Position     */
+#define UART_FIFOSTS_TXEMPTYF_Msk        (0x1ul << UART_FIFOSTS_TXEMPTYF_Pos)              /*!< UART_T::FIFOSTS: TXEMPTYF Mask         */
+
+#define UART_FIFOSTS_RXIDLE_Pos          (29)                                              /*!< UART_T::FIFOSTS: RXIDLE Position       */
+#define UART_FIFOSTS_RXIDLE_Msk          (0x1ul << UART_FIFOSTS_RXIDLE_Pos)                /*!< UART_T::FIFOSTS: RXIDLE Mask           */
+
+#define UART_FIFOSTS_TXRXACT_Pos         (31)                                              /*!< UART_T::FIFOSTS: TXRXACT Position      */
+#define UART_FIFOSTS_TXRXACT_Msk         (0x1ul << UART_FIFOSTS_TXRXACT_Pos)               /*!< UART_T::FIFOSTS: TXRXACT Mask          */
+
+#define UART_INTSTS_RDAIF_Pos            (0)                                               /*!< UART_T::INTSTS: RDAIF Position         */
+#define UART_INTSTS_RDAIF_Msk            (0x1ul << UART_INTSTS_RDAIF_Pos)                  /*!< UART_T::INTSTS: RDAIF Mask             */
+
+#define UART_INTSTS_THREIF_Pos           (1)                                               /*!< UART_T::INTSTS: THREIF Position        */
+#define UART_INTSTS_THREIF_Msk           (0x1ul << UART_INTSTS_THREIF_Pos)                 /*!< UART_T::INTSTS: THREIF Mask            */
+
+#define UART_INTSTS_RLSIF_Pos            (2)                                               /*!< UART_T::INTSTS: RLSIF Position         */
+#define UART_INTSTS_RLSIF_Msk            (0x1ul << UART_INTSTS_RLSIF_Pos)                  /*!< UART_T::INTSTS: RLSIF Mask             */
+
+#define UART_INTSTS_MODEMIF_Pos          (3)                                               /*!< UART_T::INTSTS: MODEMIF Position       */
+#define UART_INTSTS_MODEMIF_Msk          (0x1ul << UART_INTSTS_MODEMIF_Pos)                /*!< UART_T::INTSTS: MODEMIF Mask           */
+
+#define UART_INTSTS_RXTOIF_Pos           (4)                                               /*!< UART_T::INTSTS: RXTOIF Position        */
+#define UART_INTSTS_RXTOIF_Msk           (0x1ul << UART_INTSTS_RXTOIF_Pos)                 /*!< UART_T::INTSTS: RXTOIF Mask            */
+
+#define UART_INTSTS_BUFERRIF_Pos         (5)                                               /*!< UART_T::INTSTS: BUFERRIF Position      */
+#define UART_INTSTS_BUFERRIF_Msk         (0x1ul << UART_INTSTS_BUFERRIF_Pos)               /*!< UART_T::INTSTS: BUFERRIF Mask          */
+
+#define UART_INTSTS_WKIF_Pos             (6)                                               /*!< UART_T::INTSTS: WKIF Position          */
+#define UART_INTSTS_WKIF_Msk             (0x1ul << UART_INTSTS_WKIF_Pos)                   /*!< UART_T::INTSTS: WKIF Mask              */
+
+#define UART_INTSTS_LINIF_Pos            (7)                                               /*!< UART_T::INTSTS: LINIF Position         */
+#define UART_INTSTS_LINIF_Msk            (0x1ul << UART_INTSTS_LINIF_Pos)                  /*!< UART_T::INTSTS: LINIF Mask             */
+
+#define UART_INTSTS_RDAINT_Pos           (8)                                               /*!< UART_T::INTSTS: RDAINT Position        */
+#define UART_INTSTS_RDAINT_Msk           (0x1ul << UART_INTSTS_RDAINT_Pos)                 /*!< UART_T::INTSTS: RDAINT Mask            */
+
+#define UART_INTSTS_THREINT_Pos          (9)                                               /*!< UART_T::INTSTS: THREINT Position       */
+#define UART_INTSTS_THREINT_Msk          (0x1ul << UART_INTSTS_THREINT_Pos)                /*!< UART_T::INTSTS: THREINT Mask           */
+
+#define UART_INTSTS_RLSINT_Pos           (10)                                              /*!< UART_T::INTSTS: RLSINT Position        */
+#define UART_INTSTS_RLSINT_Msk           (0x1ul << UART_INTSTS_RLSINT_Pos)                 /*!< UART_T::INTSTS: RLSINT Mask            */
+
+#define UART_INTSTS_MODEMINT_Pos         (11)                                              /*!< UART_T::INTSTS: MODEMINT Position      */
+#define UART_INTSTS_MODEMINT_Msk         (0x1ul << UART_INTSTS_MODEMINT_Pos)               /*!< UART_T::INTSTS: MODEMINT Mask          */
+
+#define UART_INTSTS_RXTOINT_Pos          (12)                                              /*!< UART_T::INTSTS: RXTOINT Position       */
+#define UART_INTSTS_RXTOINT_Msk          (0x1ul << UART_INTSTS_RXTOINT_Pos)                /*!< UART_T::INTSTS: RXTOINT Mask           */
+
+#define UART_INTSTS_BUFERRINT_Pos        (13)                                              /*!< UART_T::INTSTS: BUFERRINT Position     */
+#define UART_INTSTS_BUFERRINT_Msk        (0x1ul << UART_INTSTS_BUFERRINT_Pos)              /*!< UART_T::INTSTS: BUFERRINT Mask         */
+
+#define UART_INTSTS_WKINT_Pos            (14)                                              /*!< UART_T::INTSTS: WKINT Position         */
+#define UART_INTSTS_WKINT_Msk            (0x1ul << UART_INTSTS_WKINT_Pos)                  /*!< UART_T::INTSTS: WKINT Mask             */
+
+#define UART_INTSTS_LININT_Pos           (15)                                              /*!< UART_T::INTSTS: LININT Position        */
+#define UART_INTSTS_LININT_Msk           (0x1ul << UART_INTSTS_LININT_Pos)                 /*!< UART_T::INTSTS: LININT Mask            */
+
+#define UART_INTSTS_HWRLSIF_Pos          (18)                                              /*!< UART_T::INTSTS: HWRLSIF Position       */
+#define UART_INTSTS_HWRLSIF_Msk          (0x1ul << UART_INTSTS_HWRLSIF_Pos)                /*!< UART_T::INTSTS: HWRLSIF Mask           */
+
+#define UART_INTSTS_HWMODIF_Pos          (19)                                              /*!< UART_T::INTSTS: HWMODIF Position       */
+#define UART_INTSTS_HWMODIF_Msk          (0x1ul << UART_INTSTS_HWMODIF_Pos)                /*!< UART_T::INTSTS: HWMODIF Mask           */
+
+#define UART_INTSTS_HWTOIF_Pos           (20)                                              /*!< UART_T::INTSTS: HWTOIF Position        */
+#define UART_INTSTS_HWTOIF_Msk           (0x1ul << UART_INTSTS_HWTOIF_Pos)                 /*!< UART_T::INTSTS: HWTOIF Mask            */
+
+#define UART_INTSTS_HWBUFEIF_Pos         (21)                                              /*!< UART_T::INTSTS: HWBUFEIF Position      */
+#define UART_INTSTS_HWBUFEIF_Msk         (0x1ul << UART_INTSTS_HWBUFEIF_Pos)               /*!< UART_T::INTSTS: HWBUFEIF Mask          */
+
+#define UART_INTSTS_TXENDIF_Pos          (22)                                              /*!< UART_T::INTSTS: TXENDIF Position       */
+#define UART_INTSTS_TXENDIF_Msk          (0x1ul << UART_INTSTS_TXENDIF_Pos)                /*!< UART_T::INTSTS: TXENDIF Mask           */
+
+#define UART_INTSTS_HWRLSINT_Pos         (26)                                              /*!< UART_T::INTSTS: HWRLSINT Position      */
+#define UART_INTSTS_HWRLSINT_Msk         (0x1ul << UART_INTSTS_HWRLSINT_Pos)               /*!< UART_T::INTSTS: HWRLSINT Mask          */
+
+#define UART_INTSTS_HWMODINT_Pos         (27)                                              /*!< UART_T::INTSTS: HWMODINT Position      */
+#define UART_INTSTS_HWMODINT_Msk         (0x1ul << UART_INTSTS_HWMODINT_Pos)               /*!< UART_T::INTSTS: HWMODINT Mask          */
+
+#define UART_INTSTS_HWTOINT_Pos          (28)                                              /*!< UART_T::INTSTS: HWTOINT Position       */
+#define UART_INTSTS_HWTOINT_Msk          (0x1ul << UART_INTSTS_HWTOINT_Pos)                /*!< UART_T::INTSTS: HWTOINT Mask           */
+
+#define UART_INTSTS_HWBUFEINT_Pos        (29)                                              /*!< UART_T::INTSTS: HWBUFEINT Position     */
+#define UART_INTSTS_HWBUFEINT_Msk        (0x1ul << UART_INTSTS_HWBUFEINT_Pos)              /*!< UART_T::INTSTS: HWBUFEINT Mask         */
+
+#define UART_INTSTS_TXENDINT_Pos         (30)                                              /*!< UART_T::INTSTS: TXENDINT Position      */
+#define UART_INTSTS_TXENDINT_Msk         (0x1ul << UART_INTSTS_TXENDINT_Pos)               /*!< UART_T::INTSTS: TXENDINT Mask          */
+
+#define UART_INTSTS_ABRINT_Pos           (31)                                              /*!< UART_T::INTSTS: ABRINT Position        */
+#define UART_INTSTS_ABRINT_Msk           (0x1ul << UART_INTSTS_ABRINT_Pos)                 /*!< UART_T::INTSTS: ABRINT Mask            */
+
+#define UART_TOUT_TOIC_Pos               (0)                                               /*!< UART_T::TOUT: TOIC Position            */
+#define UART_TOUT_TOIC_Msk               (0xfful << UART_TOUT_TOIC_Pos)                    /*!< UART_T::TOUT: TOIC Mask                */
+
+#define UART_TOUT_DLY_Pos                (8)                                               /*!< UART_T::TOUT: DLY Position             */
+#define UART_TOUT_DLY_Msk                (0xfful << UART_TOUT_DLY_Pos)                     /*!< UART_T::TOUT: DLY Mask                 */
+
+#define UART_BAUD_BRD_Pos                (0)                                               /*!< UART_T::BAUD: BRD Position             */
+#define UART_BAUD_BRD_Msk                (0xfffful << UART_BAUD_BRD_Pos)                   /*!< UART_T::BAUD: BRD Mask                 */
+
+#define UART_BAUD_EDIVM1_Pos             (24)                                              /*!< UART_T::BAUD: EDIVM1 Position          */
+#define UART_BAUD_EDIVM1_Msk             (0xful << UART_BAUD_EDIVM1_Pos)                   /*!< UART_T::BAUD: EDIVM1 Mask              */
+
+#define UART_BAUD_BAUDM0_Pos             (28)                                              /*!< UART_T::BAUD: BAUDM0 Position          */
+#define UART_BAUD_BAUDM0_Msk             (0x1ul << UART_BAUD_BAUDM0_Pos)                   /*!< UART_T::BAUD: BAUDM0 Mask              */
+
+#define UART_BAUD_BAUDM1_Pos             (29)                                              /*!< UART_T::BAUD: BAUDM1 Position          */
+#define UART_BAUD_BAUDM1_Msk             (0x1ul << UART_BAUD_BAUDM1_Pos)                   /*!< UART_T::BAUD: BAUDM1 Mask              */
+
+#define UART_IRDA_TXEN_Pos               (1)                                               /*!< UART_T::IRDA: TXEN Position            */
+#define UART_IRDA_TXEN_Msk               (0x1ul << UART_IRDA_TXEN_Pos)                     /*!< UART_T::IRDA: TXEN Mask                */
+
+#define UART_IRDA_TXINV_Pos              (5)                                               /*!< UART_T::IRDA: TXINV Position           */
+#define UART_IRDA_TXINV_Msk              (0x1ul << UART_IRDA_TXINV_Pos)                    /*!< UART_T::IRDA: TXINV Mask               */
+
+#define UART_IRDA_RXINV_Pos              (6)                                               /*!< UART_T::IRDA: RXINV Position           */
+#define UART_IRDA_RXINV_Msk              (0x1ul << UART_IRDA_RXINV_Pos)                    /*!< UART_T::IRDA: RXINV Mask               */
+
+#define UART_ALTCTL_BRKFL_Pos            (0)                                               /*!< UART_T::ALTCTL: BRKFL Position         */
+#define UART_ALTCTL_BRKFL_Msk            (0xful << UART_ALTCTL_BRKFL_Pos)                  /*!< UART_T::ALTCTL: BRKFL Mask             */
+
+#define UART_ALTCTL_LINRXEN_Pos          (6)                                               /*!< UART_T::ALTCTL: LINRXEN Position       */
+#define UART_ALTCTL_LINRXEN_Msk          (0x1ul << UART_ALTCTL_LINRXEN_Pos)                /*!< UART_T::ALTCTL: LINRXEN Mask           */
+
+#define UART_ALTCTL_LINTXEN_Pos          (7)                                               /*!< UART_T::ALTCTL: LINTXEN Position       */
+#define UART_ALTCTL_LINTXEN_Msk          (0x1ul << UART_ALTCTL_LINTXEN_Pos)                /*!< UART_T::ALTCTL: LINTXEN Mask           */
+
+#define UART_ALTCTL_RS485NMM_Pos         (8)                                               /*!< UART_T::ALTCTL: RS485NMM Position      */
+#define UART_ALTCTL_RS485NMM_Msk         (0x1ul << UART_ALTCTL_RS485NMM_Pos)               /*!< UART_T::ALTCTL: RS485NMM Mask          */
+
+#define UART_ALTCTL_RS485AAD_Pos         (9)                                               /*!< UART_T::ALTCTL: RS485AAD Position      */
+#define UART_ALTCTL_RS485AAD_Msk         (0x1ul << UART_ALTCTL_RS485AAD_Pos)               /*!< UART_T::ALTCTL: RS485AAD Mask          */
+
+#define UART_ALTCTL_RS485AUD_Pos         (10)                                              /*!< UART_T::ALTCTL: RS485AUD Position      */
+#define UART_ALTCTL_RS485AUD_Msk         (0x1ul << UART_ALTCTL_RS485AUD_Pos)               /*!< UART_T::ALTCTL: RS485AUD Mask          */
+
+#define UART_ALTCTL_ADDRDEN_Pos          (15)                                              /*!< UART_T::ALTCTL: ADDRDEN Position       */
+#define UART_ALTCTL_ADDRDEN_Msk          (0x1ul << UART_ALTCTL_ADDRDEN_Pos)                /*!< UART_T::ALTCTL: ADDRDEN Mask           */
+
+#define UART_ALTCTL_ABRIF_Pos            (17)                                              /*!< UART_T::ALTCTL: ABRIF Position         */
+#define UART_ALTCTL_ABRIF_Msk            (0x1ul << UART_ALTCTL_ABRIF_Pos)                  /*!< UART_T::ALTCTL: ABRIF Mask             */
+
+#define UART_ALTCTL_ABRDEN_Pos           (18)                                              /*!< UART_T::ALTCTL: ABRDEN Position        */
+#define UART_ALTCTL_ABRDEN_Msk           (0x1ul << UART_ALTCTL_ABRDEN_Pos)                 /*!< UART_T::ALTCTL: ABRDEN Mask            */
+
+#define UART_ALTCTL_ABRDBITS_Pos         (19)                                              /*!< UART_T::ALTCTL: ABRDBITS Position      */
+#define UART_ALTCTL_ABRDBITS_Msk         (0x3ul << UART_ALTCTL_ABRDBITS_Pos)               /*!< UART_T::ALTCTL: ABRDBITS Mask          */
+
+#define UART_ALTCTL_ADDRMV_Pos           (24)                                              /*!< UART_T::ALTCTL: ADDRMV Position        */
+#define UART_ALTCTL_ADDRMV_Msk           (0xfful << UART_ALTCTL_ADDRMV_Pos)                /*!< UART_T::ALTCTL: ADDRMV Mask            */
+
+#define UART_FUNCSEL_FUNCSEL_Pos         (0)                                               /*!< UART_T::FUNCSEL: FUNCSEL Position      */
+#define UART_FUNCSEL_FUNCSEL_Msk         (0x3ul << UART_FUNCSEL_FUNCSEL_Pos)               /*!< UART_T::FUNCSEL: FUNCSEL Mask          */
+
+#define UART_FUNCSEL_TXRXDIS_Pos         (3)                                               /*!< UART_T::FUNCSEL: TXRXDIS Position      */
+#define UART_FUNCSEL_TXRXDIS_Msk         (0x1ul << UART_FUNCSEL_TXRXDIS_Pos)               /*!< UART_T::FUNCSEL: TXRXDIS Mask          */
+
+#define UART_LINCTL_SLVEN_Pos            (0)                                               /*!< UART_T::LINCTL: SLVEN Position         */
+#define UART_LINCTL_SLVEN_Msk            (0x1ul << UART_LINCTL_SLVEN_Pos)                  /*!< UART_T::LINCTL: SLVEN Mask             */
+
+#define UART_LINCTL_SLVHDEN_Pos          (1)                                               /*!< UART_T::LINCTL: SLVHDEN Position       */
+#define UART_LINCTL_SLVHDEN_Msk          (0x1ul << UART_LINCTL_SLVHDEN_Pos)                /*!< UART_T::LINCTL: SLVHDEN Mask           */
+
+#define UART_LINCTL_SLVAREN_Pos          (2)                                               /*!< UART_T::LINCTL: SLVAREN Position       */
+#define UART_LINCTL_SLVAREN_Msk          (0x1ul << UART_LINCTL_SLVAREN_Pos)                /*!< UART_T::LINCTL: SLVAREN Mask           */
+
+#define UART_LINCTL_SLVDUEN_Pos          (3)                                               /*!< UART_T::LINCTL: SLVDUEN Position       */
+#define UART_LINCTL_SLVDUEN_Msk          (0x1ul << UART_LINCTL_SLVDUEN_Pos)                /*!< UART_T::LINCTL: SLVDUEN Mask           */
+
+#define UART_LINCTL_MUTE_Pos             (4)                                               /*!< UART_T::LINCTL: MUTE Position          */
+#define UART_LINCTL_MUTE_Msk             (0x1ul << UART_LINCTL_MUTE_Pos)                   /*!< UART_T::LINCTL: MUTE Mask              */
+
+#define UART_LINCTL_SENDH_Pos            (8)                                               /*!< UART_T::LINCTL: SENDH Position         */
+#define UART_LINCTL_SENDH_Msk            (0x1ul << UART_LINCTL_SENDH_Pos)                  /*!< UART_T::LINCTL: SENDH Mask             */
+
+#define UART_LINCTL_IDPEN_Pos            (9)                                               /*!< UART_T::LINCTL: IDPEN Position         */
+#define UART_LINCTL_IDPEN_Msk            (0x1ul << UART_LINCTL_IDPEN_Pos)                  /*!< UART_T::LINCTL: IDPEN Mask             */
+
+#define UART_LINCTL_BRKDETEN_Pos         (10)                                              /*!< UART_T::LINCTL: BRKDETEN Position      */
+#define UART_LINCTL_BRKDETEN_Msk         (0x1ul << UART_LINCTL_BRKDETEN_Pos)               /*!< UART_T::LINCTL: BRKDETEN Mask          */
+
+#define UART_LINCTL_LINRXOFF_Pos         (11)                                              /*!< UART_T::LINCTL: LINRXOFF Position      */
+#define UART_LINCTL_LINRXOFF_Msk         (0x1ul << UART_LINCTL_LINRXOFF_Pos)               /*!< UART_T::LINCTL: LINRXOFF Mask          */
+
+#define UART_LINCTL_BITERREN_Pos         (12)                                              /*!< UART_T::LINCTL: BITERREN Position      */
+#define UART_LINCTL_BITERREN_Msk         (0x1ul << UART_LINCTL_BITERREN_Pos)               /*!< UART_T::LINCTL: BITERREN Mask          */
+
+#define UART_LINCTL_BRKFL_Pos            (16)                                              /*!< UART_T::LINCTL: BRKFL Position         */
+#define UART_LINCTL_BRKFL_Msk            (0xful << UART_LINCTL_BRKFL_Pos)                  /*!< UART_T::LINCTL: BRKFL Mask             */
+
+#define UART_LINCTL_BSL_Pos              (20)                                              /*!< UART_T::LINCTL: BSL Position           */
+#define UART_LINCTL_BSL_Msk              (0x3ul << UART_LINCTL_BSL_Pos)                    /*!< UART_T::LINCTL: BSL Mask               */
+
+#define UART_LINCTL_HSEL_Pos             (22)                                              /*!< UART_T::LINCTL: HSEL Position          */
+#define UART_LINCTL_HSEL_Msk             (0x3ul << UART_LINCTL_HSEL_Pos)                   /*!< UART_T::LINCTL: HSEL Mask              */
+
+#define UART_LINCTL_PID_Pos              (24)                                              /*!< UART_T::LINCTL: PID Position           */
+#define UART_LINCTL_PID_Msk              (0xfful << UART_LINCTL_PID_Pos)                   /*!< UART_T::LINCTL: PID Mask               */
+
+#define UART_LINSTS_SLVHDETF_Pos         (0)                                               /*!< UART_T::LINSTS: SLVHDETF Position      */
+#define UART_LINSTS_SLVHDETF_Msk         (0x1ul << UART_LINSTS_SLVHDETF_Pos)               /*!< UART_T::LINSTS: SLVHDETF Mask          */
+
+#define UART_LINSTS_SLVHEF_Pos           (1)                                               /*!< UART_T::LINSTS: SLVHEF Position        */
+#define UART_LINSTS_SLVHEF_Msk           (0x1ul << UART_LINSTS_SLVHEF_Pos)                 /*!< UART_T::LINSTS: SLVHEF Mask            */
+
+#define UART_LINSTS_SLVIDPEF_Pos         (2)                                               /*!< UART_T::LINSTS: SLVIDPEF Position      */
+#define UART_LINSTS_SLVIDPEF_Msk         (0x1ul << UART_LINSTS_SLVIDPEF_Pos)               /*!< UART_T::LINSTS: SLVIDPEF Mask          */
+
+#define UART_LINSTS_SLVSYNCF_Pos         (3)                                               /*!< UART_T::LINSTS: SLVSYNCF Position      */
+#define UART_LINSTS_SLVSYNCF_Msk         (0x1ul << UART_LINSTS_SLVSYNCF_Pos)               /*!< UART_T::LINSTS: SLVSYNCF Mask          */
+
+#define UART_LINSTS_BRKDETF_Pos          (8)                                               /*!< UART_T::LINSTS: BRKDETF Position       */
+#define UART_LINSTS_BRKDETF_Msk          (0x1ul << UART_LINSTS_BRKDETF_Pos)                /*!< UART_T::LINSTS: BRKDETF Mask           */
+
+#define UART_LINSTS_BITEF_Pos            (9)                                               /*!< UART_T::LINSTS: BITEF Position         */
+#define UART_LINSTS_BITEF_Msk            (0x1ul << UART_LINSTS_BITEF_Pos)                  /*!< UART_T::LINSTS: BITEF Mask             */
+
+#define UART_BRCOMP_BRCOMP_Pos           (0)                                               /*!< UART_T::BRCOMP: BRCOMP Position        */
+#define UART_BRCOMP_BRCOMP_Msk           (0x1fful << UART_BRCOMP_BRCOMP_Pos)               /*!< UART_T::BRCOMP: BRCOMP Mask            */
+
+#define UART_BRCOMP_BRCOMPDEC_Pos        (31)                                              /*!< UART_T::BRCOMP: BRCOMPDEC Position     */
+#define UART_BRCOMP_BRCOMPDEC_Msk        (0x1ul << UART_BRCOMP_BRCOMPDEC_Pos)              /*!< UART_T::BRCOMP: BRCOMPDEC Mask         */
+
+#define UART_WKCTL_WKCTSEN_Pos           (0)                                               /*!< UART_T::WKCTL: WKCTSEN Position        */
+#define UART_WKCTL_WKCTSEN_Msk           (0x1ul << UART_WKCTL_WKCTSEN_Pos)                 /*!< UART_T::WKCTL: WKCTSEN Mask            */
+
+#define UART_WKCTL_WKDATEN_Pos           (1)                                               /*!< UART_T::WKCTL: WKDATEN Position        */
+#define UART_WKCTL_WKDATEN_Msk           (0x1ul << UART_WKCTL_WKDATEN_Pos)                 /*!< UART_T::WKCTL: WKDATEN Mask            */
+
+#define UART_WKCTL_WKRFRTEN_Pos          (2)                                               /*!< UART_T::WKCTL: WKRFRTEN Position       */
+#define UART_WKCTL_WKRFRTEN_Msk          (0x1ul << UART_WKCTL_WKRFRTEN_Pos)                /*!< UART_T::WKCTL: WKRFRTEN Mask           */
+
+#define UART_WKCTL_WKRS485EN_Pos         (3)                                               /*!< UART_T::WKCTL: WKRS485EN Position      */
+#define UART_WKCTL_WKRS485EN_Msk         (0x1ul << UART_WKCTL_WKRS485EN_Pos)               /*!< UART_T::WKCTL: WKRS485EN Mask          */
+
+#define UART_WKCTL_WKTOUTEN_Pos          (4)                                               /*!< UART_T::WKCTL: WKTOUTEN Position       */
+#define UART_WKCTL_WKTOUTEN_Msk          (0x1ul << UART_WKCTL_WKTOUTEN_Pos)                /*!< UART_T::WKCTL: WKTOUTEN Mask           */
+
+#define UART_WKSTS_CTSWKF_Pos            (0)                                               /*!< UART_T::WKSTS: CTSWKF Position         */
+#define UART_WKSTS_CTSWKF_Msk            (0x1ul << UART_WKSTS_CTSWKF_Pos)                  /*!< UART_T::WKSTS: CTSWKF Mask             */
+
+#define UART_WKSTS_DATWKF_Pos            (1)                                               /*!< UART_T::WKSTS: DATWKF Position         */
+#define UART_WKSTS_DATWKF_Msk            (0x1ul << UART_WKSTS_DATWKF_Pos)                  /*!< UART_T::WKSTS: DATWKF Mask             */
+
+#define UART_WKSTS_RFRTWKF_Pos           (2)                                               /*!< UART_T::WKSTS: RFRTWKF Position        */
+#define UART_WKSTS_RFRTWKF_Msk           (0x1ul << UART_WKSTS_RFRTWKF_Pos)                 /*!< UART_T::WKSTS: RFRTWKF Mask            */
+
+#define UART_WKSTS_RS485WKF_Pos          (3)                                               /*!< UART_T::WKSTS: RS485WKF Position       */
+#define UART_WKSTS_RS485WKF_Msk          (0x1ul << UART_WKSTS_RS485WKF_Pos)                /*!< UART_T::WKSTS: RS485WKF Mask           */
+
+#define UART_WKSTS_TOUTWKF_Pos           (4)                                               /*!< UART_T::WKSTS: TOUTWKF Position        */
+#define UART_WKSTS_TOUTWKF_Msk           (0x1ul << UART_WKSTS_TOUTWKF_Pos)                 /*!< UART_T::WKSTS: TOUTWKF Mask            */
+
+#define UART_DWKCOMP_STCOMP_Pos          (0)                                               /*!< UART_T::DWKCOMP: STCOMP Position       */
+#define UART_DWKCOMP_STCOMP_Msk          (0xfffful << UART_DWKCOMP_STCOMP_Pos)             /*!< UART_T::DWKCOMP: STCOMP Mask           */
+
+
+#define UART0                 ((UART_T *)   UART0_BA)
+#define UART1                 ((UART_T *)   UART1_BA)
+#define UART2                 ((UART_T *)   UART2_BA)
+#define UART3                 ((UART_T *)   UART3_BA)
+#define UART4                 ((UART_T *)   UART4_BA)
+#define UART5                 ((UART_T *)   UART5_BA)
+#define UART6                 ((UART_T *)   UART6_BA)
+#define UART7                 ((UART_T *)   UART7_BA)
+#define UART8                 ((UART_T *)   UART8_BA)
+#define UART9                 ((UART_T *)   UART9_BA)
+
+
+/** @addtogroup UART_EXPORTED_FUNCTIONS UART Exported Functions
+  @{
+*/
+
+
+/**
+ *    @brief        Calculate UART baudrate mode0 divider
+ *
+ *    @param[in]    u32SrcFreq      UART clock frequency
+ *    @param[in]    u32BaudRate     Baudrate of UART module
+ *
+ *    @return       UART baudrate mode0 divider
+ *
+ *    @details      This macro calculate UART baudrate mode0 divider.
+ *    \hideinitializer
+ */
+#define UART_BAUD_MODE0_DIVIDER(u32SrcFreq, u32BaudRate)    ((((u32SrcFreq) + ((u32BaudRate)*8ul)) / (u32BaudRate) >> 4ul)-2ul)
+
+
+/**
+ *    @brief        Calculate UART baudrate mode2 divider
+ *
+ *    @param[in]    u32SrcFreq      UART clock frequency
+ *    @param[in]    u32BaudRate     Baudrate of UART module
+ *
+ *    @return       UART baudrate mode2 divider
+ *
+ *    @details      This macro calculate UART baudrate mode2 divider.
+ *    \hideinitializer
+ */
+#define UART_BAUD_MODE2_DIVIDER(u32SrcFreq, u32BaudRate)    ((((u32SrcFreq) + ((u32BaudRate)/2ul)) / (u32BaudRate))-2ul)
+
+
+/**
+ *    @brief        Write UART data
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *    @param[in]    u8Data  Data byte to transmit.
+ *
+ *    @return       None
+ *
+ *    @details      This macro write Data to Tx data register.
+ *    \hideinitializer
+ */
+#define UART_WRITE(uart, u8Data)    ((uart)->DAT = (u8Data))
+
+
+/**
+ *    @brief        Read UART data
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @return       The oldest data byte in RX FIFO.
+ *
+ *    @details      This macro read Rx data register.
+ *    \hideinitializer
+ */
+#define UART_READ(uart)    ((uart)->DAT)
+
+
+/**
+ *    @brief        Get Tx empty
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       0   Tx FIFO is not empty
+ *    @retval       >=1 Tx FIFO is empty
+ *
+ *    @details      This macro get Transmitter FIFO empty register value.
+ *    \hideinitializer
+ */
+#define UART_GET_TX_EMPTY(uart)    ((uart)->FIFOSTS & UART_FIFOSTS_TXEMPTY_Msk)
+
+
+/**
+ *    @brief        Get Rx empty
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       0   Rx FIFO is not empty
+ *    @retval       >=1 Rx FIFO is empty
+ *
+ *    @details      This macro get Receiver FIFO empty register value.
+ *    \hideinitializer
+ */
+#define UART_GET_RX_EMPTY(uart)    ((uart)->FIFOSTS & UART_FIFOSTS_RXEMPTY_Msk)
+
+
+/**
+ *    @brief        Check specified UART port transmission is over.
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       0 Tx transmission is not over
+ *    @retval       1 Tx transmission is over
+ *
+ *    @details      This macro return Transmitter Empty Flag register bit value.
+ *                  It indicates if specified UART port transmission is over nor not.
+ *    \hideinitializer
+ */
+#define UART_IS_TX_EMPTY(uart)    (((uart)->FIFOSTS & UART_FIFOSTS_TXEMPTYF_Msk) >> UART_FIFOSTS_TXEMPTYF_Pos)
+
+
+/**
+ *    @brief        Wait specified UART port transmission is over
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @return       None
+ *
+ *    @details      This macro wait specified UART port transmission is over.
+ *    \hideinitializer
+ */
+#define UART_WAIT_TX_EMPTY(uart)    while(!((((uart)->FIFOSTS) & UART_FIFOSTS_TXEMPTYF_Msk) >> UART_FIFOSTS_TXEMPTYF_Pos))
+
+
+/**
+ *    @brief        Check RX is ready or not
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       0 The number of bytes in the RX FIFO is less than the RFITL
+ *    @retval       1 The number of bytes in the RX FIFO equals or larger than RFITL
+ *
+ *    @details      This macro check receive data available interrupt flag is set or not.
+ *    \hideinitializer
+ */
+#define UART_IS_RX_READY(uart)    (((uart)->INTSTS & UART_INTSTS_RDAIF_Msk)>>UART_INTSTS_RDAIF_Pos)
+
+
+/**
+ *    @brief        Check TX FIFO is full or not
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       1 TX FIFO is full
+ *    @retval       0 TX FIFO is not full
+ *
+ *    @details      This macro check TX FIFO is full or not.
+ *    \hideinitializer
+ */
+#define UART_IS_TX_FULL(uart)    (((uart)->FIFOSTS & UART_FIFOSTS_TXFULL_Msk)>>UART_FIFOSTS_TXFULL_Pos)
+
+
+/**
+ *    @brief        Check RX FIFO is full or not
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       1 RX FIFO is full
+ *    @retval       0 RX FIFO is not full
+ *
+ *    @details      This macro check RX FIFO is full or not.
+ *    \hideinitializer
+ */
+#define UART_IS_RX_FULL(uart)    (((uart)->FIFOSTS & UART_FIFOSTS_RXFULL_Msk)>>UART_FIFOSTS_RXFULL_Pos)
+
+
+/**
+ *    @brief        Get Tx full register value
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       0   Tx FIFO is not full.
+ *    @retval       >=1 Tx FIFO is full.
+ *
+ *    @details      This macro get Tx full register value.
+ *    \hideinitializer
+ */
+#define UART_GET_TX_FULL(uart)    ((uart)->FIFOSTS & UART_FIFOSTS_TXFULL_Msk)
+
+
+/**
+ *    @brief        Get Rx full register value
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       0   Rx FIFO is not full.
+ *    @retval       >=1 Rx FIFO is full.
+ *
+ *    @details      This macro get Rx full register value.
+ *    \hideinitializer
+ */
+#define UART_GET_RX_FULL(uart)    ((uart)->FIFOSTS & UART_FIFOSTS_RXFULL_Msk)
+
+
+/**
+ *    @brief        Enable specified UART interrupt
+ *
+ *    @param[in]    uart        The pointer of the specified UART module
+ *    @param[in]    u32eIntSel  Interrupt type select
+ *                              - \ref UART_INTEN_ABRIEN_Msk     : Auto baud rate interrupt
+ *                              - \ref UART_INTEN_WKIEN_Msk      : Wakeup interrupt
+ *                              - \ref UART_INTEN_LINIEN_Msk     : Lin bus interrupt
+ *                              - \ref UART_INTEN_BUFERRIEN_Msk  : Buffer Error interrupt
+ *                              - \ref UART_INTEN_RXTOIEN_Msk    : Rx time-out interrupt
+ *                              - \ref UART_INTEN_MODEMIEN_Msk   : Modem interrupt
+ *                              - \ref UART_INTEN_RLSIEN_Msk     : Rx Line status interrupt
+ *                              - \ref UART_INTEN_THREIEN_Msk    : Tx empty interrupt
+ *                              - \ref UART_INTEN_RDAIEN_Msk     : Rx ready interrupt
+ *
+ *    @return       None
+ *
+ *    @details      This macro enable specified UART interrupt.
+ *    \hideinitializer
+ */
+#define UART_ENABLE_INT(uart, u32eIntSel)    ((uart)->INTEN |= (u32eIntSel))
+
+
+/**
+ *    @brief        Disable specified UART interrupt
+ *
+ *    @param[in]    uart        The pointer of the specified UART module
+ *    @param[in]    u32eIntSel  Interrupt type select
+ *                              - \ref UART_INTEN_ABRIEN_Msk     : Auto baud rate interrupt
+ *                              - \ref UART_INTEN_WKIEN_Msk      : Wakeup interrupt
+ *                              - \ref UART_INTEN_LINIEN_Msk     : Lin bus interrupt
+ *                              - \ref UART_INTEN_BUFERRIEN_Msk  : Buffer Error interrupt
+ *                              - \ref UART_INTEN_RXTOIEN_Msk    : Rx time-out interrupt
+ *                              - \ref UART_INTEN_MODEMIEN_Msk   : Modem status interrupt
+ *                              - \ref UART_INTEN_RLSIEN_Msk     : Receive Line status interrupt
+ *                              - \ref UART_INTEN_THREIEN_Msk    : Tx empty interrupt
+ *                              - \ref UART_INTEN_RDAIEN_Msk     : Rx ready interrupt
+ *
+ *    @return       None
+ *
+ *    @details      This macro enable specified UART interrupt.
+ *    \hideinitializer
+ */
+#define UART_DISABLE_INT(uart, u32eIntSel)    ((uart)->INTEN &= ~ (u32eIntSel))
+
+
+/**
+ *    @brief        Get specified interrupt flag/status
+ *
+ *    @param[in]    uart            The pointer of the specified UART module
+ *    @param[in]    u32eIntTypeFlag Interrupt Type Flag, should be
+ *                                  - \ref UART_INTSTS_HWBUFEINT_Msk : In DMA Mode, Buffer Error Interrupt Indicator
+ *                                  - \ref UART_INTSTS_HWTOINT_Msk   : In DMA Mode, Time-out Interrupt Indicator
+ *                                  - \ref UART_INTSTS_HWMODINT_Msk  : In DMA Mode, MODEM Status Interrupt Indicator
+ *                                  - \ref UART_INTSTS_HWRLSINT_Msk  : In DMA Mode, Receive Line Status Interrupt Indicator
+ *                                  - \ref UART_INTSTS_HWBUFEIF_Msk  : In DMA Mode, Buffer Error Interrupt Flag
+ *                                  - \ref UART_INTSTS_HWTOIF_Msk    : In DMA Mode, Time-out Interrupt Flag
+ *                                  - \ref UART_INTSTS_HWMODIF_Msk   : In DMA Mode, MODEM Interrupt Flag
+ *                                  - \ref UART_INTSTS_HWRLSIF_Msk   : In DMA Mode, Receive Line Status Flag
+ *                                  - \ref UART_INTSTS_LININT_Msk    : LIN Bus Interrupt Indicator
+ *                                  - \ref UART_INTSTS_BUFERRINT_Msk : Buffer Error Interrupt Indicator
+ *                                  - \ref UART_INTSTS_RXTOINT_Msk   : Time-out Interrupt Indicator
+ *                                  - \ref UART_INTSTS_MODEMINT_Msk  : Modem Status Interrupt Indicator
+ *                                  - \ref UART_INTSTS_RLSINT_Msk    : Receive Line Status Interrupt Indicator
+ *                                  - \ref UART_INTSTS_THREINT_Msk   : Transmit Holding Register Empty Interrupt Indicator
+ *                                  - \ref UART_INTSTS_RDAINT_Msk    : Receive Data Available Interrupt Indicator
+ *                                  - \ref UART_INTSTS_LINIF_Msk     : LIN Bus Flag
+ *                                  - \ref UART_INTSTS_BUFERRIF_Msk  : Buffer Error Interrupt Flag
+ *                                  - \ref UART_INTSTS_RXTOIF_Msk    : Rx Time-out Interrupt Flag
+ *                                  - \ref UART_INTSTS_MODEMIF_Msk   : Modem Interrupt Flag
+ *                                  - \ref UART_INTSTS_RLSIF_Msk     : Receive Line Status Interrupt Flag
+ *                                  - \ref UART_INTSTS_THREIF_Msk    : Tx Empty Interrupt Flag
+ *                                  - \ref UART_INTSTS_RDAIF_Msk     : Rx Ready Interrupt Flag
+ *
+ *    @retval       0 The specified interrupt is not happened.
+ *                  1 The specified interrupt is happened.
+ *
+ *    @details      This macro get specified interrupt flag or interrupt indicator status.
+ *    \hideinitializer
+ */
+#define UART_GET_INT_FLAG(uart,u32eIntTypeFlag)    (((uart)->INTSTS & (u32eIntTypeFlag))?1:0)
+
+
+/**
+ *    @brief        Clear RS-485 Address Byte Detection Flag
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @return       None
+ *
+ *    @details      This macro clear RS-485 address byte detection flag.
+ *    \hideinitializer
+ */
+#define UART_RS485_CLEAR_ADDR_FLAG(uart)    ((uart)->FIFOSTS = UART_FIFOSTS_ADDRDETF_Msk)
+
+
+/**
+ *    @brief        Get RS-485 Address Byte Detection Flag
+ *
+ *    @param[in]    uart    The pointer of the specified UART module
+ *
+ *    @retval       0 Receiver detects a data that is not an address bit.
+ *    @retval       1 Receiver detects a data that is an address bit.
+ *
+ *    @details      This macro get RS-485 address byte detection flag.
+ *    \hideinitializer
+ */
+#define UART_RS485_GET_ADDR_FLAG(uart)    (((uart)->FIFOSTS  & UART_FIFOSTS_ADDRDETF_Msk) >> UART_FIFOSTS_ADDRDETF_Pos)
+
+/* Declare these inline functions here to avoid MISRA C 2004 rule 8.1 error */
+void UART_CLEAR_RTS(UART_T *uart);
+void UART_SET_RTS(UART_T *uart);
+
+void UART_ClearIntFlag(UART_T *uart, uint32_t u32InterruptFlag);
+void UART_Close(UART_T *uart);
+void UART_DisableFlowCtrl(UART_T *uart);
+void UART_DisableInt(UART_T  *uart, uint32_t u32InterruptFlag);
+void UART_EnableFlowCtrl(UART_T *uart);
+void UART_EnableInt(UART_T  *uart, uint32_t u32InterruptFlag);
+void UART_Open(UART_T *uart, uint32_t u32baudrate);
+uint32_t UART_Read(UART_T *uart, uint8_t pu8RxBuf[], uint32_t u32ReadBytes);
+void UART_SetLineConfig(UART_T *uart, uint32_t u32baudrate, uint32_t u32data_width, uint32_t u32parity, uint32_t  u32stop_bits);
+void UART_SetTimeoutCnt(UART_T *uart, uint32_t u32TOC);
+void UART_SelectIrDAMode(UART_T *uart, uint32_t u32Buadrate, uint32_t u32Direction);
+void UART_SelectRS485Mode(UART_T *uart, uint32_t u32Mode, uint32_t u32Addr);
+void UART_SelectLINMode(UART_T *uart, uint32_t u32Mode, uint32_t u32BreakLength);
+uint32_t UART_Write(UART_T *uart, uint8_t pu8TxBuf[], uint32_t u32WriteBytes);
+
+
+
+
+/*@}*/ /* end of group UART_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group UART_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+
+#endif /*__NU_UART_H__*/
+
+/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/

+ 942 - 0
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_usbd.h

@@ -0,0 +1,942 @@
+/**************************************************************************//**
+ * @file     usbd.h
+ * @version  V1.00
+ * $Revision: 3 $
+ * $Date: 18/08/05 10:19a $
+ * @brief    USBD driver header file
+ *
+ * @note
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
+ *****************************************************************************/
+#ifndef __NU_USBD_H__
+#define __NU_USBD_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/** @addtogroup Standard_Driver Standard Driver
+  @{
+*/
+
+/** @addtogroup USBD_Driver USBD Driver
+  @{
+*/
+
+/** @addtogroup USBD_EXPORTED_CONSTANTS USBD Exported Constants
+  @{
+*/
+/// @cond HIDDEN_SYMBOLS
+#define USBD_MAX_EP     12
+
+#define Maximum(a,b)    (a)>(b) ? (a) : (b)
+#define Minimum(a,b)    (a)<(b) ? (a) : (b)
+
+
+#define CEP     0xff    /*!< Control Endpoint  \hideinitializer */
+#define EPA     0       /*!< Endpoint A  \hideinitializer */
+#define EPB     1       /*!< Endpoint B  \hideinitializer */
+#define EPC     2       /*!< Endpoint C  \hideinitializer */
+#define EPD     3       /*!< Endpoint D  \hideinitializer */
+#define EPE     4       /*!< Endpoint E  \hideinitializer */
+#define EPF     5       /*!< Endpoint F  \hideinitializer */
+#define EPG     6       /*!< Endpoint G  \hideinitializer */
+#define EPH     7       /*!< Endpoint H  \hideinitializer */
+#define EPI     8       /*!< Endpoint I  \hideinitializer */
+#define EPJ     9       /*!< Endpoint J  \hideinitializer */
+#define EPK     10      /*!< Endpoint K  \hideinitializer */
+#define EPL     11      /*!< Endpoint L  \hideinitializer */
+
+/* USB Request Type */
+#define REQ_STANDARD        0x00
+#define REQ_CLASS           0x20
+#define REQ_VENDOR          0x40
+
+/* USB Standard Request */
+#define GET_STATUS          0x00
+#define CLEAR_FEATURE       0x01
+#define SET_FEATURE         0x03
+#define SET_ADDRESS         0x05
+#define GET_DESCRIPTOR      0x06
+#define SET_DESCRIPTOR      0x07
+#define GET_CONFIGURATION   0x08
+#define SET_CONFIGURATION   0x09
+#define GET_INTERFACE       0x0A
+#define SET_INTERFACE       0x0B
+#define SYNC_FRAME          0x0C
+
+/* USB Descriptor Type */
+#define DESC_DEVICE         0x01
+#define DESC_CONFIG         0x02
+#define DESC_STRING         0x03
+#define DESC_INTERFACE      0x04
+#define DESC_ENDPOINT       0x05
+#define DESC_QUALIFIER      0x06
+#define DESC_OTHERSPEED     0x07
+#define DESC_IFPOWER        0x08
+#define DESC_OTG            0x09
+
+/* USB HID Descriptor Type */
+#define DESC_HID            0x21
+#define DESC_HID_RPT        0x22
+
+/* USB Descriptor Length */
+#define LEN_DEVICE          18
+#define LEN_QUALIFIER       10
+#define LEN_CONFIG          9
+#define LEN_INTERFACE       9
+#define LEN_ENDPOINT        7
+#define LEN_OTG             5
+#define LEN_HID             9
+
+/* USB Endpoint Type */
+#define EP_ISO              0x01
+#define EP_BULK             0x02
+#define EP_INT              0x03
+
+#define EP_INPUT            0x80
+#define EP_OUTPUT           0x00
+
+/* USB Feature Selector */
+#define FEATURE_DEVICE_REMOTE_WAKEUP    0x01
+#define FEATURE_ENDPOINT_HALT           0x00
+/// @endcond HIDDEN_SYMBOLS
+/********************* Bit definition of CEPCTL register **********************/
+#define USB_CEPCTL_NAKCLR               ((uint32_t)0x00000000)      /*!<NAK clear  \hideinitializer */
+#define USB_CEPCTL_STALL                ((uint32_t)0x00000002)      /*!<Stall  \hideinitializer */
+#define USB_CEPCTL_ZEROLEN              ((uint32_t)0x00000004)      /*!<Zero length packet  \hideinitializer */
+#define USB_CEPCTL_FLUSH                ((uint32_t)0x00000008)      /*!<CEP flush  \hideinitializer */
+
+/********************* Bit definition of EPxRSPCTL register **********************/
+#define USB_EP_RSPCTL_FLUSH             ((uint32_t)0x00000001)      /*!<Buffer Flush  \hideinitializer */
+#define USB_EP_RSPCTL_MODE_AUTO         ((uint32_t)0x00000000)      /*!<Auto-Validate Mode  \hideinitializer */
+#define USB_EP_RSPCTL_MODE_MANUAL       ((uint32_t)0x00000002)      /*!<Manual-Validate Mode  \hideinitializer */
+#define USB_EP_RSPCTL_MODE_FLY          ((uint32_t)0x00000004)      /*!<Fly Mode  \hideinitializer */
+#define USB_EP_RSPCTL_MODE_MASK         ((uint32_t)0x00000006)      /*!<Mode Mask  \hideinitializer */
+#define USB_EP_RSPCTL_TOGGLE            ((uint32_t)0x00000008)      /*!<Clear Toggle bit  \hideinitializer */
+#define USB_EP_RSPCTL_HALT              ((uint32_t)0x00000010)      /*!<Endpoint halt  \hideinitializer */
+#define USB_EP_RSPCTL_ZEROLEN           ((uint32_t)0x00000020)      /*!<Zero length packet IN  \hideinitializer */
+#define USB_EP_RSPCTL_SHORTTXEN         ((uint32_t)0x00000040)      /*!<Packet end  \hideinitializer */
+#define USB_EP_RSPCTL_DISBUF            ((uint32_t)0x00000080)      /*!<Disable buffer  \hideinitializer */
+
+/********************* Bit definition of EPxCFG register **********************/
+#define USB_EP_CFG_VALID                ((uint32_t)0x00000001)      /*!<Endpoint Valid  \hideinitializer */
+#define USB_EP_CFG_TYPE_BULK            ((uint32_t)0x00000002)      /*!<Endpoint type - bulk  \hideinitializer */
+#define USB_EP_CFG_TYPE_INT             ((uint32_t)0x00000004)      /*!<Endpoint type - interrupt  \hideinitializer */
+#define USB_EP_CFG_TYPE_ISO             ((uint32_t)0x00000006)      /*!<Endpoint type - isochronous  \hideinitializer */
+#define USB_EP_CFG_TYPE_MASK            ((uint32_t)0x00000006)      /*!<Endpoint type mask  \hideinitializer */
+#define USB_EP_CFG_DIR_OUT              ((uint32_t)0x00000000)      /*!<OUT endpoint  \hideinitializer */
+#define USB_EP_CFG_DIR_IN               ((uint32_t)0x00000008)      /*!<IN endpoint  \hideinitializer */
+
+
+/*@}*/ /* end of group USBD_EXPORTED_CONSTANTS */
+
+/** @addtogroup USBD_EXPORTED_STRUCT USBD Exported Struct
+  @{
+*/
+
+
+/** \brief  Structure type of USB Setup Packet.
+ */
+typedef struct usbd_cmd_struct
+{
+    uint8_t  bmRequestType; /*!< Request type */
+    uint8_t  bRequest;      /*!< Request */
+    uint16_t wValue;        /*!< value */
+    uint16_t wIndex;        /*!< index */
+    uint16_t wLength;       /*!< length */
+
+} S_USBD_CMD_T; /*!<USB Setup Packet Structure */
+
+
+/** \brief  Structure type of Device Descriptor
+ */
+typedef struct s_usbd_info
+{
+    uint8_t *gu8DevDesc;            /*!< Device descriptor */
+    uint8_t *gu8ConfigDesc;         /*!< Config descriptor */
+    uint8_t **gu8StringDesc;        /*!< Pointer for USB String Descriptor pointers */
+    uint8_t *gu8QualDesc;           /*!< Qualifier descriptor */
+    uint8_t *gu8FullConfigDesc;     /*!< Full Speed Config descriptor */
+    uint8_t *gu8HSOtherConfigDesc;  /*!< Other Speed Config descriptor */
+    uint8_t *gu8FSOtherConfigDesc;  /*!< Other Speed Config descriptor */
+    uint8_t **gu8HidReportDesc;     /*!< Pointer for HID Report descriptor */
+    uint32_t *gu32HidReportSize;    /*!< Pointer for HID Report descriptor Size */
+
+} S_USBD_INFO_T; /*!<USB Information Structure */
+
+
+/*@}*/ /* end of group USBD_EXPORTED_STRUCT */
+
+/// @cond HIDDEN_SYMBOLS
+extern uint32_t g_u32EpStallLock;
+extern uint8_t volatile g_usbd_Configured;
+extern uint8_t g_usbd_ShortPacket;
+extern uint8_t g_usbd_CtrlZero;
+extern uint8_t g_usbd_UsbAddr;
+extern uint8_t g_usbd_EpHalt[];
+extern uint32_t volatile g_usbd_DmaDone;
+extern uint32_t g_usbd_CtrlInSize;
+extern S_USBD_INFO_T gsInfo;
+extern S_USBD_CMD_T gUsbCmd;
+/// @endcond /* HIDDEN_SYMBOLS */
+
+/// @cond HIDDEN_SYMBOLS
+typedef struct
+{
+
+    union
+    {
+        volatile uint32_t EPDAT;
+        volatile uint8_t  EPDAT_BYTE;
+
+    } ep;
+    volatile uint32_t EPINTSTS;
+    volatile uint32_t EPINTEN;
+    volatile const  uint32_t EPDATCNT;
+    volatile uint32_t EPRSPCTL;
+    volatile uint32_t EPMPS;
+    volatile uint32_t EPTXCNT;
+    volatile uint32_t EPCFG;
+    volatile uint32_t EPBUFSTART;
+    volatile uint32_t EPBUFEND;
+
+} USBD_EP_T;
+
+typedef struct
+{
+    volatile const  uint32_t GINTSTS;
+    uint32_t RESERVE0[1];
+    volatile uint32_t GINTEN;
+    uint32_t RESERVE1[1];
+    volatile uint32_t BUSINTSTS;
+    volatile uint32_t BUSINTEN;
+    volatile uint32_t OPER;
+    volatile const  uint32_t FRAMECNT;
+    volatile uint32_t FADDR;
+    volatile uint32_t TEST;
+    union
+    {
+        volatile uint32_t CEPDAT;
+        volatile uint8_t  CEPDAT_BYTE;
+    } cep;
+    volatile uint32_t CEPCTL;
+    volatile uint32_t CEPINTEN;
+    volatile uint32_t CEPINTSTS;
+    volatile uint32_t CEPTXCNT;
+    volatile const  uint32_t CEPRXCNT;
+    volatile const  uint32_t CEPDATCNT;
+    volatile const  uint32_t SETUP1_0;
+    volatile const  uint32_t SETUP3_2;
+    volatile const  uint32_t SETUP5_4;
+    volatile const  uint32_t SETUP7_6;
+    volatile uint32_t CEPBUFSTART;
+    volatile uint32_t CEPBUFEND;
+    volatile uint32_t DMACTL;
+    volatile uint32_t DMACNT;
+    USBD_EP_T EP[12];
+    uint32_t RESERVE2[303];
+    volatile uint32_t DMAADDR;
+    volatile uint32_t PHYCTL;
+
+} USBD_T;
+
+#define USBD   ((USBD_T *) USBD_BA)
+
+/// @endcond
+
+
+#define USBD_GINTSTS_USBIF_Pos           (0)                                               /*!< USBD GINTSTS: USBIF Position           */
+#define USBD_GINTSTS_USBIF_Msk           (0x1ul << USBD_GINTSTS_USBIF_Pos)                 /*!< USBD GINTSTS: USBIF Mask               */
+
+#define USBD_GINTSTS_CEPIF_Pos           (1)                                               /*!< USBD GINTSTS: CEPIF Position           */
+#define USBD_GINTSTS_CEPIF_Msk           (0x1ul << USBD_GINTSTS_CEPIF_Pos)                 /*!< USBD GINTSTS: CEPIF Mask               */
+
+#define USBD_GINTSTS_EPAIF_Pos           (2)                                               /*!< USBD GINTSTS: EPAIF Position           */
+#define USBD_GINTSTS_EPAIF_Msk           (0x1ul << USBD_GINTSTS_EPAIF_Pos)                 /*!< USBD GINTSTS: EPAIF Mask               */
+
+#define USBD_GINTSTS_EPBIF_Pos           (3)                                               /*!< USBD GINTSTS: EPBIF Position           */
+#define USBD_GINTSTS_EPBIF_Msk           (0x1ul << USBD_GINTSTS_EPBIF_Pos)                 /*!< USBD GINTSTS: EPBIF Mask               */
+
+#define USBD_GINTSTS_EPCIF_Pos           (4)                                               /*!< USBD GINTSTS: EPCIF Position           */
+#define USBD_GINTSTS_EPCIF_Msk           (0x1ul << USBD_GINTSTS_EPCIF_Pos)                 /*!< USBD GINTSTS: EPCIF Mask               */
+
+#define USBD_GINTSTS_EPDIF_Pos           (5)                                               /*!< USBD GINTSTS: EPDIF Position           */
+#define USBD_GINTSTS_EPDIF_Msk           (0x1ul << USBD_GINTSTS_EPDIF_Pos)                 /*!< USBD GINTSTS: EPDIF Mask               */
+
+#define USBD_GINTSTS_EPEIF_Pos           (6)                                               /*!< USBD GINTSTS: EPEIF Position           */
+#define USBD_GINTSTS_EPEIF_Msk           (0x1ul << USBD_GINTSTS_EPEIF_Pos)                 /*!< USBD GINTSTS: EPEIF Mask               */
+
+#define USBD_GINTSTS_EPFIF_Pos           (7)                                               /*!< USBD GINTSTS: EPFIF Position           */
+#define USBD_GINTSTS_EPFIF_Msk           (0x1ul << USBD_GINTSTS_EPFIF_Pos)                 /*!< USBD GINTSTS: EPFIF Mask               */
+
+#define USBD_GINTSTS_EPGIF_Pos           (8)                                               /*!< USBD GINTSTS: EPGIF Position           */
+#define USBD_GINTSTS_EPGIF_Msk           (0x1ul << USBD_GINTSTS_EPGIF_Pos)                 /*!< USBD GINTSTS: EPGIF Mask               */
+
+#define USBD_GINTSTS_EPHIF_Pos           (9)                                               /*!< USBD GINTSTS: EPHIF Position           */
+#define USBD_GINTSTS_EPHIF_Msk           (0x1ul << USBD_GINTSTS_EPHIF_Pos)                 /*!< USBD GINTSTS: EPHIF Mask               */
+
+#define USBD_GINTSTS_EPIIF_Pos           (10)                                              /*!< USBD GINTSTS: EPIIF Position           */
+#define USBD_GINTSTS_EPIIF_Msk           (0x1ul << USBD_GINTSTS_EPIIF_Pos)                 /*!< USBD GINTSTS: EPIIF Mask               */
+
+#define USBD_GINTSTS_EPJIF_Pos           (11)                                              /*!< USBD GINTSTS: EPJIF Position           */
+#define USBD_GINTSTS_EPJIF_Msk           (0x1ul << USBD_GINTSTS_EPJIF_Pos)                 /*!< USBD GINTSTS: EPJIF Mask               */
+
+#define USBD_GINTSTS_EPKIF_Pos           (12)                                              /*!< USBD GINTSTS: EPKIF Position           */
+#define USBD_GINTSTS_EPKIF_Msk           (0x1ul << USBD_GINTSTS_EPKIF_Pos)                 /*!< USBD GINTSTS: EPKIF Mask               */
+
+#define USBD_GINTSTS_EPLIF_Pos           (13)                                              /*!< USBD GINTSTS: EPLIF Position           */
+#define USBD_GINTSTS_EPLIF_Msk           (0x1ul << USBD_GINTSTS_EPLIF_Pos)                 /*!< USBD GINTSTS: EPLIF Mask               */
+
+#define USBD_GINTEN_USBIE_Pos            (0)                                               /*!< USBD GINTEN: USBIE Position            */
+#define USBD_GINTEN_USBIE_Msk            (0x1ul << USBD_GINTEN_USBIE_Pos)                  /*!< USBD GINTEN: USBIE Mask                */
+
+#define USBD_GINTEN_CEPIE_Pos            (1)                                               /*!< USBD GINTEN: CEPIE Position            */
+#define USBD_GINTEN_CEPIE_Msk            (0x1ul << USBD_GINTEN_CEPIE_Pos)                  /*!< USBD GINTEN: CEPIE Mask                */
+
+#define USBD_GINTEN_EPAIE_Pos            (2)                                               /*!< USBD GINTEN: EPAIE Position            */
+#define USBD_GINTEN_EPAIE_Msk            (0x1ul << USBD_GINTEN_EPAIE_Pos)                  /*!< USBD GINTEN: EPAIE Mask                */
+
+#define USBD_GINTEN_EPBIE_Pos            (3)                                               /*!< USBD GINTEN: EPBIE Position            */
+#define USBD_GINTEN_EPBIE_Msk            (0x1ul << USBD_GINTEN_EPBIE_Pos)                  /*!< USBD GINTEN: EPBIE Mask                */
+
+#define USBD_GINTEN_EPCIE_Pos            (4)                                               /*!< USBD GINTEN: EPCIE Position            */
+#define USBD_GINTEN_EPCIE_Msk            (0x1ul << USBD_GINTEN_EPCIE_Pos)                  /*!< USBD GINTEN: EPCIE Mask                */
+
+#define USBD_GINTEN_EPDIE_Pos            (5)                                               /*!< USBD GINTEN: EPDIE Position            */
+#define USBD_GINTEN_EPDIE_Msk            (0x1ul << USBD_GINTEN_EPDIE_Pos)                  /*!< USBD GINTEN: EPDIE Mask                */
+
+#define USBD_GINTEN_EPEIE_Pos            (6)                                               /*!< USBD GINTEN: EPEIE Position            */
+#define USBD_GINTEN_EPEIE_Msk            (0x1ul << USBD_GINTEN_EPEIE_Pos)                  /*!< USBD GINTEN: EPEIE Mask                */
+
+#define USBD_GINTEN_EPFIE_Pos            (7)                                               /*!< USBD GINTEN: EPFIE Position            */
+#define USBD_GINTEN_EPFIE_Msk            (0x1ul << USBD_GINTEN_EPFIE_Pos)                  /*!< USBD GINTEN: EPFIE Mask                */
+
+#define USBD_GINTEN_EPGIE_Pos            (8)                                               /*!< USBD GINTEN: EPGIE Position            */
+#define USBD_GINTEN_EPGIE_Msk            (0x1ul << USBD_GINTEN_EPGIE_Pos)                  /*!< USBD GINTEN: EPGIE Mask                */
+
+#define USBD_GINTEN_EPHIE_Pos            (9)                                               /*!< USBD GINTEN: EPHIE Position            */
+#define USBD_GINTEN_EPHIE_Msk            (0x1ul << USBD_GINTEN_EPHIE_Pos)                  /*!< USBD GINTEN: EPHIE Mask                */
+
+#define USBD_GINTEN_EPIIE_Pos            (10)                                              /*!< USBD GINTEN: EPIIE Position            */
+#define USBD_GINTEN_EPIIE_Msk            (0x1ul << USBD_GINTEN_EPIIE_Pos)                  /*!< USBD GINTEN: EPIIE Mask                */
+
+#define USBD_GINTEN_EPJIE_Pos            (11)                                              /*!< USBD GINTEN: EPJIE Position            */
+#define USBD_GINTEN_EPJIE_Msk            (0x1ul << USBD_GINTEN_EPJIE_Pos)                  /*!< USBD GINTEN: EPJIE Mask                */
+
+#define USBD_GINTEN_EPKIE_Pos            (12)                                              /*!< USBD GINTEN: EPKIE Position            */
+#define USBD_GINTEN_EPKIE_Msk            (0x1ul << USBD_GINTEN_EPKIE_Pos)                  /*!< USBD GINTEN: EPKIE Mask                */
+
+#define USBD_GINTEN_EPLIE_Pos            (13)                                              /*!< USBD GINTEN: EPLIE Position            */
+#define USBD_GINTEN_EPLIE_Msk            (0x1ul << USBD_GINTEN_EPLIE_Pos)                  /*!< USBD GINTEN: EPLIE Mask                */
+
+#define USBD_BUSINTSTS_SOFIF_Pos         (0)                                               /*!< USBD BUSINTSTS: SOFIF Position         */
+#define USBD_BUSINTSTS_SOFIF_Msk         (0x1ul << USBD_BUSINTSTS_SOFIF_Pos)               /*!< USBD BUSINTSTS: SOFIF Mask             */
+
+#define USBD_BUSINTSTS_RSTIF_Pos         (1)                                               /*!< USBD BUSINTSTS: RSTIF Position         */
+#define USBD_BUSINTSTS_RSTIF_Msk         (0x1ul << USBD_BUSINTSTS_RSTIF_Pos)               /*!< USBD BUSINTSTS: RSTIF Mask             */
+
+#define USBD_BUSINTSTS_RESUMEIF_Pos      (2)                                               /*!< USBD BUSINTSTS: RESUMEIF Position      */
+#define USBD_BUSINTSTS_RESUMEIF_Msk      (0x1ul << USBD_BUSINTSTS_RESUMEIF_Pos)            /*!< USBD BUSINTSTS: RESUMEIF Mask          */
+
+#define USBD_BUSINTSTS_SUSPENDIF_Pos     (3)                                               /*!< USBD BUSINTSTS: SUSPENDIF Position     */
+#define USBD_BUSINTSTS_SUSPENDIF_Msk     (0x1ul << USBD_BUSINTSTS_SUSPENDIF_Pos)           /*!< USBD BUSINTSTS: SUSPENDIF Mask         */
+
+#define USBD_BUSINTSTS_HISPDIF_Pos       (4)                                               /*!< USBD BUSINTSTS: HISPDIF Position       */
+#define USBD_BUSINTSTS_HISPDIF_Msk       (0x1ul << USBD_BUSINTSTS_HISPDIF_Pos)             /*!< USBD BUSINTSTS: HISPDIF Mask           */
+
+#define USBD_BUSINTSTS_DMADONEIF_Pos     (5)                                               /*!< USBD BUSINTSTS: DMADONEIF Position     */
+#define USBD_BUSINTSTS_DMADONEIF_Msk     (0x1ul << USBD_BUSINTSTS_DMADONEIF_Pos)           /*!< USBD BUSINTSTS: DMADONEIF Mask         */
+
+#define USBD_BUSINTSTS_PHYCLKVLDIF_Pos   (6)                                               /*!< USBD BUSINTSTS: PHYCLKVLDIF Position   */
+#define USBD_BUSINTSTS_PHYCLKVLDIF_Msk   (0x1ul << USBD_BUSINTSTS_PHYCLKVLDIF_Pos)         /*!< USBD BUSINTSTS: PHYCLKVLDIF Mask       */
+
+#define USBD_BUSINTSTS_VBUSDETIF_Pos     (8)                                               /*!< USBD BUSINTSTS: VBUSDETIF Position     */
+#define USBD_BUSINTSTS_VBUSDETIF_Msk     (0x1ul << USBD_BUSINTSTS_VBUSDETIF_Pos)           /*!< USBD BUSINTSTS: VBUSDETIF Mask         */
+
+#define USBD_BUSINTEN_SOFIEN_Pos         (0)                                               /*!< USBD BUSINTEN: SOFIEN Position         */
+#define USBD_BUSINTEN_SOFIEN_Msk         (0x1ul << USBD_BUSINTEN_SOFIEN_Pos)               /*!< USBD BUSINTEN: SOFIEN Mask             */
+
+#define USBD_BUSINTEN_RSTIEN_Pos         (1)                                               /*!< USBD BUSINTEN: RSTIEN Position         */
+#define USBD_BUSINTEN_RSTIEN_Msk         (0x1ul << USBD_BUSINTEN_RSTIEN_Pos)               /*!< USBD BUSINTEN: RSTIEN Mask             */
+
+#define USBD_BUSINTEN_RESUMEIEN_Pos      (2)                                               /*!< USBD BUSINTEN: RESUMEIEN Position      */
+#define USBD_BUSINTEN_RESUMEIEN_Msk      (0x1ul << USBD_BUSINTEN_RESUMEIEN_Pos)            /*!< USBD BUSINTEN: RESUMEIEN Mask          */
+
+#define USBD_BUSINTEN_SUSPENDIEN_Pos     (3)                                               /*!< USBD BUSINTEN: SUSPENDIEN Position     */
+#define USBD_BUSINTEN_SUSPENDIEN_Msk     (0x1ul << USBD_BUSINTEN_SUSPENDIEN_Pos)           /*!< USBD BUSINTEN: SUSPENDIEN Mask         */
+
+#define USBD_BUSINTEN_HISPDIEN_Pos       (4)                                               /*!< USBD BUSINTEN: HISPDIEN Position       */
+#define USBD_BUSINTEN_HISPDIEN_Msk       (0x1ul << USBD_BUSINTEN_HISPDIEN_Pos)             /*!< USBD BUSINTEN: HISPDIEN Mask           */
+
+#define USBD_BUSINTEN_DMADONEIEN_Pos     (5)                                               /*!< USBD BUSINTEN: DMADONEIEN Position     */
+#define USBD_BUSINTEN_DMADONEIEN_Msk     (0x1ul << USBD_BUSINTEN_DMADONEIEN_Pos)           /*!< USBD BUSINTEN: DMADONEIEN Mask         */
+
+#define USBD_BUSINTEN_PHYCLKVLDIEN_Pos   (6)                                               /*!< USBD BUSINTEN: PHYCLKVLDIEN Position   */
+#define USBD_BUSINTEN_PHYCLKVLDIEN_Msk   (0x1ul << USBD_BUSINTEN_PHYCLKVLDIEN_Pos)         /*!< USBD BUSINTEN: PHYCLKVLDIEN Mask       */
+
+#define USBD_BUSINTEN_VBUSDETIEN_Pos     (8)                                               /*!< USBD BUSINTEN: VBUSDETIEN Position     */
+#define USBD_BUSINTEN_VBUSDETIEN_Msk     (0x1ul << USBD_BUSINTEN_VBUSDETIEN_Pos)           /*!< USBD BUSINTEN: VBUSDETIEN Mask         */
+
+#define USBD_OPER_RESUMEEN_Pos           (0)                                               /*!< USBD OPER: RESUMEEN Position           */
+#define USBD_OPER_RESUMEEN_Msk           (0x1ul << USBD_OPER_RESUMEEN_Pos)                 /*!< USBD OPER: RESUMEEN Mask               */
+
+#define USBD_OPER_HISPDEN_Pos            (1)                                               /*!< USBD OPER: HISPDEN Position            */
+#define USBD_OPER_HISPDEN_Msk            (0x1ul << USBD_OPER_HISPDEN_Pos)                  /*!< USBD OPER: HISPDEN Mask                */
+
+#define USBD_OPER_CURSPD_Pos             (2)                                               /*!< USBD OPER: CURSPD Position             */
+#define USBD_OPER_CURSPD_Msk             (0x1ul << USBD_OPER_CURSPD_Pos)                   /*!< USBD OPER: CURSPD Mask                 */
+
+#define USBD_FRAMECNT_MFRAMECNT_Pos      (0)                                               /*!< USBD FRAMECNT: MFRAMECNT Position      */
+#define USBD_FRAMECNT_MFRAMECNT_Msk      (0x7ul << USBD_FRAMECNT_MFRAMECNT_Pos)            /*!< USBD FRAMECNT: MFRAMECNT Mask          */
+
+#define USBD_FRAMECNT_FRAMECNT_Pos       (3)                                               /*!< USBD FRAMECNT: FRAMECNT Position       */
+#define USBD_FRAMECNT_FRAMECNT_Msk       (0x7fful << USBD_FRAMECNT_FRAMECNT_Pos)           /*!< USBD FRAMECNT: FRAMECNT Mask           */
+
+#define USBD_FADDR_FADDR_Pos             (0)                                               /*!< USBD FADDR: FADDR Position             */
+#define USBD_FADDR_FADDR_Msk             (0x7ful << USBD_FADDR_FADDR_Pos)                  /*!< USBD FADDR: FADDR Mask                 */
+
+#define USBD_TEST_TESTMODE_Pos           (0)                                               /*!< USBD TEST: TESTMODE Position           */
+#define USBD_TEST_TESTMODE_Msk           (0x7ul << USBD_TEST_TESTMODE_Pos)                 /*!< USBD TEST: TESTMODE Mask               */
+
+#define USBD_CEPDAT_DAT_Pos              (0)                                               /*!< USBD CEPDAT: DAT Position              */
+#define USBD_CEPDAT_DAT_Msk              (0xfffffffful << USBD_CEPDAT_DAT_Pos)             /*!< USBD CEPDAT: DAT Mask                  */
+
+#define USBD_CEPCTL_NAKCLR_Pos           (0)                                               /*!< USBD CEPCTL: NAKCLR Position           */
+#define USBD_CEPCTL_NAKCLR_Msk           (0x1ul << USBD_CEPCTL_NAKCLR_Pos)                 /*!< USBD CEPCTL: NAKCLR Mask               */
+
+#define USBD_CEPCTL_STALLEN_Pos          (1)                                               /*!< USBD CEPCTL: STALLEN Position          */
+#define USBD_CEPCTL_STALLEN_Msk          (0x1ul << USBD_CEPCTL_STALLEN_Pos)                /*!< USBD CEPCTL: STALLEN Mask              */
+
+#define USBD_CEPCTL_ZEROLEN_Pos          (2)                                               /*!< USBD CEPCTL: ZEROLEN Position          */
+#define USBD_CEPCTL_ZEROLEN_Msk          (0x1ul << USBD_CEPCTL_ZEROLEN_Pos)                /*!< USBD CEPCTL: ZEROLEN Mask              */
+
+#define USBD_CEPCTL_FLUSH_Pos            (3)                                               /*!< USBD CEPCTL: FLUSH Position            */
+#define USBD_CEPCTL_FLUSH_Msk            (0x1ul << USBD_CEPCTL_FLUSH_Pos)                  /*!< USBD CEPCTL: FLUSH Mask                */
+
+#define USBD_CEPINTEN_SETUPTKIEN_Pos     (0)                                               /*!< USBD CEPINTEN: SETUPTKIEN Position     */
+#define USBD_CEPINTEN_SETUPTKIEN_Msk     (0x1ul << USBD_CEPINTEN_SETUPTKIEN_Pos)           /*!< USBD CEPINTEN: SETUPTKIEN Mask         */
+
+#define USBD_CEPINTEN_SETUPPKIEN_Pos     (1)                                               /*!< USBD CEPINTEN: SETUPPKIEN Position     */
+#define USBD_CEPINTEN_SETUPPKIEN_Msk     (0x1ul << USBD_CEPINTEN_SETUPPKIEN_Pos)           /*!< USBD CEPINTEN: SETUPPKIEN Mask         */
+
+#define USBD_CEPINTEN_OUTTKIEN_Pos       (2)                                               /*!< USBD CEPINTEN: OUTTKIEN Position       */
+#define USBD_CEPINTEN_OUTTKIEN_Msk       (0x1ul << USBD_CEPINTEN_OUTTKIEN_Pos)             /*!< USBD CEPINTEN: OUTTKIEN Mask           */
+
+#define USBD_CEPINTEN_INTKIEN_Pos        (3)                                               /*!< USBD CEPINTEN: INTKIEN Position        */
+#define USBD_CEPINTEN_INTKIEN_Msk        (0x1ul << USBD_CEPINTEN_INTKIEN_Pos)              /*!< USBD CEPINTEN: INTKIEN Mask            */
+
+#define USBD_CEPINTEN_PINGIEN_Pos        (4)                                               /*!< USBD CEPINTEN: PINGIEN Position        */
+#define USBD_CEPINTEN_PINGIEN_Msk        (0x1ul << USBD_CEPINTEN_PINGIEN_Pos)              /*!< USBD CEPINTEN: PINGIEN Mask            */
+
+#define USBD_CEPINTEN_TXPKIEN_Pos        (5)                                               /*!< USBD CEPINTEN: TXPKIEN Position        */
+#define USBD_CEPINTEN_TXPKIEN_Msk        (0x1ul << USBD_CEPINTEN_TXPKIEN_Pos)              /*!< USBD CEPINTEN: TXPKIEN Mask            */
+
+#define USBD_CEPINTEN_RXPKIEN_Pos        (6)                                               /*!< USBD CEPINTEN: RXPKIEN Position        */
+#define USBD_CEPINTEN_RXPKIEN_Msk        (0x1ul << USBD_CEPINTEN_RXPKIEN_Pos)              /*!< USBD CEPINTEN: RXPKIEN Mask            */
+
+#define USBD_CEPINTEN_NAKIEN_Pos         (7)                                               /*!< USBD CEPINTEN: NAKIEN Position         */
+#define USBD_CEPINTEN_NAKIEN_Msk         (0x1ul << USBD_CEPINTEN_NAKIEN_Pos)               /*!< USBD CEPINTEN: NAKIEN Mask             */
+
+#define USBD_CEPINTEN_STALLIEN_Pos       (8)                                               /*!< USBD CEPINTEN: STALLIEN Position       */
+#define USBD_CEPINTEN_STALLIEN_Msk       (0x1ul << USBD_CEPINTEN_STALLIEN_Pos)             /*!< USBD CEPINTEN: STALLIEN Mask           */
+
+#define USBD_CEPINTEN_ERRIEN_Pos         (9)                                               /*!< USBD CEPINTEN: ERRIEN Position         */
+#define USBD_CEPINTEN_ERRIEN_Msk         (0x1ul << USBD_CEPINTEN_ERRIEN_Pos)               /*!< USBD CEPINTEN: ERRIEN Mask             */
+
+#define USBD_CEPINTEN_STSDONEIEN_Pos     (10)                                              /*!< USBD CEPINTEN: STSDONEIEN Position     */
+#define USBD_CEPINTEN_STSDONEIEN_Msk     (0x1ul << USBD_CEPINTEN_STSDONEIEN_Pos)           /*!< USBD CEPINTEN: STSDONEIEN Mask         */
+
+#define USBD_CEPINTEN_BUFFULLIEN_Pos     (11)                                              /*!< USBD CEPINTEN: BUFFULLIEN Position     */
+#define USBD_CEPINTEN_BUFFULLIEN_Msk     (0x1ul << USBD_CEPINTEN_BUFFULLIEN_Pos)           /*!< USBD CEPINTEN: BUFFULLIEN Mask         */
+
+#define USBD_CEPINTEN_BUFEMPTYIEN_Pos    (12)                                              /*!< USBD CEPINTEN: BUFEMPTYIEN Position    */
+#define USBD_CEPINTEN_BUFEMPTYIEN_Msk    (0x1ul << USBD_CEPINTEN_BUFEMPTYIEN_Pos)          /*!< USBD CEPINTEN: BUFEMPTYIEN Mask        */
+
+#define USBD_CEPINTSTS_SETUPTKIF_Pos     (0)                                               /*!< USBD CEPINTSTS: SETUPTKIF Position     */
+#define USBD_CEPINTSTS_SETUPTKIF_Msk     (0x1ul << USBD_CEPINTSTS_SETUPTKIF_Pos)           /*!< USBD CEPINTSTS: SETUPTKIF Mask         */
+
+#define USBD_CEPINTSTS_SETUPPKIF_Pos     (1)                                               /*!< USBD CEPINTSTS: SETUPPKIF Position     */
+#define USBD_CEPINTSTS_SETUPPKIF_Msk     (0x1ul << USBD_CEPINTSTS_SETUPPKIF_Pos)           /*!< USBD CEPINTSTS: SETUPPKIF Mask         */
+
+#define USBD_CEPINTSTS_OUTTKIF_Pos       (2)                                               /*!< USBD CEPINTSTS: OUTTKIF Position       */
+#define USBD_CEPINTSTS_OUTTKIF_Msk       (0x1ul << USBD_CEPINTSTS_OUTTKIF_Pos)             /*!< USBD CEPINTSTS: OUTTKIF Mask           */
+
+#define USBD_CEPINTSTS_INTKIF_Pos        (3)                                               /*!< USBD CEPINTSTS: INTKIF Position        */
+#define USBD_CEPINTSTS_INTKIF_Msk        (0x1ul << USBD_CEPINTSTS_INTKIF_Pos)              /*!< USBD CEPINTSTS: INTKIF Mask            */
+
+#define USBD_CEPINTSTS_PINGIF_Pos        (4)                                               /*!< USBD CEPINTSTS: PINGIF Position        */
+#define USBD_CEPINTSTS_PINGIF_Msk        (0x1ul << USBD_CEPINTSTS_PINGIF_Pos)              /*!< USBD CEPINTSTS: PINGIF Mask            */
+
+#define USBD_CEPINTSTS_TXPKIF_Pos        (5)                                               /*!< USBD CEPINTSTS: TXPKIF Position        */
+#define USBD_CEPINTSTS_TXPKIF_Msk        (0x1ul << USBD_CEPINTSTS_TXPKIF_Pos)              /*!< USBD CEPINTSTS: TXPKIF Mask            */
+
+#define USBD_CEPINTSTS_RXPKIF_Pos        (6)                                               /*!< USBD CEPINTSTS: RXPKIF Position        */
+#define USBD_CEPINTSTS_RXPKIF_Msk        (0x1ul << USBD_CEPINTSTS_RXPKIF_Pos)              /*!< USBD CEPINTSTS: RXPKIF Mask            */
+
+#define USBD_CEPINTSTS_NAKIF_Pos         (7)                                               /*!< USBD CEPINTSTS: NAKIF Position         */
+#define USBD_CEPINTSTS_NAKIF_Msk         (0x1ul << USBD_CEPINTSTS_NAKIF_Pos)               /*!< USBD CEPINTSTS: NAKIF Mask             */
+
+#define USBD_CEPINTSTS_STALLIF_Pos       (8)                                               /*!< USBD CEPINTSTS: STALLIF Position       */
+#define USBD_CEPINTSTS_STALLIF_Msk       (0x1ul << USBD_CEPINTSTS_STALLIF_Pos)             /*!< USBD CEPINTSTS: STALLIF Mask           */
+
+#define USBD_CEPINTSTS_ERRIF_Pos         (9)                                               /*!< USBD CEPINTSTS: ERRIF Position         */
+#define USBD_CEPINTSTS_ERRIF_Msk         (0x1ul << USBD_CEPINTSTS_ERRIF_Pos)               /*!< USBD CEPINTSTS: ERRIF Mask             */
+
+#define USBD_CEPINTSTS_STSDONEIF_Pos     (10)                                              /*!< USBD CEPINTSTS: STSDONEIF Position     */
+#define USBD_CEPINTSTS_STSDONEIF_Msk     (0x1ul << USBD_CEPINTSTS_STSDONEIF_Pos)           /*!< USBD CEPINTSTS: STSDONEIF Mask         */
+
+#define USBD_CEPINTSTS_BUFFULLIF_Pos     (11)                                              /*!< USBD CEPINTSTS: BUFFULLIF Position     */
+#define USBD_CEPINTSTS_BUFFULLIF_Msk     (0x1ul << USBD_CEPINTSTS_BUFFULLIF_Pos)           /*!< USBD CEPINTSTS: BUFFULLIF Mask         */
+
+#define USBD_CEPINTSTS_BUFEMPTYIF_Pos    (12)                                              /*!< USBD CEPINTSTS: BUFEMPTYIF Position    */
+#define USBD_CEPINTSTS_BUFEMPTYIF_Msk    (0x1ul << USBD_CEPINTSTS_BUFEMPTYIF_Pos)          /*!< USBD CEPINTSTS: BUFEMPTYIF Mask        */
+
+#define USBD_CEPTXCNT_TXCNT_Pos          (0)                                               /*!< USBD CEPTXCNT: TXCNT Position          */
+#define USBD_CEPTXCNT_TXCNT_Msk          (0xfful << USBD_CEPTXCNT_TXCNT_Pos)               /*!< USBD CEPTXCNT: TXCNT Mask              */
+
+#define USBD_CEPRXCNT_RXCNT_Pos          (0)                                               /*!< USBD CEPRXCNT: RXCNT Position          */
+#define USBD_CEPRXCNT_RXCNT_Msk          (0xfful << USBD_CEPRXCNT_RXCNT_Pos)               /*!< USBD CEPRXCNT: RXCNT Mask              */
+
+#define USBD_CEPDATCNT_DATCNT_Pos        (0)                                               /*!< USBD CEPDATCNT: DATCNT Position        */
+#define USBD_CEPDATCNT_DATCNT_Msk        (0xfffful << USBD_CEPDATCNT_DATCNT_Pos)           /*!< USBD CEPDATCNT: DATCNT Mask            */
+
+#define USBD_SETUP1_0_SETUP0_Pos         (0)                                               /*!< USBD SETUP1_0: SETUP0 Position         */
+#define USBD_SETUP1_0_SETUP0_Msk         (0xfful << USBD_SETUP1_0_SETUP0_Pos)              /*!< USBD SETUP1_0: SETUP0 Mask             */
+
+#define USBD_SETUP1_0_SETUP1_Pos         (8)                                               /*!< USBD SETUP1_0: SETUP1 Position         */
+#define USBD_SETUP1_0_SETUP1_Msk         (0xfful << USBD_SETUP1_0_SETUP1_Pos)              /*!< USBD SETUP1_0: SETUP1 Mask             */
+
+#define USBD_SETUP3_2_SETUP2_Pos         (0)                                               /*!< USBD SETUP3_2: SETUP2 Position         */
+#define USBD_SETUP3_2_SETUP2_Msk         (0xfful << USBD_SETUP3_2_SETUP2_Pos)              /*!< USBD SETUP3_2: SETUP2 Mask             */
+
+#define USBD_SETUP3_2_SETUP3_Pos         (8)                                               /*!< USBD SETUP3_2: SETUP3 Position         */
+#define USBD_SETUP3_2_SETUP3_Msk         (0xfful << USBD_SETUP3_2_SETUP3_Pos)              /*!< USBD SETUP3_2: SETUP3 Mask             */
+
+#define USBD_SETUP5_4_SETUP4_Pos         (0)                                               /*!< USBD SETUP5_4: SETUP4 Position         */
+#define USBD_SETUP5_4_SETUP4_Msk         (0xfful << USBD_SETUP5_4_SETUP4_Pos)              /*!< USBD SETUP5_4: SETUP4 Mask             */
+
+#define USBD_SETUP5_4_SETUP5_Pos         (8)                                               /*!< USBD SETUP5_4: SETUP5 Position         */
+#define USBD_SETUP5_4_SETUP5_Msk         (0xfful << USBD_SETUP5_4_SETUP5_Pos)              /*!< USBD SETUP5_4: SETUP5 Mask             */
+
+#define USBD_SETUP7_6_SETUP6_Pos         (0)                                               /*!< USBD SETUP7_6: SETUP6 Position         */
+#define USBD_SETUP7_6_SETUP6_Msk         (0xfful << USBD_SETUP7_6_SETUP6_Pos)              /*!< USBD SETUP7_6: SETUP6 Mask             */
+
+#define USBD_SETUP7_6_SETUP7_Pos         (8)                                               /*!< USBD SETUP7_6: SETUP7 Position         */
+#define USBD_SETUP7_6_SETUP7_Msk         (0xfful << USBD_SETUP7_6_SETUP7_Pos)              /*!< USBD SETUP7_6: SETUP7 Mask             */
+
+#define USBD_CEPBUFSTART_SADDR_Pos       (0)                                               /*!< USBD CEPBUFSTART: SADDR Position       */
+#define USBD_CEPBUFSTART_SADDR_Msk       (0xffful << USBD_CEPBUFSTART_SADDR_Pos)           /*!< USBD CEPBUFSTART: SADDR Mask           */
+
+#define USBD_CEPBUFEND_EADDR_Pos         (0)                                               /*!< USBD CEPBUFEND: EADDR Position         */
+#define USBD_CEPBUFEND_EADDR_Msk         (0xffful << USBD_CEPBUFEND_EADDR_Pos)             /*!< USBD CEPBUFEND: EADDR Mask             */
+
+#define USBD_DMACTL_EPNUM_Pos            (0)                                               /*!< USBD DMACTL: EPNUM Position            */
+#define USBD_DMACTL_EPNUM_Msk            (0xful << USBD_DMACTL_EPNUM_Pos)                  /*!< USBD DMACTL: EPNUM Mask                */
+
+#define USBD_DMACTL_DMARD_Pos            (4)                                               /*!< USBD DMACTL: DMARD Position            */
+#define USBD_DMACTL_DMARD_Msk            (0x1ul << USBD_DMACTL_DMARD_Pos)                  /*!< USBD DMACTL: DMARD Mask                */
+
+#define USBD_DMACTL_DMAEN_Pos            (5)                                               /*!< USBD DMACTL: DMAEN Position            */
+#define USBD_DMACTL_DMAEN_Msk            (0x1ul << USBD_DMACTL_DMAEN_Pos)                  /*!< USBD DMACTL: DMAEN Mask                */
+
+#define USBD_DMACTL_SGEN_Pos             (6)                                               /*!< USBD DMACTL: SGEN Position             */
+#define USBD_DMACTL_SGEN_Msk             (0x1ul << USBD_DMACTL_SGEN_Pos)                   /*!< USBD DMACTL: SGEN Mask                 */
+
+#define USBD_DMACTL_DMARST_Pos           (7)                                               /*!< USBD DMACTL: DMARST Position           */
+#define USBD_DMACTL_DMARST_Msk           (0x1ul << USBD_DMACTL_DMARST_Pos)                 /*!< USBD DMACTL: DMARST Mask               */
+
+#define USBD_DMACNT_DMACNT_Pos           (0)                                               /*!< USBD DMACNT: DMACNT Position           */
+#define USBD_DMACNT_DMACNT_Msk           (0xffffful << USBD_DMACNT_DMACNT_Pos)             /*!< USBD DMACNT: DMACNT Mask               */
+
+#define USBD_EPDAT_EPDAT_Pos             (0)                                               /*!< USBD EPDAT: EPDAT Position            */
+#define USBD_EPDAT_EPDAT_Msk             (0xfffffffful << USBD_EPDAT_EPDAT_Pos)            /*!< USBD EPDAT: EPDAT Mask                */
+
+#define USBD_EPINTSTS_BUFFULLIF_Pos      (0)                                               /*!< USBD EPINTSTS: BUFFULLIF Position     */
+#define USBD_EPINTSTS_BUFFULLIF_Msk      (0x1ul << USBD_EPINTSTS_BUFFULLIF_Pos)            /*!< USBD EPINTSTS: BUFFULLIF Mask         */
+
+#define USBD_EPINTSTS_BUFEMPTYIF_Pos     (1)                                               /*!< USBD EPINTSTS: BUFEMPTYIF Position    */
+#define USBD_EPINTSTS_BUFEMPTYIF_Msk     (0x1ul << USBD_EPINTSTS_BUFEMPTYIF_Pos)           /*!< USBD EPINTSTS: BUFEMPTYIF Mask        */
+
+#define USBD_EPINTSTS_SHORTTXIF_Pos      (2)                                               /*!< USBD EPINTSTS: SHORTTXIF Position     */
+#define USBD_EPINTSTS_SHORTTXIF_Msk      (0x1ul << USBD_EPINTSTS_SHORTTXIF_Pos)            /*!< USBD EPINTSTS: SHORTTXIF Mask         */
+
+#define USBD_EPINTSTS_TXPKIF_Pos         (3)                                               /*!< USBD EPINTSTS: TXPKIF Position        */
+#define USBD_EPINTSTS_TXPKIF_Msk         (0x1ul << USBD_EPINTSTS_TXPKIF_Pos)               /*!< USBD EPINTSTS: TXPKIF Mask            */
+
+#define USBD_EPINTSTS_RXPKIF_Pos         (4)                                               /*!< USBD EPINTSTS: RXPKIF Position        */
+#define USBD_EPINTSTS_RXPKIF_Msk         (0x1ul << USBD_EPINTSTS_RXPKIF_Pos)               /*!< USBD EPINTSTS: RXPKIF Mask            */
+
+#define USBD_EPINTSTS_OUTTKIF_Pos        (5)                                               /*!< USBD EPINTSTS: OUTTKIF Position       */
+#define USBD_EPINTSTS_OUTTKIF_Msk        (0x1ul << USBD_EPINTSTS_OUTTKIF_Pos)              /*!< USBD EPINTSTS: OUTTKIF Mask           */
+
+#define USBD_EPINTSTS_INTKIF_Pos         (6)                                               /*!< USBD EPINTSTS: INTKIF Position        */
+#define USBD_EPINTSTS_INTKIF_Msk         (0x1ul << USBD_EPINTSTS_INTKIF_Pos)               /*!< USBD EPINTSTS: INTKIF Mask            */
+
+#define USBD_EPINTSTS_PINGIF_Pos         (7)                                               /*!< USBD EPINTSTS: PINGIF Position        */
+#define USBD_EPINTSTS_PINGIF_Msk         (0x1ul << USBD_EPINTSTS_PINGIF_Pos)               /*!< USBD EPINTSTS: PINGIF Mask            */
+
+#define USBD_EPINTSTS_NAKIF_Pos          (8)                                               /*!< USBD EPINTSTS: NAKIF Position         */
+#define USBD_EPINTSTS_NAKIF_Msk          (0x1ul << USBD_EPINTSTS_NAKIF_Pos)                /*!< USBD EPINTSTS: NAKIF Mask             */
+
+#define USBD_EPINTSTS_STALLIF_Pos        (9)                                               /*!< USBD EPINTSTS: STALLIF Position       */
+#define USBD_EPINTSTS_STALLIF_Msk        (0x1ul << USBD_EPINTSTS_STALLIF_Pos)              /*!< USBD EPINTSTS: STALLIF Mask           */
+
+#define USBD_EPINTSTS_NYETIF_Pos         (10)                                              /*!< USBD EPINTSTS: NYETIF Position        */
+#define USBD_EPINTSTS_NYETIF_Msk         (0x1ul << USBD_EPINTSTS_NYETIF_Pos)               /*!< USBD EPINTSTS: NYETIF Mask            */
+
+#define USBD_EPINTSTS_ERRIF_Pos          (11)                                              /*!< USBD EPINTSTS: ERRIF Position         */
+#define USBD_EPINTSTS_ERRIF_Msk          (0x1ul << USBD_EPINTSTS_ERRIF_Pos)                /*!< USBD EPINTSTS: ERRIF Mask             */
+
+#define USBD_EPINTSTS_SHORTRXIF_Pos      (12)                                              /*!< USBD EPINTSTS: SHORTRXIF Position     */
+#define USBD_EPINTSTS_SHORTRXIF_Msk      (0x1ul << USBD_EPINTSTS_SHORTRXIF_Pos)            /*!< USBD EPINTSTS: SHORTRXIF Mask         */
+
+#define USBD_EPINTEN_BUFFULLIEN_Pos      (0)                                               /*!< USBD EPINTEN: BUFFULLIEN Position     */
+#define USBD_EPINTEN_BUFFULLIEN_Msk      (0x1ul << USBD_EPINTEN_BUFFULLIEN_Pos)            /*!< USBD EPINTEN: BUFFULLIEN Mask         */
+
+#define USBD_EPINTEN_BUFEMPTYIEN_Pos     (1)                                               /*!< USBD EPINTEN: BUFEMPTYIEN Position    */
+#define USBD_EPINTEN_BUFEMPTYIEN_Msk     (0x1ul << USBD_EPINTEN_BUFEMPTYIEN_Pos)           /*!< USBD EPINTEN: BUFEMPTYIEN Mask        */
+
+#define USBD_EPINTEN_SHORTTXIEN_Pos      (2)                                               /*!< USBD EPINTEN: SHORTTXIEN Position     */
+#define USBD_EPINTEN_SHORTTXIEN_Msk      (0x1ul << USBD_EPINTEN_SHORTTXIEN_Pos)            /*!< USBD EPINTEN: SHORTTXIEN Mask         */
+
+#define USBD_EPINTEN_TXPKIEN_Pos         (3)                                               /*!< USBD EPINTEN: TXPKIEN Position        */
+#define USBD_EPINTEN_TXPKIEN_Msk         (0x1ul << USBD_EPINTEN_TXPKIEN_Pos)               /*!< USBD EPINTEN: TXPKIEN Mask            */
+
+#define USBD_EPINTEN_RXPKIEN_Pos         (4)                                               /*!< USBD EPINTEN: RXPKIEN Position        */
+#define USBD_EPINTEN_RXPKIEN_Msk         (0x1ul << USBD_EPINTEN_RXPKIEN_Pos)               /*!< USBD EPINTEN: RXPKIEN Mask            */
+
+#define USBD_EPINTEN_OUTTKIEN_Pos        (5)                                               /*!< USBD EPINTEN: OUTTKIEN Position       */
+#define USBD_EPINTEN_OUTTKIEN_Msk        (0x1ul << USBD_EPINTEN_OUTTKIEN_Pos)              /*!< USBD EPINTEN: OUTTKIEN Mask           */
+
+#define USBD_EPINTEN_INTKIEN_Pos         (6)                                               /*!< USBD EPINTEN: INTKIEN Position        */
+#define USBD_EPINTEN_INTKIEN_Msk         (0x1ul << USBD_EPINTEN_INTKIEN_Pos)               /*!< USBD EPINTEN: INTKIEN Mask            */
+
+#define USBD_EPINTEN_PINGIEN_Pos         (7)                                               /*!< USBD EPINTEN: PINGIEN Position        */
+#define USBD_EPINTEN_PINGIEN_Msk         (0x1ul << USBD_EPINTEN_PINGIEN_Pos)               /*!< USBD EPINTEN: PINGIEN Mask            */
+
+#define USBD_EPINTEN_NAKIEN_Pos          (8)                                               /*!< USBD EPINTEN: NAKIEN Position         */
+#define USBD_EPINTEN_NAKIEN_Msk          (0x1ul << USBD_EPINTEN_NAKIEN_Pos)                /*!< USBD EPINTEN: NAKIEN Mask             */
+
+#define USBD_EPINTEN_STALLIEN_Pos        (9)                                               /*!< USBD EPINTEN: STALLIEN Position       */
+#define USBD_EPINTEN_STALLIEN_Msk        (0x1ul << USBD_EPINTEN_STALLIEN_Pos)              /*!< USBD EPINTEN: STALLIEN Mask           */
+
+#define USBD_EPINTEN_NYETIEN_Pos         (10)                                              /*!< USBD EPINTEN: NYETIEN Position        */
+#define USBD_EPINTEN_NYETIEN_Msk         (0x1ul << USBD_EPINTEN_NYETIEN_Pos)               /*!< USBD EPINTEN: NYETIEN Mask            */
+
+#define USBD_EPINTEN_ERRIEN_Pos          (11)                                              /*!< USBD EPINTEN: ERRIEN Position         */
+#define USBD_EPINTEN_ERRIEN_Msk          (0x1ul << USBD_EPINTEN_ERRIEN_Pos)                /*!< USBD EPINTEN: ERRIEN Mask             */
+
+#define USBD_EPINTEN_SHORTRXIEN_Pos      (12)                                              /*!< USBD EPINTEN: SHORTRXIEN Position     */
+#define USBD_EPINTEN_SHORTRXIEN_Msk      (0x1ul << USBD_EPINTEN_SHORTRXIEN_Pos)            /*!< USBD EPINTEN: SHORTRXIEN Mask         */
+
+#define USBD_EPDATCNT_DATCNT_Pos         (0)                                               /*!< USBD EPDATCNT: DATCNT Position        */
+#define USBD_EPDATCNT_DATCNT_Msk         (0xfffful << USBD_EPDATCNT_DATCNT_Pos)            /*!< USBD EPDATCNT: DATCNT Mask            */
+
+#define USBD_EPDATCNT_DMALOOP_Pos        (16)                                              /*!< USBD EPDATCNT: DMALOOP Position       */
+#define USBD_EPDATCNT_DMALOOP_Msk        (0x7ffful << USBD_EPDATCNT_DMALOOP_Pos)           /*!< USBD EPDATCNT: DMALOOP Mask           */
+
+#define USBD_EPRSPCTL_FLUSH_Pos          (0)                                               /*!< USBD EPRSPCTL: FLUSH Position         */
+#define USBD_EPRSPCTL_FLUSH_Msk          (0x1ul << USBD_EPRSPCTL_FLUSH_Pos)                /*!< USBD EPRSPCTL: FLUSH Mask             */
+
+#define USBD_EPRSPCTL_MODE_Pos           (1)                                               /*!< USBD EPRSPCTL: MODE Position          */
+#define USBD_EPRSPCTL_MODE_Msk           (0x3ul << USBD_EPRSPCTL_MODE_Pos)                 /*!< USBD EPRSPCTL: MODE Mask              */
+
+#define USBD_EPRSPCTL_TOGGLE_Pos         (3)                                               /*!< USBD EPRSPCTL: TOGGLE Position        */
+#define USBD_EPRSPCTL_TOGGLE_Msk         (0x1ul << USBD_EPRSPCTL_TOGGLE_Pos)               /*!< USBD EPRSPCTL: TOGGLE Mask            */
+
+#define USBD_EPRSPCTL_HALT_Pos           (4)                                               /*!< USBD EPRSPCTL: HALT Position          */
+#define USBD_EPRSPCTL_HALT_Msk           (0x1ul << USBD_EPRSPCTL_HALT_Pos)                 /*!< USBD EPRSPCTL: HALT Mask              */
+
+#define USBD_EPRSPCTL_ZEROLEN_Pos        (5)                                               /*!< USBD EPRSPCTL: ZEROLEN Position       */
+#define USBD_EPRSPCTL_ZEROLEN_Msk        (0x1ul << USBD_EPRSPCTL_ZEROLEN_Pos)              /*!< USBD EPRSPCTL: ZEROLEN Mask           */
+
+#define USBD_EPRSPCTL_SHORTTXEN_Pos      (6)                                               /*!< USBD EPRSPCTL: SHORTTXEN Position     */
+#define USBD_EPRSPCTL_SHORTTXEN_Msk      (0x1ul << USBD_EPRSPCTL_SHORTTXEN_Pos)            /*!< USBD EPRSPCTL: SHORTTXEN Mask         */
+
+#define USBD_EPRSPCTL_DISBUF_Pos         (7)                                               /*!< USBD EPRSPCTL: DISBUF Position        */
+#define USBD_EPRSPCTL_DISBUF_Msk         (0x1ul << USBD_EPRSPCTL_DISBUF_Pos)               /*!< USBD EPRSPCTL: DISBUF Mask            */
+
+#define USBD_EPMPS_EPMPS_Pos             (0)                                               /*!< USBD EPMPS: EPMPS Position            */
+#define USBD_EPMPS_EPMPS_Msk             (0x7fful << USBD_EPMPS_EPMPS_Pos)                 /*!< USBD EPMPS: EPMPS Mask                */
+
+#define USBD_EPTXCNT_TXCNT_Pos           (0)                                               /*!< USBD EPTXCNT: TXCNT Position          */
+#define USBD_EPTXCNT_TXCNT_Msk           (0x7fful << USBD_EPTXCNT_TXCNT_Pos)               /*!< USBD EPTXCNT: TXCNT Mask              */
+
+#define USBD_EPCFG_EPEN_Pos              (0)                                               /*!< USBD EPCFG: EPEN Position             */
+#define USBD_EPCFG_EPEN_Msk              (0x1ul << USBD_EPCFG_EPEN_Pos)                    /*!< USBD EPCFG: EPEN Mask                 */
+
+#define USBD_EPCFG_EPTYPE_Pos            (1)                                               /*!< USBD EPCFG: EPTYPE Position           */
+#define USBD_EPCFG_EPTYPE_Msk            (0x3ul << USBD_EPCFG_EPTYPE_Pos)                  /*!< USBD EPCFG: EPTYPE Mask               */
+
+#define USBD_EPCFG_EPDIR_Pos             (3)                                               /*!< USBD EPCFG: EPDIR Position            */
+#define USBD_EPCFG_EPDIR_Msk             (0x1ul << USBD_EPCFG_EPDIR_Pos)                   /*!< USBD EPCFG: EPDIR Mask                */
+
+#define USBD_EPCFG_EPNUM_Pos             (4)                                               /*!< USBD EPCFG: EPNUM Position            */
+#define USBD_EPCFG_EPNUM_Msk             (0xful << USBD_EPCFG_EPNUM_Pos)                   /*!< USBD EPCFG: EPNUM Mask                */
+
+#define USBD_EPBUFSTART_SADDR_Pos        (0)                                               /*!< USBD EPBUFSTART: SADDR Position       */
+#define USBD_EPBUFSTART_SADDR_Msk        (0xffful << USBD_EPBUFSTART_SADDR_Pos)            /*!< USBD EPBUFSTART: SADDR Mask           */
+
+#define USBD_EPBUFEND_EADDR_Pos          (0)                                               /*!< USBD EPBUFEND: EADDR Position         */
+#define USBD_EPBUFEND_EADDR_Msk          (0xffful << USBD_EPBUFEND_EADDR_Pos)              /*!< USBD EPBUFEND: EADDR Mask             */
+
+#define USBD_DMAADDR_DMAADDR_Pos         (0)                                               /*!< USBD DMAADDR: DMAADDR Position         */
+#define USBD_DMAADDR_DMAADDR_Msk         (0xfffffffful << USBD_DMAADDR_DMAADDR_Pos)        /*!< USBD DMAADDR: DMAADDR Mask             */
+
+#define USBD_PHYCTL_DPPUEN_Pos           (8)                                               /*!< USBD PHYCTL: DPPUEN Position           */
+#define USBD_PHYCTL_DPPUEN_Msk           (0x1ul << USBD_PHYCTL_DPPUEN_Pos)                 /*!< USBD PHYCTL: DPPUEN Mask               */
+
+#define USBD_PHYCTL_PHYEN_Pos            (9)                                               /*!< USBD PHYCTL: PHYEN Position            */
+#define USBD_PHYCTL_PHYEN_Msk            (0x1ul << USBD_PHYCTL_PHYEN_Pos)                  /*!< USBD PHYCTL: PHYEN Mask                */
+
+#define USBD_PHYCTL_WKEN_Pos             (24)                                              /*!< USBD PHYCTL: WKEN Position             */
+#define USBD_PHYCTL_WKEN_Msk             (0x1ul << USBD_PHYCTL_WKEN_Pos)                   /*!< USBD PHYCTL: WKEN Mask                 */
+
+#define USBD_PHYCTL_VBUSDET_Pos          (31)                                              /*!< USBD PHYCTL: VBUSDET Position          */
+#define USBD_PHYCTL_VBUSDET_Msk          (0x1ul << USBD_PHYCTL_VBUSDET_Pos)                /*!< USBD PHYCTL: VBUSDET Mask              */
+
+/** @addtogroup USBD_EXPORTED_MACROS USBD Exported Macros
+  @{
+*/
+
+#define USBD_ENABLE_USB()               ((uint32_t)(USBD->PHYCTL |= (USBD_PHYCTL_PHYEN_Msk|USBD_PHYCTL_DPPUEN_Msk))) /*!<Enable USB  \hideinitializer */
+#define USBD_DISABLE_USB()              ((uint32_t)(USBD->PHYCTL &= ~USBD_PHYCTL_DPPUEN_Msk)) /*!<Disable USB  \hideinitializer */
+#define USBD_ENABLE_PHY()               ((uint32_t)(USBD->PHYCTL |= USBD_PHYCTL_PHYEN_Msk)) /*!<Enable PHY  \hideinitializer */
+#define USBD_DISABLE_PHY()              ((uint32_t)(USBD->PHYCTL &= ~USBD_PHYCTL_PHYEN_Msk)) /*!<Disable PHY  \hideinitializer */
+#define USBD_SET_SE0()                  ((uint32_t)(USBD->PHYCTL &= ~USBD_PHYCTL_DPPUEN_Msk)) /*!<Enable SE0, Force USB PHY Transceiver to Drive SE0  \hideinitializer */
+#define USBD_CLR_SE0()                  ((uint32_t)(USBD->PHYCTL |= USBD_PHYCTL_DPPUEN_Msk)) /*!<Disable SE0  \hideinitializer */
+#define USBD_SET_ADDR(addr)             (USBD->FADDR = (addr)) /*!<Set USB address  \hideinitializer */
+#define USBD_GET_ADDR()                 ((uint32_t)(USBD->FADDR)) /*!<Get USB address  \hideinitializer */
+#define USBD_ENABLE_USB_INT(intr)       (USBD->GINTEN = (intr)) /*!<Enable USB Interrupt  \hideinitializer */
+#define USBD_ENABLE_BUS_INT(intr)       (USBD->BUSINTEN = (intr)) /*!<Enable BUS Interrupt  \hideinitializer */
+#define USBD_GET_BUS_INT_FLAG()         (USBD->BUSINTSTS)        /*!<Clear Bus interrupt flag  \hideinitializer */
+#define USBD_CLR_BUS_INT_FLAG(flag)     (USBD->BUSINTSTS = flag) /*!<Clear Bus interrupt flag  \hideinitializer */
+#define USBD_ENABLE_CEP_INT(intr)       (USBD->CEPINTEN = (intr)) /*!<Enable CEP Interrupt  \hideinitializer */
+#define USBD_CLR_CEP_INT_FLAG(flag)     (USBD->CEPINTSTS = flag) /*!<Clear CEP interrupt flag  \hideinitializer */
+#define USBD_SET_CEP_STATE(flag)        (USBD->CEPCTL = flag) /*!<Set CEP state  \hideinitializer */
+#define USBD_START_CEP_IN(size)         (USBD->CEPTXCNT = size) /*!<Start CEP IN Transfer  \hideinitializer */
+#define USBD_SET_MAX_PAYLOAD(ep, size)  (USBD->EP[ep].EPMPS = (size)) /*!<Set EPx Maximum Packet Size  \hideinitializer */
+#define USBD_ENABLE_EP_INT(ep, intr)    (USBD->EP[ep].EPINTEN = (intr)) /*!<Enable EPx Interrupt  \hideinitializer */
+#define USBD_GET_EP_INT_FLAG(ep)        (USBD->EP[ep].EPINTSTS) /*!<Get EPx interrupt flag  \hideinitializer */
+#define USBD_CLR_EP_INT_FLAG(ep, flag)  (USBD->EP[ep].EPINTSTS = (flag)) /*!<Clear EPx interrupt flag  \hideinitializer */
+#define USBD_SET_DMA_LEN(len)           (USBD->DMACNT = len) /*!<Set DMA transfer length  \hideinitializer */
+#define USBD_SET_DMA_ADDR(addr)         (USBD->DMAADDR = addr) /*!<Set DMA transfer address  \hideinitializer */
+#define USBD_SET_DMA_READ(epnum)        (USBD->DMACTL = (USBD->DMACTL & ~USBD_DMACTL_EPNUM_Msk) | USBD_DMACTL_DMARD_Msk | epnum | 0x100) /*!<Set DMA transfer type to read \hideinitializer */
+#define USBD_SET_DMA_WRITE(epnum)       (USBD->DMACTL = (USBD->DMACTL & ~(USBD_DMACTL_EPNUM_Msk | USBD_DMACTL_DMARD_Msk | 0x100)) | epnum) /*!<Set DMA transfer type to write \hideinitializer */
+#define USBD_ENABLE_DMA()               (USBD->DMACTL |= USBD_DMACTL_DMAEN_Msk) /*!<Enable DMA transfer  \hideinitializer */
+#define USBD_IS_ATTACHED()              ((uint32_t)(USBD->PHYCTL & USBD_PHYCTL_VBUSDET_Msk)) /*!<Check cable connect state  \hideinitializer */
+
+/*@}*/ /* end of group USBD_EXPORTED_MACROS */
+
+/** @addtogroup USBD_EXPORTED_FUNCTIONS USBD Exported Functions
+  @{
+*/
+/**
+  * @brief  USBD_memcpy, Copy bytes hardware limitation
+  * @param[in]  u8Dst   Destination pointer.
+  * @param[in]  u8Src   Source pointer.
+  * @param[in]  i32Size Copy size.
+  * @retval None.
+  */
+static __inline void USBD_MemCopy(uint8_t *u8Dst, uint8_t *u8Src, int32_t i32Size)
+{
+    while (i32Size--) *u8Dst++ = *u8Src++;
+}
+
+/**
+  * @brief  USBD_ResetDMA
+  * @param  None
+  * @retval None.
+  */
+static __inline void USBD_ResetDMA(void)
+{
+    USBD->DMACNT = 0;
+    USBD->DMACTL = 0x80;
+    USBD->DMACTL = 0x00;
+}
+/**
+  * @brief  USBD_SetEpBufAddr, Set Endpoint buffer address
+  * @param[in]  u32Ep      Endpoint Number
+  * @param[in]  u32Base    Buffer Start Address
+  * @param[in]  u32Len     Buffer length
+  * @retval None.
+  */
+static __inline void USBD_SetEpBufAddr(uint32_t u32Ep, uint32_t u32Base, uint32_t u32Len)
+{
+    if (u32Ep == CEP)
+    {
+        USBD->CEPBUFSTART = u32Base;
+        USBD->CEPBUFEND   = u32Base + u32Len - 1;
+    }
+    else
+    {
+        USBD->EP[u32Ep].EPBUFSTART = u32Base;
+        USBD->EP[u32Ep].EPBUFEND = u32Base + u32Len - 1;
+    }
+}
+
+/**
+  * @brief  USBD_ConfigEp, Config Endpoint
+  * @param[in]  u32Ep      USB endpoint
+  * @param[in]  u32EpNum   Endpoint number
+  * @param[in]  u32EpType  Endpoint type
+  * @param[in]  u32EpDir   Endpoint direction
+  * @retval None.
+  */
+static __inline void USBD_ConfigEp(uint32_t u32Ep, uint32_t u32EpNum, uint32_t u32EpType, uint32_t u32EpDir)
+{
+    if (u32EpType == USB_EP_CFG_TYPE_BULK)
+        USBD->EP[u32Ep].EPRSPCTL = (USB_EP_RSPCTL_FLUSH | USB_EP_RSPCTL_MODE_AUTO);
+    else if (u32EpType == USB_EP_CFG_TYPE_INT)
+        USBD->EP[u32Ep].EPRSPCTL = (USB_EP_RSPCTL_FLUSH | USB_EP_RSPCTL_MODE_MANUAL);
+    else if (u32EpType == USB_EP_CFG_TYPE_ISO)
+        USBD->EP[u32Ep].EPRSPCTL = (USB_EP_RSPCTL_FLUSH | USB_EP_RSPCTL_MODE_FLY);
+
+    USBD->EP[u32Ep].EPCFG = (u32EpType | u32EpDir | USB_EP_CFG_VALID | (u32EpNum << 4));
+}
+
+/**
+  * @brief       Set USB endpoint stall state
+  * @param[in]   u32Ep  The USB endpoint ID.
+  * @return      None
+  * @details     Set USB endpoint stall state for the specified endpoint ID. Endpoint will respond STALL token automatically.
+  */
+static __inline void USBD_SetEpStall(uint32_t u32Ep)
+{
+    if (u32Ep == CEP)
+        USBD_SET_CEP_STATE(USB_CEPCTL_STALL);
+    else
+    {
+        USBD->EP[u32Ep].EPRSPCTL = (USBD->EP[u32Ep].EPRSPCTL & 0xf7) | USB_EP_RSPCTL_HALT;
+    }
+}
+
+/**
+ * @brief       Set USB endpoint stall state
+ *
+ * @param[in]   u32EpNum         USB endpoint
+ * @return      None
+ *
+ * @details     Set USB endpoint stall state, endpoint will return STALL token.
+ */
+static __inline void USBD_SetStall(uint32_t u32EpNum)
+{
+    int i;
+
+    if (u32EpNum == 0)
+        USBD_SET_CEP_STATE(USB_CEPCTL_STALL);
+    else
+    {
+        for (i = 0; i < USBD_MAX_EP; i++)
+        {
+            if (((USBD->EP[i].EPCFG & 0xf0) >> 4) == u32EpNum)
+            {
+                USBD->EP[i].EPRSPCTL = USBD->EP[i].EPRSPCTL & 0xf7 | USB_EP_RSPCTL_HALT;
+            }
+        }
+    }
+}
+
+/**
+  * @brief       Clear USB endpoint stall state
+  * @param[in]   u32Ep  The USB endpoint ID.
+  * @return      None
+  * @details     Clear USB endpoint stall state for the specified endpoint ID. Endpoint will respond ACK/NAK token.
+  */
+static __inline void  USBD_ClearEpStall(uint32_t u32Ep)
+{
+    USBD->EP[u32Ep].EPRSPCTL = USB_EP_RSPCTL_TOGGLE;
+}
+
+/**
+ * @brief       Clear USB endpoint stall state
+ *
+ * @param[in]   u32EpNum         USB endpoint
+ * @return      None
+ *
+ * @details     Clear USB endpoint stall state, endpoint will return ACK/NAK token.
+ */
+static __inline void USBD_ClearStall(uint32_t u32EpNum)
+{
+    int i;
+
+    for (i = 0; i < USBD_MAX_EP; i++)
+    {
+        if (((USBD->EP[i].EPCFG & 0xf0) >> 4) == u32EpNum)
+        {
+            USBD->EP[i].EPRSPCTL = USB_EP_RSPCTL_TOGGLE;
+        }
+    }
+}
+
+/**
+  * @brief       Get USB endpoint stall state
+  * @param[in]   u32Ep  The USB endpoint ID.
+  * @retval      0      USB endpoint is not stalled.
+  * @retval      Others USB endpoint is stalled.
+  * @details     Get USB endpoint stall state of the specified endpoint ID.
+  */
+static __inline uint32_t USBD_GetEpStall(uint32_t u32Ep)
+{
+    return (USBD->EP[u32Ep].EPRSPCTL & USB_EP_RSPCTL_HALT);
+}
+
+/**
+ * @brief       Get USB endpoint stall state
+ *
+ * @param[in]   u32EpNum         USB endpoint
+ * @retval      0: USB endpoint is not stalled.
+ * @retval      non-0: USB endpoint is stalled.
+ *
+ * @details     Get USB endpoint stall state.
+ */
+static __inline uint32_t USBD_GetStall(uint32_t u32EpNum)
+{
+    int i;
+
+    for (i = 0; i < USBD_MAX_EP; i++)
+    {
+        if (((USBD->EP[i].EPCFG & 0xf0) >> 4) == u32EpNum)
+        {
+            return (USBD->EP[i].EPRSPCTL & USB_EP_RSPCTL_HALT);
+        }
+    }
+    return 0;
+}
+
+
+/*-------------------------------------------------------------------------------------------*/
+typedef void (*VENDOR_REQ)(void); /*!<USB Vendor request callback function */
+typedef void (*CLASS_REQ)(void); /*!<USB Class request callback function */
+typedef void (*SET_INTERFACE_REQ)(uint32_t u32AltInterface); /*!<USB Standard request "Set Interface" callback function */
+
+void USBD_Open(S_USBD_INFO_T *param, CLASS_REQ pfnClassReq, SET_INTERFACE_REQ pfnSetInterface);
+void USBD_Start(void);
+void USBD_ProcessSetupPacket(void);
+void USBD_StandardRequest(void);
+void USBD_UpdateDeviceState(void);
+void USBD_PrepareCtrlIn(uint8_t *pu8Buf, uint32_t u32Size);
+void USBD_CtrlIn(void);
+void USBD_CtrlOut(uint8_t *pu8Buf, uint32_t u32Size);
+void USBD_SwReset(void);
+void USBD_SetVendorRequest(VENDOR_REQ pfnVendorReq);
+
+
+
+/*@}*/ /* end of group USBD_EXPORTED_FUNCTIONS */
+
+/*@}*/ /* end of group USBD_Driver */
+
+/*@}*/ /* end of group Standard_Driver */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__NU_USBD_H__
+
+/*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov