Sen 10 hónapja
szülő
commit
7dafd86307
50 módosított fájl, 5161 hozzáadás és 18 törlés
  1. 1685 0
      MDK-ARM/Project.uvguix.x1361
  2. 273 8
      MDK-ARM/Project.uvoptx
  3. 120 10
      MDK-ARM/Project.uvprojx
  4. 16 0
      Src/user/emf_hal/CMakeLists.txt
  5. 29 0
      Src/user/emf_hal/Makefile
  6. 73 0
      Src/user/emf_hal/hal_adc.c
  7. 52 0
      Src/user/emf_hal/hal_adc.h
  8. 92 0
      Src/user/emf_hal/hal_audio.c
  9. 46 0
      Src/user/emf_hal/hal_audio.h
  10. 355 0
      Src/user/emf_hal/hal_bt.c
  11. 42 0
      Src/user/emf_hal/hal_bt.h
  12. 63 0
      Src/user/emf_hal/hal_flash.c
  13. 52 0
      Src/user/emf_hal/hal_flash.h
  14. 127 0
      Src/user/emf_hal/hal_gpio.c
  15. 52 0
      Src/user/emf_hal/hal_gpio.h
  16. 114 0
      Src/user/emf_hal/hal_iic_host.c
  17. 42 0
      Src/user/emf_hal/hal_iic_host.h
  18. 62 0
      Src/user/emf_hal/hal_log.c
  19. 48 0
      Src/user/emf_hal/hal_log.h
  20. 58 0
      Src/user/emf_hal/hal_mem.c
  21. 44 0
      Src/user/emf_hal/hal_mem.h
  22. 136 0
      Src/user/emf_hal/hal_os_timer.c
  23. 38 0
      Src/user/emf_hal/hal_os_timer.h
  24. 55 0
      Src/user/emf_hal/hal_pm.c
  25. 45 0
      Src/user/emf_hal/hal_pm.h
  26. 71 0
      Src/user/emf_hal/hal_pwm.c
  27. 46 0
      Src/user/emf_hal/hal_pwm.h
  28. 94 0
      Src/user/emf_hal/hal_spi_host.c
  29. 46 0
      Src/user/emf_hal/hal_spi_host.h
  30. 59 0
      Src/user/emf_hal/hal_system.c
  31. 51 0
      Src/user/emf_hal/hal_system.h
  32. 68 0
      Src/user/emf_hal/hal_tick.c
  33. 46 0
      Src/user/emf_hal/hal_tick.h
  34. 62 0
      Src/user/emf_hal/hal_timer.c
  35. 46 0
      Src/user/emf_hal/hal_timer.h
  36. 29 0
      Src/user/emf_hal/hal_typedef.h
  37. 78 0
      Src/user/emf_hal/hal_uart.c
  38. 46 0
      Src/user/emf_hal/hal_uart.h
  39. 57 0
      Src/user/emf_hal/hal_wdt.c
  40. 45 0
      Src/user/emf_hal/hal_wdt.h
  41. 16 0
      Src/user/emf_hal/usb/CMakeLists.txt
  42. 29 0
      Src/user/emf_hal/usb/Makefile
  43. 64 0
      Src/user/emf_hal/usb/hal_otg.c
  44. 46 0
      Src/user/emf_hal/usb/hal_otg.h
  45. 145 0
      Src/user/emf_hal/usb/hal_usbd.c
  46. 46 0
      Src/user/emf_hal/usb/hal_usbd.h
  47. 127 0
      Src/user/emf_hal/usb/hal_usbh.c
  48. 47 0
      Src/user/emf_hal/usb/hal_usbh.h
  49. 34 0
      Src/user/hw_board.h
  50. 44 0
      Src/user/hw_config.h

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1685 - 0
MDK-ARM/Project.uvguix.x1361


+ 273 - 8
MDK-ARM/Project.uvoptx

@@ -101,9 +101,7 @@
         <sRunDeb>0</sRunDeb>
         <sLrtime>0</sLrtime>
         <bEvRecOn>1</bEvRecOn>
-        <bSchkAxf>0</bSchkAxf>
-        <bTchkAxf>0</bTchkAxf>
-        <nTsel>3</nTsel>
+        <nTsel>2</nTsel>
         <sDll></sDll>
         <sDllPa></sDllPa>
         <sDlgDll></sDlgDll>
@@ -234,13 +232,8 @@
       <pszMrule></pszMrule>
       <pSingCmds></pSingCmds>
       <pMultCmds></pMultCmds>
-      <pMisraNamep></pMisraNamep>
-      <pszMrulep></pszMrulep>
-      <pSingCmdsp></pSingCmdsp>
-      <pMultCmdsp></pMultCmdsp>
       <DebugDescription>
         <Enable>1</Enable>
-        <EnableFlashSeq>1</EnableFlashSeq>
         <EnableLog>0</EnableLog>
         <Protocol>2</Protocol>
         <DbgClock>1000000</DbgClock>
