forked from RT-Thread/rt-thread
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrv_spi_flash.c
More file actions
43 lines (37 loc) · 1 KB
/
drv_spi_flash.c
File metadata and controls
43 lines (37 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-04-25 14:01:16
* @LastEditTime: 2021-04-30 14:43:12
* @Description: This files is for
*
* @Modify History:
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------
*/
#include <board.h>
#include <drv_spi.h>
#include <rtdevice.h>
#include <rthw.h>
#include <finsh.h>
#include "ft_spi.h"
#ifdef BSP_USE_SPI
#include "dev_spi_flash.h"
#include "dev_spi_flash_sfud.h"
static int rt_hw_spi_flash_init(void)
{
uint16_t cs_pin = 5;
rt_hw_spi_device_attach(SPI_BUS_NAME, SPI_DEV_NAME, cs_pin);
rt_kprintf("attach spi flash\r\n");
/* lookup flah */
if (RT_NULL == rt_sfud_flash_probe("S25FS256S", SPI_DEV_NAME))
{
rt_kprintf("attach spi flash failed\r\n");
return -RT_ERROR;
}
return RT_EOK;
}
INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
#endif