[bsp][imxrt] 拆分 flexspi.c/h 驱动,区分 flash 大小

This commit is contained in:
guozhanxin 2018-12-29 21:09:01 +08:00
parent 1d35defcb8
commit 44f25b0e34
8 changed files with 30 additions and 2 deletions

View File

@ -461,4 +461,3 @@ SECTION("itcm") int rt_hw_flexspi_init(void)
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
return 0; return 0;
} }
INIT_PREV_EXPORT(rt_hw_flexspi_init);

View File

@ -385,4 +385,3 @@ SECTION("itcm") int rt_hw_flexspi_init(void)
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
return 0; return 0;
} }
INIT_PREV_EXPORT(rt_hw_flexspi_init);

View File

@ -5,6 +5,7 @@ cwd = GetCurrentDir()
# add the general drivers. # add the general drivers.
src = Split(""" src = Split("""
board.c board.c
drv_flexspi.c
""") """)
CPPPATH = [cwd] CPPPATH = [cwd]

View File

@ -0,0 +1,5 @@
#include <rtthread.h>
#include <drv_flexspi.h>
INIT_PREV_EXPORT(rt_hw_flexspi_init);

View File

@ -0,0 +1,18 @@
#ifndef __DRV_FLEXSPI_H__
#define __DRV_FLEXSPI_H__
#include "fsl_flexspi.h"
#include "fsl_common.h"
#ifdef BOARD_USING_QSPIFLASH
#define FLASH_SIZE 0x2000 /* 64Mb/KByte */
#define FLASH_PAGE_SIZE 256
#define FLEXSPI_NOR_SECTOR_SIZE 0x1000 /* 4K */
#elif defined(BOARD_USING_HYPERFLASH)
#define FLASH_SIZE 0x10000 /* 512Mb/KByte */
#define FLASH_PAGE_SIZE 512
#define FLEXSPI_NOR_SECTOR_SIZE 0x40000 /* 256K */
#endif
#define FLEXSPI_AMBA_BASE FlexSPI_AMBA_BASE
extern int rt_hw_flexspi_init(void);
extern status_t flexspi_nor_flash_erase_sector(FLEXSPI_Type *base, uint32_t address);
extern status_t flexspi_nor_flash_page_program(FLEXSPI_Type *base, uint32_t address, const uint32_t *src);
#endif

View File

@ -5,6 +5,7 @@ cwd = GetCurrentDir()
# add the general drivers. # add the general drivers.
src = Split(""" src = Split("""
board.c board.c
drv_flexspi.c
""") """)
CPPPATH = [cwd] CPPPATH = [cwd]

View File

@ -0,0 +1,5 @@
#include <rtthread.h>
#include <drv_flexspi.h>
INIT_PREV_EXPORT(rt_hw_flexspi_init);