@@ -378,6 +371,278 @@
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>10</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_hal.c</PathWithFileName>
+      <FilenameWithoutPath>py32f002b_hal.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>11</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_hal_flash.c</PathWithFileName>
+      <FilenameWithoutPath>py32f002b_hal_flash.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>12</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_ll_spi.c</PathWithFileName>
+      <FilenameWithoutPath>py32f002b_ll_spi.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>13</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_ll_exti.c</PathWithFileName>
+      <FilenameWithoutPath>py32f002b_ll_exti.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>14</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_hal_cortex.c</PathWithFileName>
+      <FilenameWithoutPath>py32f002b_hal_cortex.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+  </Group>
+
+  <Group>
+    <GroupName>emf_hal</GroupName>
+    <tvExp>1</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>15</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_adc.c</PathWithFileName>
+      <FilenameWithoutPath>hal_adc.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>16</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_uart.c</PathWithFileName>
+      <FilenameWithoutPath>hal_uart.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>17</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_timer.c</PathWithFileName>
+      <FilenameWithoutPath>hal_timer.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>18</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_tick.c</PathWithFileName>
+      <FilenameWithoutPath>hal_tick.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>19</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_system.c</PathWithFileName>
+      <FilenameWithoutPath>hal_system.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>20</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_spi_host.c</PathWithFileName>
+      <FilenameWithoutPath>hal_spi_host.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>21</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_pwm.c</PathWithFileName>
+      <FilenameWithoutPath>hal_pwm.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>22</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_pm.c</PathWithFileName>
+      <FilenameWithoutPath>hal_pm.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>23</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_os_timer.c</PathWithFileName>
+      <FilenameWithoutPath>hal_os_timer.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>24</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_mem.c</PathWithFileName>
+      <FilenameWithoutPath>hal_mem.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>25</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>1</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_log.c</PathWithFileName>
+      <FilenameWithoutPath>hal_log.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>26</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_iic_host.c</PathWithFileName>
+      <FilenameWithoutPath>hal_iic_host.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>27</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_gpio.c</PathWithFileName>
+      <FilenameWithoutPath>hal_gpio.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>28</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_flash.c</PathWithFileName>
+      <FilenameWithoutPath>hal_flash.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>29</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_bt.c</PathWithFileName>
+      <FilenameWithoutPath>hal_bt.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>30</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_audio.c</PathWithFileName>
+      <FilenameWithoutPath>hal_audio.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>4</GroupNumber>
+      <FileNumber>31</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\Src\user\emf_hal\hal_adc.c</PathWithFileName>
+      <FilenameWithoutPath>hal_adc.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
   </Group>
 
 </ProjectOpt>

+ 120 - 10
MDK-ARM/Project.uvprojx

@@ -10,14 +10,13 @@
       <TargetName>Project</TargetName>
       <ToolsetNumber>0x4</ToolsetNumber>
       <ToolsetName>ARM-ADS</ToolsetName>
-      <pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
-      <uAC6>0</uAC6>
+      <pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed>
       <TargetOption>
         <TargetCommonOption>
           <Device>PY32F002Bx5</Device>
           <Vendor>Puya</Vendor>
-          <PackID>Puya.PY32F0xx_DFP.1.1.9</PackID>
-          <PackURL>https://www.puyasemi.com/</PackURL>
+          <PackID>Puya.PY32F0xx_DFP.1.2.0</PackID>
+          <PackURL>http://www.puyasemi.com/uploadfiles/</PackURL>
           <Cpu>IRAM(0x20000000,0x00000C00) IROM(0x08000000,0x00006000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE</Cpu>
           <FlashUtilSpec></FlashUtilSpec>
           <StartupFile></StartupFile>
@@ -184,9 +183,6 @@
             <hadXRAM>0</hadXRAM>
             <uocXRam>0</uocXRam>
             <RvdsVP>0</RvdsVP>
-            <RvdsMve>0</RvdsMve>
-            <RvdsCdeCp>0</RvdsCdeCp>
-            <nBranchProt>0</nBranchProt>
             <hadIRAM2>0</hadIRAM2>
             <hadIROM2>0</hadIROM2>
             <StupSel>8</StupSel>
@@ -327,7 +323,6 @@
             <uThumb>0</uThumb>
             <uSurpInc>0</uSurpInc>
             <uC99>1</uC99>
-            <uGnu>0</uGnu>
             <useXO>0</useXO>
             <v6Lang>3</v6Lang>
             <v6LangP>3</v6LangP>
@@ -340,7 +335,7 @@
               <MiscControls></MiscControls>
               <Define>PY32F002Bx5,USE_FULL_LL_DRIVER</Define>
               <Undefine></Undefine>
-              <IncludePath>..\Inc;..\Drivers\PY32F002B_HAL_Driver\Inc;..\Drivers\CMSIS\Include;..\Drivers\CMSIS\Device\PY32F0xx\Include;..\Drivers\BSP\PY32F002Bxx_Start_Kit</IncludePath>
+              <IncludePath>..\Inc;..\Drivers\PY32F002B_HAL_Driver\Inc;..\Drivers\CMSIS\Include;..\Drivers\CMSIS\Device\PY32F0xx\Include;..\Drivers\BSP\PY32F002Bxx_Start_Kit;..\Src\user;..\Src\user\emf_hal;..\Src\user\LiteEMF</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -353,7 +348,7 @@
             <NoWarn>0</NoWarn>
             <uSurpInc>0</uSurpInc>
             <useXO>0</useXO>
-            <ClangAsOpt>4</ClangAsOpt>
+            <uClangAs>0</uClangAs>
             <VariousControls>
               <MiscControls></MiscControls>
               <Define></Define>
@@ -439,6 +434,121 @@
               <FileType>1</FileType>
               <FilePath>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_ll_rcc.c</FilePath>
             </File>
+            <File>
+              <FileName>py32f002b_hal.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_hal.c</FilePath>
+            </File>
+            <File>
+              <FileName>py32f002b_hal_flash.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_hal_flash.c</FilePath>
+            </File>
+            <File>
+              <FileName>py32f002b_ll_spi.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_ll_spi.c</FilePath>
+            </File>
+            <File>
+              <FileName>py32f002b_ll_exti.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_ll_exti.c</FilePath>
+            </File>
+            <File>
+              <FileName>py32f002b_hal_cortex.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Drivers\PY32F002B_HAL_Driver\Src\py32f002b_hal_cortex.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>emf_hal</GroupName>
+          <Files>
+            <File>
+              <FileName>hal_adc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_adc.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_uart.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_uart.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_timer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_timer.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_tick.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_tick.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_system.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_system.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_spi_host.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_spi_host.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_pwm.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_pwm.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_pm.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_pm.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_os_timer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_os_timer.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_mem.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_mem.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_log.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_log.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_iic_host.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_iic_host.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_gpio.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_gpio.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_flash.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_flash.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_bt.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_bt.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_audio.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_audio.c</FilePath>
+            </File>
+            <File>
+              <FileName>hal_adc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\Src\user\emf_hal\hal_adc.c</FilePath>
+            </File>
           </Files>
         </Group>
       </Groups>

+ 16 - 0
Src/user/emf_hal/CMakeLists.txt

@@ -0,0 +1,16 @@
+# 将子目录的源文件添加到目标中
+file(GLOB SOURCE "*.cpp" "*.c")
+set(SUB_SRC ${SUB_SRC} ${SOURCE} CACHE STRING "fix SUB_SRC" FORCE)
+
+# 获取当前目录中的全部子目录
+file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
+# 遍历并打印子目录路径
+foreach(SUBDIRECTORY ${SUBDIRECTORIES})
+  if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY})
+  	# message("add_subdirectory=${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}")
+	if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt")
+		include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY})
+		add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY})
+	endif()
+  endif()
+endforeach()

