未验证 提交 2553dd0a 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1095 from armink/fix_sfud

Fix sfud
from building import * from building import *
import rtconfig
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = ['spi_core.c', 'spi_dev.c'] src = ['spi_core.c', 'spi_dev.c']
CPPPATH = [cwd, cwd + '/../include'] CPPPATH = [cwd, cwd + '/../include']
LOCAL_CCFLAGS = ''
src_device = [] src_device = []
...@@ -32,9 +34,13 @@ if GetDepend('RT_USING_SFUD'): ...@@ -32,9 +34,13 @@ if GetDepend('RT_USING_SFUD'):
CPPPATH += [cwd + '/sfud/inc'] CPPPATH += [cwd + '/sfud/inc']
if GetDepend('RT_SFUD_USING_SFDP'): if GetDepend('RT_SFUD_USING_SFDP'):
src_device += ['sfud/src/sfud_sfdp.c'] src_device += ['sfud/src/sfud_sfdp.c']
if rtconfig.CROSS_TOOL == 'gcc':
LOCAL_CCFLAGS += ' -std=c99'
elif rtconfig.CROSS_TOOL == 'keil':
LOCAL_CCFLAGS += ' --c99'
src += src_device src += src_device
group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SPI'], CPPPATH = CPPPATH) group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SPI'], CPPPATH = CPPPATH, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
Return('group') Return('group')
...@@ -165,11 +165,6 @@ static void spi_unlock(const sfud_spi *spi) { ...@@ -165,11 +165,6 @@ static void spi_unlock(const sfud_spi *spi) {
rt_mutex_release(&(rtt_dev->lock)); rt_mutex_release(&(rtt_dev->lock));
} }
static void retry_delay_ms(void) {
/* millisecond delay */
rt_tick_from_millisecond(1);
}
static void retry_delay_100us(void) { static void retry_delay_100us(void) {
/* 100 microsecond delay */ /* 100 microsecond delay */
rt_thread_delay((RT_TICK_PER_SECOND * 1 + 9999) / 10000); rt_thread_delay((RT_TICK_PER_SECOND * 1 + 9999) / 10000);
...@@ -242,6 +237,9 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const ...@@ -242,6 +237,9 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const
rt_spi_flash_device_t rtt_dev = RT_NULL; rt_spi_flash_device_t rtt_dev = RT_NULL;
sfud_flash *sfud_dev = RT_NULL; sfud_flash *sfud_dev = RT_NULL;
char *spi_flash_dev_name_bak = RT_NULL, *spi_dev_name_bak = RT_NULL; char *spi_flash_dev_name_bak = RT_NULL, *spi_dev_name_bak = RT_NULL;
/* using default flash SPI configuration for initialize SPI Flash
* @note you also can change the SPI to other configuration after initialized finish */
struct rt_spi_configuration cfg = RT_SFUD_DEFAULT_SPI_CFG;
extern sfud_err sfud_device_init(sfud_flash *flash); extern sfud_err sfud_device_init(sfud_flash *flash);
RT_ASSERT(spi_flash_dev_name); RT_ASSERT(spi_flash_dev_name);
...@@ -269,9 +267,6 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const ...@@ -269,9 +267,6 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const
goto error; goto error;
} }
sfud_dev->spi.name = spi_dev_name_bak; sfud_dev->spi.name = spi_dev_name_bak;
/* using default flash SPI configuration for initialize SPI Flash
* @note you also can change the SPI to other configuration after initialized finish */
struct rt_spi_configuration cfg = RT_SFUD_DEFAULT_SPI_CFG;
rt_spi_configure(rtt_dev->rt_spi_device, &cfg); rt_spi_configure(rtt_dev->rt_spi_device, &cfg);
/* initialize lock */ /* initialize lock */
rt_mutex_init(&(rtt_dev->lock), spi_flash_dev_name, RT_IPC_FLAG_FIFO); rt_mutex_init(&(rtt_dev->lock), spi_flash_dev_name, RT_IPC_FLAG_FIFO);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册