If None was returned for such requests (which likely means that user simply
didn't handle them), it means successful init and default sector size of 512
bytes respectively. This makes only BP_IOCTL_SEC_COUNT a mandatory request,
and thus re-establishes parity with old interface, where only .count() is
mandatory().
This patch adds support to fsusermount for multiple block devices
(instead of just one). The maximum allowed is fixed at compile time by
the size of the fs_user_mount array accessed via MP_STATE_PORT, which
in turn is set by MICROPY_FATFS_VOLUMES.
With this patch, stmhal (which is still tightly coupled to fsusermount)
is also modified to support mounting multiple devices And the flash and
SD card are now just two block devices that are mounted at start up if
they exist (and they have special native code to make them more
efficient).
If MICROPY_FATFS_MAX_SS is defined to power of 2 value between 1024 and
4096, support for dynamic sector size in FatFs will be enabled. Note
that FatFs reserves static buffer of MICROPY_FATFS_MAX_SS size for each
filesystem in use, so that value should be set sparingly.
Initial patch provided by @pfalcon.
The new block protocol is:
- readblocks(self, n, buf)
- writeblocks(self, n, buf)
- ioctl(self, cmd, arg)
The new ioctl method handles the old sync and count methods, as well as
a new "get sector size" method.
The old protocol is still supported, and used if the device doesn't have
the ioctl method.
If RTC is already running at boot then it's left alone. Otherwise, RTC is
started at boot but startup function returns straight away. RTC startup
is then finished the first time it is used. Fallback to LSI if LSE fails
to start in a certain time.
Also included:
MICROPY_HW_CLK_LAST_FREQ
hold pyb.freq() parameters in RTC backup reg
MICROPY_HW_RTC_USE_US
option to present datetime sub-seconds in microseconds
MICROPY_HW_RTC_USE_CALOUT
option to enable RTC calibration output
CLK_LAST_FREQ and RTC_USE_CALOUT are enabled for PYBv1.0.
By measuring SD card addresses in blocks and not bytes, one can get away
with using 32-bit numbers.
This patch also uses proper atomic lock/unlock around SD card
read/write, adds SD.info() function, and gives error code for failed
read/writes.
Blanket wide to all .c and .h files. Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.
Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
All board config macros now begin with MICROPY_HW_.
Renamed PYBv10 to PYBV10, since macros should be all uppercase.
Made SDCARD_DETECT configurable in mpconfigport.h, so that the SD
detect pin can be easily configured.