+ 29 - 0
Src/user/emf_hal/Makefile

@@ -0,0 +1,29 @@
+
+
+DIR_BASE = $(shell pwd)
+#当前目录SRC
+SRC = $(wildcard *.c)	
+#当前.o 文件目录改成$(BUILD_DIR)/*.o目录
+OBJ = $(patsubst %.c, $(BUILD_DIR)/%.o,$(SRC))
+# OBJ := $(SRC:.c=.o)
+# OBJ := $(OBJ:%=$(BUILD_DIR)/%)
+#源文件目录
+SUB_DIR = $(shell find $(DIR_BASE) -maxdepth 1 -mindepth 1 -type d)
+
+
+.PHONY: all $(SUB_DIR)
+
+all : $(OBJ) sub_mudule
+
+#.c 编译生成.o
+$(OBJ):$(BUILD_DIR)/%.o:%.c
+	$(DEBUG) $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -c $< -o $@
+
+sub_mudule:
+ifneq ($(SUB_DIR),)
+	@for dir in $(SUB_DIR); do \
+		if [ -e "$$dir/Makefile" ]; then \
+			$(MAKE) -C $$dir; \
+		fi \
+	done 
+endif

+ 73 - 0
Src/user/emf_hal/hal_adc.c

@@ -0,0 +1,73 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#include "hw_board.h"
+#ifdef HW_ADC_MAP
+#include  "api/api_adc.h"
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+uint16_t hal_adc_to_voltage(uint16_t adc)
+{
+	UNUSED_PARAMETER(adc);
+	return 0;
+}
+bool hal_adc_value(uint8_t id, uint16_t* valp)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(valp);
+	return false;
+}
+bool hal_adc_start_scan(void)
+{
+	return false;
+}
+bool hal_adc_init(void)
+{
+	return false;
+}
+bool hal_adc_deinit(void)
+{
+	return false;
+}
+
+
+#endif
+
+
+
+

+ 52 - 0
Src/user/emf_hal/hal_adc.h

@@ -0,0 +1,52 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_adc_h
+#define _hal_adc_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+#ifndef ADC_REF_MV
+#define ADC_REF_MV		3200UL
+#endif
+#ifndef ADC_RES_MAX
+#define ADC_RES_MAX		1023	
+#endif
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 92 - 0
Src/user/emf_hal/hal_audio.c

@@ -0,0 +1,92 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#if API_AUDIO_ENABLE
+#include "api/audio/api_audio.h"
+
+
+#include "api/api_log.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+void hal_audio_spk_set_vol(uint8_t id,uint16_t l_vol, uint16_t r_vol)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(l_vol);
+	UNUSED_PARAMETER(r_vol);
+}
+void hal_audio_mic_set_vol(uint8_t id,uint16_t mic_vol)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(mic_vol);
+}
+void hal_audio_open_spk(uint8_t id,api_audio_t *paudio)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(paudio);
+}
+void hal_audio_close_spk(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+}
+void hal_audio_open_mic(uint8_t id,api_audio_t *paudio)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(paudio);
+}
+void hal_audio_close_mic(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+}
+bool hal_audio_init(uint8_t id,api_audio_t *paudio)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(paudio);
+	return true;
+}
+
+#endif
+
+
+
+
+
+

+ 46 - 0
Src/user/emf_hal/hal_audio.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_audio_h
+#define _hal_audio_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 355 - 0
Src/user/emf_hal/hal_bt.c

