extmod/modmachine: Factor ports' machine module dict to common code.

This is a code factoring to have the dict for the machine module in one
location, and all the ports use that same dict.  The machine.soft_reset()
function implementation is also factored because it's the same for all
ports that did already implement it.  Eventually more functions/bindings
can be factored.

All ports remain functionally the same, except:
- cc3200 port: gains soft_reset, mem8, mem16, mem32, Signal; loses POWER_ON
  (which was a legacy constant, replaced long ago by PWRON_RESET)
- nrf port: gains Signal
- qemu-arm port: gains soft_reset
- unix port: gains soft_reset
- zephyr port: gains soft_reset, mem8, mem16, mem32

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-11-22 13:00:02 +11:00
parent 14432b5da0
commit 7d39db2503
44 changed files with 550 additions and 922 deletions

View File

@@ -56,7 +56,6 @@ SRC_C = \
shared/runtime/gchelper_generic.c \
ports/unix/main.c \
ports/unix/input.c \
ports/unix/modmachine.c \
ports/unix/gccollect.c \
windows_mphal.c \
realpath.c \

View File

@@ -94,7 +94,6 @@
<ClCompile Include="$(PyBaseDir)ports\unix\gccollect.c"/>
<ClCompile Include="$(PyBaseDir)ports\unix\input.c"/>
<ClCompile Include="$(PyBaseDir)ports\unix\main.c"/>
<ClCompile Include="$(PyBaseDir)ports\unix\modmachine.c" />
<ClCompile Include="$(PyVariantDir)*.c" />
</ItemGroup>
<ItemGroup>

View File

@@ -154,6 +154,7 @@
#define MICROPY_PY_BINASCII_CRC32 (1)
#define MICROPY_PY_RANDOM (1)
#define MICROPY_PY_MACHINE (1)
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/unix/modmachine.c"
#define MICROPY_PY_MACHINE_PULSE (1)
#define MICROPY_MACHINE_MEM_GET_READ_ADDR mod_machine_mem_get_addr
#define MICROPY_MACHINE_MEM_GET_WRITE_ADDR mod_machine_mem_get_addr

View File

@@ -14,6 +14,7 @@
<PyExtModSource Include="$(PyBaseDir)extmod\modhashlib.c" />
<PyExtModSource Include="$(PyBaseDir)extmod\modheapq.c" />
<PyExtModSource Include="$(PyBaseDir)extmod\modjson.c" />
<PyExtModSource Include="$(PyBaseDir)extmod\modmachine.c" />
<PyExtModSource Include="$(PyBaseDir)extmod\modos.c" />
<PyExtModSource Include="$(PyBaseDir)extmod\modrandom.c" />
<PyExtModSource Include="$(PyBaseDir)extmod\modre.c" />