[FL-1666] Bootloader: info screen when we going to DFU. FuriHal: port SPI to LL. Cleanup. (#634)
* FuriHal: port spi to ll. Bootloader: add spi and display. * Makefile: rollback disabled freertos introspection * FuriHal: spi lock asserts. F6: minor cleanup port sdcard shenanigans to furi_hal_gpio. * SdCard: port missing bits to furi-hal-gpio * FuriHal: fix broken RX in SPI, update SPI API usage. RFAL: more asserts in SPI platform code. * GUI: clear canvas on start. FuriHal: no pullup on radio spi bus. * FuriHal: use check instead of assert in spi lock routines * FuriHal: remove timeouts * SdHal: add guard time to SDCARD CS PIN control. * FuriHal: proper name for SPI device reconfigure routine. SdHal: one more enterprise delay and better documentation. * Bootloader: update DFU text and add image. * FuriHal: drop unused ST HAL modules. * SdHal: fixed swapped hal_gpio_init_ex arguments * SpiHal: fixed swapped hal_gpio_init_ex arguments * IrdaHal: use hal_gpio_init instead of hal_gpio_init_ex * RfidHal: fixed swapped hal_gpio_init_ex arguments Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
This commit is contained in:
@@ -35,7 +35,6 @@
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "user_diskio.h"
|
||||
#include "spi.h"
|
||||
#include "furi-hal-spi.h"
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
@@ -53,7 +52,6 @@ static DSTATUS User_CheckStatus(BYTE lun) {
|
||||
return Stat;
|
||||
}
|
||||
|
||||
static const FuriHalSpiDevice* sd_spi_fast_dev = &furi_hal_spi_devices[FuriHalSpiDeviceIdSdCardFast];
|
||||
/* USER CODE END DECL */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
@@ -89,12 +87,11 @@ Diskio_drvTypeDef USER_Driver = {
|
||||
DSTATUS USER_initialize(BYTE pdrv) {
|
||||
/* USER CODE BEGIN INIT */
|
||||
|
||||
furi_hal_spi_bus_lock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_bus_configure(sd_spi_fast_dev->bus, sd_spi_fast_dev->config);
|
||||
const FuriHalSpiDevice* sd_spi_fast_dev = furi_hal_spi_device_get(FuriHalSpiDeviceIdSdCardFast);
|
||||
|
||||
DSTATUS status = User_CheckStatus(pdrv);
|
||||
|
||||
furi_hal_spi_bus_unlock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_device_return(sd_spi_fast_dev);
|
||||
|
||||
return status;
|
||||
/* USER CODE END INIT */
|
||||
@@ -123,8 +120,7 @@ DRESULT USER_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count) {
|
||||
/* USER CODE BEGIN READ */
|
||||
DRESULT res = RES_ERROR;
|
||||
|
||||
furi_hal_spi_bus_lock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_bus_configure(sd_spi_fast_dev->bus, sd_spi_fast_dev->config);
|
||||
const FuriHalSpiDevice* sd_spi_fast_dev = furi_hal_spi_device_get(FuriHalSpiDeviceIdSdCardFast);
|
||||
|
||||
if(BSP_SD_ReadBlocks((uint32_t*)buff, (uint32_t)(sector), count, SD_DATATIMEOUT) == MSD_OK) {
|
||||
/* wait until the read operation is finished */
|
||||
@@ -133,7 +129,7 @@ DRESULT USER_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count) {
|
||||
res = RES_OK;
|
||||
}
|
||||
|
||||
furi_hal_spi_bus_unlock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_device_return(sd_spi_fast_dev);
|
||||
|
||||
return res;
|
||||
/* USER CODE END READ */
|
||||
@@ -153,8 +149,7 @@ DRESULT USER_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count) {
|
||||
/* USER CODE HERE */
|
||||
DRESULT res = RES_ERROR;
|
||||
|
||||
furi_hal_spi_bus_lock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_bus_configure(sd_spi_fast_dev->bus, sd_spi_fast_dev->config);
|
||||
const FuriHalSpiDevice* sd_spi_fast_dev = furi_hal_spi_device_get(FuriHalSpiDeviceIdSdCardFast);
|
||||
|
||||
if(BSP_SD_WriteBlocks((uint32_t*)buff, (uint32_t)(sector), count, SD_DATATIMEOUT) == MSD_OK) {
|
||||
/* wait until the Write operation is finished */
|
||||
@@ -163,7 +158,7 @@ DRESULT USER_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count) {
|
||||
res = RES_OK;
|
||||
}
|
||||
|
||||
furi_hal_spi_bus_unlock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_device_return(sd_spi_fast_dev);
|
||||
|
||||
return res;
|
||||
/* USER CODE END WRITE */
|
||||
@@ -185,8 +180,7 @@ DRESULT USER_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
|
||||
|
||||
if(Stat & STA_NOINIT) return RES_NOTRDY;
|
||||
|
||||
furi_hal_spi_bus_lock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_bus_configure(sd_spi_fast_dev->bus, sd_spi_fast_dev->config);
|
||||
const FuriHalSpiDevice* sd_spi_fast_dev = furi_hal_spi_device_get(FuriHalSpiDeviceIdSdCardFast);
|
||||
|
||||
switch(cmd) {
|
||||
/* Make sure that no pending write process */
|
||||
@@ -219,7 +213,7 @@ DRESULT USER_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
|
||||
res = RES_PARERR;
|
||||
}
|
||||
|
||||
furi_hal_spi_bus_unlock(sd_spi_fast_dev->bus);
|
||||
furi_hal_spi_device_return(sd_spi_fast_dev);
|
||||
|
||||
return res;
|
||||
/* USER CODE END IOCTL */
|
||||
|
Reference in New Issue
Block a user