@@ -0,0 +1,355 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+#include "hw_config.h"
+#if API_BT_ENABLE
+#include "api/bt/api_bt.h"
+#include "api/api_log.h"
+
+
+/*******************************************************************************************************************
+**	Hardware  Defined
+********************************************************************************************************************/
+
+
+/*******************************************************************************************************************
+**	public Parameters
+********************************************************************************************************************/
+
+/*******************************************************************************************************************
+**	static Parameters
+********************************************************************************************************************/
+
+
+/*****************************************************************************************************
+**  hal bt Function
+******************************************************************************************************/
+
+
+bool hal_bt_get_mac(uint8_t id, bt_t bt, uint8_t *buf )
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+    switch(bt){
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+    case BT_BLE: 	
+    case BT_BLE_RF: 			//BLE模拟2.4G
+        break;
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+    case BT_BLEC:
+    case BT_BLE_RFC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+    case BT_EDR: 	    
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+    case BT_EDRC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+    case BT_RF:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+    case BT_RFC:
+        break;
+    #endif
+    }   
+
+    return ret;
+}
+
+bool hal_bt_is_bonded(uint8_t id, bt_t bt)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+    switch(bt){
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+    case BT_BLE: 	
+    case BT_BLE_RF: 			//BLE模拟2.4G
+        break;
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+    case BT_BLEC:
+    case BT_BLE_RFC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+    case BT_EDR: 	    
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+    case BT_EDRC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+    case BT_RF:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+    case BT_RFC:
+        break;
+    #endif
+    }   
+    
+    return ret;
+}
+bool hal_bt_debond(uint8_t id, bt_t bt)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+    switch(bt){
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+    case BT_BLE: 	
+    case BT_BLE_RF: 			//BLE模拟2.4G
+        break;
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+    case BT_BLEC:
+    case BT_BLE_RFC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+    case BT_EDR: 	    
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+    case BT_EDRC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+    case BT_RF:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+    case BT_RFC:
+        break;
+    #endif
+    }   
+    
+    return ret;
+}
+bool hal_bt_disconnect(uint8_t id, bt_t bt)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+    switch(bt){
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+    case BT_BLE: 	
+    case BT_BLE_RF: 			//BLE模拟2.4G
+        break;
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+    case BT_BLEC:
+    case BT_BLE_RFC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+    case BT_EDR: 	    
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+    case BT_EDRC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+    case BT_RF:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+    case BT_RFC:
+        break;
+    #endif
+    }   
+    
+    return ret;
+}
+bool hal_bt_enable(uint8_t id, bt_t bt,bool en)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+    switch(bt){
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+    case BT_BLE: 	
+    case BT_BLE_RF: 			//BLE模拟2.4G
+        break;
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+    case BT_BLEC:
+    case BT_BLE_RFC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+    case BT_EDR: 	    
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+    case BT_EDRC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+    case BT_RF:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+    case BT_RFC:
+        break;
+    #endif
+    }   
+    
+    return ret;
+}
+bool hal_bt_uart_tx(uint8_t id, bt_t bt,uint8_t *buf, uint16_t len)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+    switch(bt){
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+    case BT_BLE: 	
+    case BT_BLE_RF: 			//BLE模拟2.4G
+        break;
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+    case BT_BLEC:
+    case BT_BLE_RFC:
+        break;
+    #endif
+    #if (BT0_SUPPORT & BIT_ENUM(TR_EDR)) && (EDR_TYPE_SUPPORT & BIT_ENUM(DEV_TYPE_VENDOR))
+    case BT_EDR: 	    
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+    case BT_EDRC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+    case BT_RF:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+    case BT_RFC:
+        break;
+    #endif
+    }   
+    
+    return ret;
+}
+bool hal_bt_hid_tx(uint8_t id, bt_t bt, uint8_t hid_requset,uint8_t*buf, uint16_t len)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+    switch(bt){
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+    case BT_BLE: 	
+    case BT_BLE_RF: 			//BLE模拟2.4G
+        break;
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+    case BT_BLEC:
+    case BT_BLE_RFC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+    case BT_EDR: 	    
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+    case BT_EDRC:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+    case BT_RF:
+        break;
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+    case BT_RFC:
+        break;
+    #endif
+    }   
+    
+    return ret;
+}
+bool hal_bt_init(uint8_t id)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+
+    #endif
+
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+
+    #endif
+
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+
+    #endif
+    
+    return ret;
+}
+bool hal_bt_deinit(uint8_t id)
+{
+    bool ret = false;
+
+    if(BT_ID0 != id) return false;
+
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLE) | BIT_ENUM(TR_BLE_RF))
+
+    #endif
+    #if BT0_SUPPORT & (BIT_ENUM(TR_BLEC) | BIT_ENUM(TR_BLE_RFC))
+
+    #endif
+
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDR)
+
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_EDRC)
+
+    #endif
+    
+    #if BT0_SUPPORT & BIT_ENUM(TR_RF)
+
+    #endif
+    #if BT0_SUPPORT & BIT_ENUM(TR_RFC)
+
+    #endif
+    
+    return ret;
+}
+void hal_bt_task(void* pa)
+{
+    UNUSED_PARAMETER(pa);
+}
+
+
+#endif
+

+ 42 - 0
Src/user/emf_hal/hal_bt.h

