Browse Source
Allow SDIO clock/retry overrides (#18223)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
vanilla_fb_2.0.x
Victor
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
3 deletions
-
Marlin/src/HAL/STM32F1/sdio.cpp
-
Marlin/src/HAL/STM32F1/sdio.h
|
|
@ -120,7 +120,7 @@ bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) { |
|
|
|
} |
|
|
|
|
|
|
|
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) { |
|
|
|
uint32_t retries = 3; |
|
|
|
uint32_t retries = SDIO_READ_RETRIES; |
|
|
|
while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true; |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
@ -21,7 +21,7 @@ |
|
|
|
*/ |
|
|
|
#pragma once |
|
|
|
|
|
|
|
#include "../shared/Marduino.h" |
|
|
|
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to override SDIO clock / retries |
|
|
|
|
|
|
|
#include <libmaple/sdio.h> |
|
|
|
#include <libmaple/dma.h> |
|
|
@ -100,7 +100,13 @@ |
|
|
|
#define SDIO_DATA_TIMEOUT 100U /* Read data transfer timeout */ |
|
|
|
#define SDIO_WRITE_TIMEOUT 200U /* Write data transfer timeout */ |
|
|
|
|
|
|
|
#ifndef SDIO_CLOCK |
|
|
|
#define SDIO_CLOCK 18000000 /* 18 MHz */ |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifndef SDIO_READ_RETRIES |
|
|
|
#define SDIO_READ_RETRIES 3 |
|
|
|
#endif |
|
|
|
|
|
|
|
// ------------------------
|
|
|
|
// Types
|
|
|
|