@@ -0,0 +1,42 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+#ifndef	_hal_bt_h
+#define	_hal_bt_h
+#include "hw_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*******************************************************************************************************************
+**	Hardware  Defined
+********************************************************************************************************************/
+
+/*******************************************************************************************************************
+**	Parameters
+********************************************************************************************************************/
+
+/*******************************************************************************************************************
+**	event
+********************************************************************************************************************/
+
+
+/*******************************************************************************************************************
+**	Functions
+********************************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+

+ 63 - 0
Src/user/emf_hal/hal_flash.c

@@ -0,0 +1,63 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include  "api/api_flash.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+//hal
+bool hal_flash_write(uint16_t offset,uint8_t *buf,uint16_t len)
+{
+	UNUSED_PARAMETER(offset);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_flash_read(uint16_t offset,uint8_t *buf,uint16_t len)
+{
+	UNUSED_PARAMETER(offset);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_flash_erase(uint16_t offset)
+{
+	UNUSED_PARAMETER(offset);
+	return false;
+}
+bool hal_flash_init(void)
+{
+	return false;
+}
+
+
+
+
+
+
+
+
+
+

+ 52 - 0
Src/user/emf_hal/hal_flash.h

@@ -0,0 +1,52 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_flash_h
+#define _hal_flash_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+#ifndef API_FLASH_PAGE_NUM
+#define API_FLASH_PAGE_NUM		2
+#endif
+#ifndef API_FLASH_PAGE_SIZE
+#define API_FLASH_PAGE_SIZE		0x100
+#endif
+#ifndef API_FLASH_ADDRESS
+#define API_FLASH_ADDRESS		(0x08010000 - API_FLASH_PAGE_SIZE*API_FLASH_PAGE_NUM)
+#endif
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 127 - 0
Src/user/emf_hal/hal_gpio.c

@@ -0,0 +1,127 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include  "api/api_gpio.h"
+#include  "py32f002b_ll_bus.h"
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+
+GPIO_TypeDef * get_gpio_port(pin_t io)
+{
+    GPIO_TypeDef * base = NULL;
+    switch (io&HW_PORT_MASK)
+    {
+    case HW_PORTA_BASE:
+        base = GPIOA;
+        break;
+    case HW_PORTB_BASE:
+        base = GPIOB;
+        break;
+    case HW_PORTC_BASE:
+        base = GPIOC;
+        break;
+    default:
+        break;
+    }
+    return base;
+}
+
+uint32_t get_gpio_rcc(pin_t io)
+{
+    uint32_t rcc = 0;
+    switch (io&HW_PORT_MASK)
+    {
+    case HW_PORTA_BASE:
+        rcc = LL_IOP_GRP1_PERIPH_GPIOA;
+        break;
+    case HW_PORTB_BASE:
+        rcc = LL_IOP_GRP1_PERIPH_GPIOB;
+        break;
+    case HW_PORTC_BASE:
+        rcc = LL_IOP_GRP1_PERIPH_GPIOC;
+        break;
+    default:
+        break;
+    }
+    return rcc;
+}
+
+uint32_t get_gpio_pin(pin_t io)
+{
+    return 1<<(io&HW_PIN_MASK);
+}
+
+void hal_gpio_mode(pin_t pin, uint8_t mode)
+{
+}
+void hal_gpio_dir(pin_t pin, pin_dir_t dir, pin_pull_t pull)
+{
+    if((uint32_t)-1 == pin) return;
+    GPIO_TypeDef * gpiox = get_gpio_port((pin_t)pin);
+
+    LL_GPIO_InitTypeDef GPIO_InitStructure = {0};
+
+    LL_IOP_GRP1_EnableClock(get_gpio_rcc((pin_t)pin));
+
+	GPIO_InitStructure.Pin = get_gpio_pin(pin);
+	GPIO_InitStructure.Mode = (dir == PIN_OUT ? LL_GPIO_MODE_OUTPUT : LL_GPIO_MODE_INPUT);
+	GPIO_InitStructure.Speed = LL_GPIO_SPEED_FREQ_LOW;
+	GPIO_InitStructure.OutputType = (pull == PIN_PULL_OD ? LL_GPIO_OUTPUT_OPENDRAIN : LL_GPIO_OUTPUT_PUSHPULL);
+	GPIO_InitStructure.Pull = (pull & 0x2);
+	GPIO_InitStructure.Alternate = LL_GPIO_AF_7;
+    LL_GPIO_Init(get_gpio_port((pin_t)pin), &GPIO_InitStructure);
+}
+uint32_t hal_gpio_in(pin_t pin)
+{
+	return LL_GPIO_IsInputPinSet(get_gpio_port(pin), get_gpio_pin(pin));
+}
+void hal_gpio_out(pin_t pin, uint8_t value)
+{
+	if(value){
+		LL_GPIO_SetOutputPin(get_gpio_port(pin), get_gpio_pin(pin));
+	}else{
+		LL_GPIO_ResetOutputPin(get_gpio_port(pin), get_gpio_pin(pin));
+	}
+}
+
+
+
+
+
+
+
+

+ 52 - 0
Src/user/emf_hal/hal_gpio.h

@@ -0,0 +1,52 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_gpio_h
+#define _hal_gpio_h
+#include "emf_typedef.h" 
+#include "py32f002b_ll_gpio.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+#define HW_PORTA_BASE   0x00
+#define HW_PORTB_BASE   0x10
+#define HW_PORTC_BASE   0x20
+#define HW_PORTD_BASE   0x30
+
+#define HW_PIN_MASK     0x0F
+#define HW_PORT_MASK    0xF0
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 114 - 0
Src/user/emf_hal/hal_iic_host.c

@@ -0,0 +1,114 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#include "hw_board.h"
+#ifdef HW_IIC_MAP
+
+#include  "api/api_iic_host.h"
+#include  "api/api_gpio.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:	需要使用硬件iic扫描外设时才需要适配该接口
+*******************************************************************/
+bool hal_iic_scan_addr(uint8_t id,uint8_t dev_addr)
+{
+	uint8_t ret = false;
+	
+	// start 
+	// tx byte 
+	// stop 
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(dev_addr);
+	return ret;
+}
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+bool hal_iic_write(uint8_t id,uint8_t dev_addr,uint16_t addr, uint8_t const *buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(dev_addr);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_iic_read(uint8_t id,uint8_t dev_addr,uint16_t addr, uint8_t* buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(dev_addr);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_iic_isr_write(uint8_t id,uint8_t dev_addr,uint16_t addr, uint8_t const *buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(dev_addr);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_iic_isr_read(uint8_t id,uint8_t dev_addr,uint16_t addr, uint8_t* buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(dev_addr);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_iic_init(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return false;
+}
+bool hal_iic_deinit(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return false;
+}
+
+#endif
+
+
+
+
+

+ 42 - 0
Src/user/emf_hal/hal_iic_host.h

@@ -0,0 +1,42 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_iic_h
+#define _hal_iic_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 62 - 0
Src/user/emf_hal/hal_log.c

@@ -0,0 +1,62 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*   opensource.org/licenses/BSD-2-Clause
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include  "api/api_log.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+
+/*******************************************************************
+** Parameters:		
+** Returns:	true: used hal dump, false: do not used hal dump
+** Description:		
+*******************************************************************/
+bool hal_dump(void const *buf, uint16_t len)
+{
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+
+
+
+
+
+
+

+ 48 - 0
Src/user/emf_hal/hal_log.h

@@ -0,0 +1,48 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*   opensource.org/licenses/BSD-2-Clause
+*/
+
+
+#ifndef _hal_log_h
+#define _hal_log_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+#define HAL_PRINTF				printf
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 58 - 0
Src/user/emf_hal/hal_mem.c

@@ -0,0 +1,58 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#include "utils/mem/emf_mem.h"
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+void* hal_malloc(uint32_t size)
+{
+	UNUSED_PARAMETER(size);
+	return NULL;
+}
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+void hal_free(void* p)
+{
+	UNUSED_PARAMETER(p);
+}
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+void hal_mem_stats(void)
+{
+
+}

+ 44 - 0
Src/user/emf_hal/hal_mem.h

@@ -0,0 +1,44 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_mem_h
+#define _hal_mem_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 136 - 0
Src/user/emf_hal/hal_os_timer.c

@@ -0,0 +1,136 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+注意: 使用到了函数指针, 该接口适用于51平台
+************************************************************************************************************/
+#include "hw_config.h"
+#if API_OS_TIMER_ENABLE
+#include "api/api_os_timer.h"
+
+#include "api/api_log.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:	静态注册一个定时器,删除后资源不会释放
+*******************************************************************/
+error_t hal_os_timer_register(api_os_timer_t *ptimer)
+{
+	error_t err = ERROR_SUCCESS;
+	
+	// if(TIMER_ONE_SHOT & ptimer->ctrl){
+	// }else{
+	// }
+	UNUSED_PARAMETER(ptimer);
+	return err;
+}
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:	动态注册一个定时器,删除后回自动释放内存
+	由于使用到 emf_malloc 动态内存分配, 常驻定时器不要使用 api_os_timer_create 创建定时器
+*******************************************************************/
+error_t hal_os_timer_create(api_os_timer_t *ptimer)
+{
+	error_t err = ERROR_SUCCESS;
+	
+	// if(TIMER_ONE_SHOT & ptimer->ctrl){
+	// }else{
+	// }
+	UNUSED_PARAMETER(ptimer);
+	return err;
+}
+error_t hal_os_timer_delete(api_os_timer_t *ptimer)
+{
+	error_t err = ERROR_SUCCESS;
+	
+	// if(TIMER_ONE_SHOT & ptimer->ctrl){
+	// }else{
+	// }
+	UNUSED_PARAMETER(ptimer);
+	return err;
+}
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:	调用soft_timer_start后等待timeout后才调用回调函数
+				如果定时器已经启动, 再次调用相当于soft_timer_modify 重置定时器
+*******************************************************************/
+error_t hal_os_timer_start(api_os_timer_t *ptimer)
+{
+	error_t err = ERROR_SUCCESS;
+	
+	// if(TIMER_ONE_SHOT & ptimer->ctrl){
+	// }else{
+	// }
+	UNUSED_PARAMETER(ptimer);
+	return err;
+}
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:	更新定时器
+*******************************************************************/
+error_t hal_os_timer_modify(api_os_timer_t *ptimer)
+{
+	error_t err = ERROR_SUCCESS;
+	
+	// if(TIMER_ONE_SHOT & ptimer->ctrl){
+	// }else{
+	// }
+	UNUSED_PARAMETER(ptimer);
+	return err;
+}
+
+error_t hal_os_timer_stop(api_os_timer_t *ptimer)
+{
+	error_t err = ERROR_SUCCESS;
+	// if(TIMER_ONE_SHOT & ptimer->ctrl){
+	// }else{
+	// }
+	UNUSED_PARAMETER(ptimer);
+	return err;
+}
+
+
+
+#endif
+
+
+
+
+
+

+ 38 - 0
Src/user/emf_hal/hal_os_timer.h

@@ -0,0 +1,38 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_os_timer_h
+#define _hal_os_timer_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 55 - 0
Src/user/emf_hal/hal_pm.c

@@ -0,0 +1,55 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include  "api/api_pm.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+
+
+pm_reson_t hal_get_reset_reson(void)
+{
+	return PM_RESON_POR;
+}
+void hal_boot(uint8_t index)
+{
+	UNUSED_PARAMETER(index);
+}
+void hal_reset(void)
+{
+}
+void hal_sleep(void)
+{
+}
+
+
+
+
+
+
+
+
+
+

+ 45 - 0
Src/user/emf_hal/hal_pm.h

@@ -0,0 +1,45 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_pm_h
+#define _hal_pm_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 71 - 0
Src/user/emf_hal/hal_pwm.c

@@ -0,0 +1,71 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#ifdef HW_PWM_MAP
+
+
+#include  "api/api_pwm.h"
+#include  "api/api_gpio.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+bool hal_pwm_set_duty(uint16_t id, uint8_t duty)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(duty);
+	return false;
+}
+bool hal_pwm_init(uint16_t id, uint8_t duty)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(duty);
+	return false;
+}
+bool hal_pwm_deinit(uint16_t id)
+{
+	UNUSED_PARAMETER(id);
+	return false;
+}
+
+
+#endif
+
+
+
+
+

+ 46 - 0
Src/user/emf_hal/hal_pwm.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_pwm_h
+#define _hal_pwm_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 94 - 0
Src/user/emf_hal/hal_spi_host.c

@@ -0,0 +1,94 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#include "hw_board.h"
+#ifdef HW_SPI_HOST_MAP
+
+#include  "api/api_spi_host.h"
+#include  "api/api_gpio.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+bool hal_spi_host_write(uint8_t id,uint16_t addr, uint8_t * buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_spi_host_read(uint8_t id,uint16_t addr, uint8_t * buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_spi_host_isr_write(uint8_t id,uint16_t addr, uint8_t * buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_spi_host_isr_read(uint8_t id,uint16_t addr, uint8_t * buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(addr);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+bool hal_spi_host_init(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return false;
+}
+bool hal_spi_host_deinit(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return false;
+}
+
+#endif
+
+
+
+

+ 46 - 0
Src/user/emf_hal/hal_spi_host.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_spi_host_h
+#define _hal_spi_host_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 59 - 0
Src/user/emf_hal/hal_system.c

@@ -0,0 +1,59 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include  "api/api_system.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+bool hal_set_sysclk(emf_clk_t clk, uint32_t freq)
+{
+	UNUSED_PARAMETER(clk);
+	UNUSED_PARAMETER(freq);
+	return true;
+}
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+uint32_t hal_get_sysclk(emf_clk_t clk)
+{
+	UNUSED_PARAMETER(clk);
+	return HAL_SYS_FREQ;
+}
+
+bool hal_get_uuid(uint8_t *uuid, uint8_t len)
+{
+	UNUSED_PARAMETER(uuid);
+	UNUSED_PARAMETER(len);
+	return false;
+}
+
+
+
+
+
+

+ 51 - 0
Src/user/emf_hal/hal_system.h

@@ -0,0 +1,51 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_system_h
+#define _hal_system_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+#ifndef HAL_SYS_FREQ			//系统时钟
+#define HAL_SYS_FREQ			(72 * 1000000L)			
+#endif
+
+#ifndef API_ENTER_CRITICAL
+#define API_ENTER_CRITICAL()
+#endif
+#ifndef API_EXIT_CRITICAL
+#define API_EXIT_CRITICAL()
+#endif
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 68 - 0
Src/user/emf_hal/hal_tick.c

@@ -0,0 +1,68 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include  "api/api_tick.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+void hal_delay_ns(uint32_t ns)
+{
+	UNUSED_PARAMETER(ns);
+}
+void hal_delay_us(uint32_t us)
+{
+	hal_delay_ns(1000*us);
+}
+void hal_delay_ms(uint32_t ms)
+{
+	hal_delay_us(1000*ms);
+}
+
+void hal_os_delay_ms(uint32_t ms)
+{
+	UNUSED_PARAMETER(ms);
+}
+void hal_tick_init(void)
+{	
+}
+
+
+
+
+
+
+

+ 46 - 0
Src/user/emf_hal/hal_tick.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_tick_h
+#define _hal_tick_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 62 - 0
Src/user/emf_hal/hal_timer.c

@@ -0,0 +1,62 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#include "hw_board.h"
+#if	defined HW_TIMER_MAP && API_TIMER_BIT_ENABLE
+#include  "api/api_timer.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+bool hal_timer_init(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return true;
+}
+bool hal_timer_deinit(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return true;
+}
+
+#endif
+
+
+
+
+
+

+ 46 - 0
Src/user/emf_hal/hal_timer.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_timer_h
+#define _hal_timer_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 29 - 0
Src/user/emf_hal/hal_typedef.h

@@ -0,0 +1,29 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*   opensource.org/licenses/BSD-2-Clause
+*/
+
+
+#ifndef _hal_typedef_h
+#define _hal_typedef_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 78 - 0
Src/user/emf_hal/hal_uart.c

@@ -0,0 +1,78 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#include "hw_board.h"
+#ifdef HW_UART_MAP
+
+#include  "api/api_uart.h"
+#include  "api/api_gpio.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+bool hal_uart_set_baud(uint8_t id, uint32_t baud)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(baud);
+	return true;
+}
+bool hal_uart_tx(uint8_t id,void * buf,uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return true;
+}
+bool hal_uart_init(uint8_t id,uint32_t baudrate)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(baudrate);
+	return false;
+}
+bool hal_uart_deinit(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return false;
+}
+
+
+#endif
+
+
+
+
+

+ 46 - 0
Src/user/emf_hal/hal_uart.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_uart_h
+#define _hal_uart_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 57 - 0
Src/user/emf_hal/hal_wdt.c

@@ -0,0 +1,57 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#if API_WDT_ENABLE
+
+#include  "api/api_wdt.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+//hal
+
+void hal_wdt_feed(void)
+{
+}
+
+bool hal_wdt_init(uint32_t ms)
+{
+	UNUSED_PARAMETER(ms);
+	return false;
+}
+bool hal_wdt_deinit(void)
+{
+	return false;
+}
+
+
+#endif
+
+
+
+
+
+
+

+ 45 - 0
Src/user/emf_hal/hal_wdt.h

@@ -0,0 +1,45 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_wdt_h
+#define _hal_wdt_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 16 - 0
Src/user/emf_hal/usb/CMakeLists.txt

@@ -0,0 +1,16 @@
+# 将子目录的源文件添加到目标中
+file(GLOB SOURCE "*.cpp" "*.c")
+set(SUB_SRC ${SUB_SRC} ${SOURCE} CACHE STRING "fix SUB_SRC" FORCE)
+
+# 获取当前目录中的全部子目录
+file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
+# 遍历并打印子目录路径
+foreach(SUBDIRECTORY ${SUBDIRECTORIES})
+  if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY})
+  	# message("add_subdirectory=${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}")
+	if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt")
+		include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY})
+		add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY})
+	endif()
+  endif()
+endforeach()

+ 29 - 0
Src/user/emf_hal/usb/Makefile

@@ -0,0 +1,29 @@
+
+
+DIR_BASE = $(shell pwd)
+#当前目录SRC
+SRC = $(wildcard *.c)	
+#当前.o 文件目录改成$(BUILD_DIR)/*.o目录
+OBJ = $(patsubst %.c, $(BUILD_DIR)/%.o,$(SRC))
+# OBJ := $(SRC:.c=.o)
+# OBJ := $(OBJ:%=$(BUILD_DIR)/%)
+#源文件目录
+SUB_DIR = $(shell find $(DIR_BASE) -maxdepth 1 -mindepth 1 -type d)
+
+
+.PHONY: all $(SUB_DIR)
+
+all : $(OBJ) sub_mudule
+
+#.c 编译生成.o
+$(OBJ):$(BUILD_DIR)/%.o:%.c
+	$(DEBUG) $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -c $< -o $@
+
+sub_mudule:
+ifneq ($(SUB_DIR),)
+	@for dir in $(SUB_DIR); do \
+		if [ -e "$$dir/Makefile" ]; then \
+			$(MAKE) -C $$dir; \
+		fi \
+	done 
+endif

+ 64 - 0
Src/user/emf_hal/usb/hal_otg.c

@@ -0,0 +1,64 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#if API_OTG_BIT_ENABLE
+#include "api/usb/usb_typedef.h"
+#include "api/usb/api_otg.h"
+
+#include "api/api_log.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+
+/*******************************************************************
+** Parameters:
+** Returns:
+** Description:
+*******************************************************************/
+error_t hal_otg_init(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+error_t hal_otg_deinit(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+
+#endif
+
+
+

+ 46 - 0
Src/user/emf_hal/usb/hal_otg.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_otg_h
+#define _hal_otg_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 145 - 0
Src/user/emf_hal/usb/hal_usbd.c

@@ -0,0 +1,145 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#if API_USBD_BIT_ENABLE
+#include  "api/usb/usb_typedef.h"
+#include "api/usb/device/usbd.h"
+
+#include "api/api_log.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+uint8_t *hal_usbd_get_endp_buffer(uint8_t id, uint8_t ep)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	return NULL;
+}
+error_t hal_usbd_endp_dma_init(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_endp_open(uint8_t id, usb_endp_t *pendp)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(pendp);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_endp_close(uint8_t id, uint8_t ep)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_endp_ack(uint8_t id, uint8_t ep, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	UNUSED_PARAMETER(len);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_endp_nak(uint8_t id, uint8_t ep)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_clear_endp_stall(uint8_t id, uint8_t ep)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_endp_stall(uint8_t id, uint8_t ep)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	return ERROR_SUCCESS;
+}
+
+
+/*******************************************************************
+** Parameters:
+** Returns:
+** Description: 注意: 端点0 发送需要处理usbd_req_t
+*******************************************************************/
+error_t hal_usbd_in(uint8_t id, uint8_t ep, uint8_t* buf,uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_out(uint8_t id, uint8_t ep, uint8_t* buf, uint16_t* plen)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(ep);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_reset(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_set_address(uint8_t id,uint8_t address)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(address);
+	return ERROR_SUCCESS;
+}
+
+error_t hal_usbd_init(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbd_deinit(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+
+#endif
+
+
+

+ 46 - 0
Src/user/emf_hal/usb/hal_usbd.h

@@ -0,0 +1,46 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_usbd_h
+#define _hal_usbd_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 127 - 0
Src/user/emf_hal/usb/hal_usbh.c

@@ -0,0 +1,127 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+/************************************************************************************************************
+**	Description:	
+************************************************************************************************************/
+#include "hw_config.h"
+#if API_USBH_BIT_ENABLE
+#include  "api/usb/usb_typedef.h"
+#include  "api/usb/host/usbh.h"
+
+#include "api/api_log.h"
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+/******************************************************************************************************
+**	public Parameters
+*******************************************************************************************************/
+
+
+/******************************************************************************************************
+**	static Parameters
+*******************************************************************************************************/
+
+/*****************************************************************************************************
+**	static Function
+******************************************************************************************************/
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+/*******************************************************************
+** Parameters:		
+** Returns:	
+** Description:		
+*******************************************************************/
+error_t hal_usbh_port_en(uint8_t id,uint8_t en, usb_speed_t* pspeed)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(en);
+	UNUSED_PARAMETER(pspeed);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_set_speed(uint8_t id, usb_speed_t speed)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(speed);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_port_reset(uint8_t id, uint8_t reset_ms)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(reset_ms);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_set_addr(uint8_t id,uint8_t addr)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(addr);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_endp_unregister(uint8_t id,usb_endp_t *endpp)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(endpp);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_endp_register(uint8_t id,usb_endp_t *endpp)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(endpp);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_ctrl_transfer( uint8_t id, usb_control_request_t* preq,uint8_t* buf, uint16_t* plen)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(preq);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(plen);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_in(uint8_t id,usb_endp_t *endpp, uint8_t* buf,uint16_t* plen,uint16_t timeout_ms)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(endpp);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(plen);
+	UNUSED_PARAMETER(timeout_ms);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_out(uint8_t id, usb_endp_t *endpp,uint8_t* buf, uint16_t len)
+{
+	UNUSED_PARAMETER(id);
+	UNUSED_PARAMETER(endpp);
+	UNUSED_PARAMETER(buf);
+	UNUSED_PARAMETER(len);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_driver_init(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+error_t hal_usbh_driver_deinit(uint8_t id)
+{
+	UNUSED_PARAMETER(id);
+	return ERROR_SUCCESS;
+}
+void hal_usbh_driver_task(uint32_t dt_ms)
+{
+	UNUSED_PARAMETER(dt_ms);
+}
+
+#endif
+
+

+ 47 - 0
Src/user/emf_hal/usb/hal_usbh.h

@@ -0,0 +1,47 @@
+/* 
+*   BSD 2-Clause License
+*   Copyright (c) 2022, LiteEMF
+*   All rights reserved.
+*   This software component is licensed by LiteEMF under BSD 2-Clause license,
+*   the "License"; You may not use this file except in compliance with the
+*   License. You may obtain a copy of the License at:
+*       opensource.org/licenses/BSD-2-Clause
+* 
+*/
+
+
+#ifndef _hal_usbh_h
+#define _hal_usbh_h
+#include "emf_typedef.h" 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/******************************************************************************************************
+** Defined
+*******************************************************************************************************/
+
+
+
+/******************************************************************************************************
+**	Parameters
+*******************************************************************************************************/
+
+
+
+/*****************************************************************************************************
+**  Function
+******************************************************************************************************/
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+

+ 34 - 0
Src/user/hw_board.h

@@ -0,0 +1,34 @@
+/************************************************************************************************************
+**	FileName:	hw_board.c
+**	Description:
+**	Major Function:
+**
+--------------------------------------------------------------------------------------------------------
+**	Software:
+**	Hareware:
+**
+**	Company:	zikway
+--------------------------------------------------------------------------------------------------------
+**	Modified:
+
+**	Author 			Date 			 Comment
+_________________________________________________________________________________________________________
+**	Cai			2020-03-26		Original
+**
+**
+************************************************************************************************************/
+
+
+#ifndef HW_BOARD_H
+#define HW_BOARD_H
+
+#include "hw_config.h"
+
+
+#define STORAGE_MAP_MAX	0x200
+#define INVALID_GPIO	(-1)				//		gpio 31 are not used
+
+
+
+#endif
+

+ 44 - 0
Src/user/hw_config.h

@@ -0,0 +1,44 @@
+/************************************************************************************************************
+**	FileName:	hw_config.h
+**	Description:
+**	Major Function:
+**
+--------------------------------------------------------------------------------------------------------
+**	Software:
+**	Hareware:
+**
+**	Company:	NGDS
+--------------------------------------------------------------------------------------------------------
+**	Modified:
+**	Author 			Date 			 Comment
+________________________________________________________________________________________________________
+**  Cai			2020-03-26		Original
+**
+**
+************************************************************************************************************/
+
+
+#ifndef	HW_CONFIG_H
+#define	HW_CONFIG_H
+
+
+
+/*******************************************************************************************************************
+**	Hardware  Defined
+********************************************************************************************************************/
+#define PY32F002B
+
+/*******************************************************************************************************************
+**	Parameters
+********************************************************************************************************************/
+#define DEBUGEN                      	1
+
+#define TEST							1	//测试
+
+
+#if TEST
+	
+
+#endif
+
+#endif

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott