Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[update] add fal component. #5662

Merged
merged 6 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bsp/at32/Libraries/rt_drivers/drv_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifdef BSP_USING_ON_CHIP_FLASH
#include "drv_flash.h"

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include "fal.h"
#endif

Expand Down Expand Up @@ -171,7 +171,7 @@ int at32_flash_erase(rt_uint32_t addr, size_t size)
return size;
}

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)

static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size);
static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size);
Expand Down
4 changes: 2 additions & 2 deletions bsp/bluetrum/libraries/hal_drivers/drv_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

#ifdef BSP_USING_ON_CHIP_FLASH

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include "fal.h"
#endif

//#define DRV_DEBUG
#define LOG_TAG "drv.flash"
#include <drv_log.h>

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)

#define AB32_FLASH_START_ADDRESS 0x00000000
#define AB32_FLASH_SIZE (1024 * 1024)
Expand Down
2 changes: 1 addition & 1 deletion bsp/maxim/MAX32660_EVSYS/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ menu "On-chip Peripheral Drivers"
endif
endif
config BSP_USING_ON_CHIP_FLASH
select PKG_USING_FAL
select RT_USING_FAL
bool "Enable on-chip FLASH"
default n
config BSP_USING_I2C
Expand Down
2 changes: 1 addition & 1 deletion bsp/mm32f327x/drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ menu "Hardware Drivers Config"
config OCFLASH_USE_FAL
bool "Enable On Chip Flash FAL Driver"
depends on BSP_USING_OCFLASH
select PKG_USING_FAL
select RT_USING_FAL
default n
config OCFLASH_USE_LFS
bool "Enable On Chip Flash DFS Driver"
Expand Down
4 changes: 2 additions & 2 deletions bsp/n32g452xx/Libraries/rt_drivers/drv_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifdef BSP_USING_ON_CHIP_FLASH
#include "drv_flash.h"

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include "fal.h"
#endif

Expand Down Expand Up @@ -172,7 +172,7 @@ int n32_flash_erase(rt_uint32_t addr, size_t size)
return size;
}

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)

static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size);
static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size);
Expand Down
4 changes: 2 additions & 2 deletions bsp/nrf5x/libraries/drivers/drv_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#ifdef BSP_USING_ON_CHIP_FLASH

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include "fal.h"
#endif

Expand Down Expand Up @@ -155,7 +155,7 @@ int mcu_flash_erase(rt_uint32_t addr, size_t size)
return size;
}

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)

static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size);
static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size);
Expand Down
2 changes: 1 addition & 1 deletion bsp/nrf5x/libraries/drivers/drv_qspi_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stdint.h>
#include "board.h"
#include "nrfx_qspi.h"
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include <fal.h>

//log
Expand Down
2 changes: 1 addition & 1 deletion bsp/nrf5x/nrf52832/applications/mnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#ifdef BSP_USING_ON_CHIP_FS

#ifndef PKG_USING_FAL
#ifndef RT_USING_FAL
#error "if you want to use on chip filesystem, you need to enable FAL package()"
#endif

Expand Down
2 changes: 1 addition & 1 deletion bsp/nrf5x/nrf52832/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ menu "On-chip Peripheral Drivers"

endif
config BSP_USING_ON_CHIP_FLASH
select PKG_USING_FAL
select RT_USING_FAL
bool "Enable on-chip FLASH"
default n

Expand Down
4 changes: 2 additions & 2 deletions bsp/nrf5x/nrf52840/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ menu "Onboard Peripheral Drivers"


menuconfig BSP_USING_QSPI_FLASH
select PKG_USING_FAL
select RT_USING_FAL
bool "Enable QSPI FLASH(MX25R64 8MB)"
default n
depends on BSP_BOARD_PCA_10056
Expand Down Expand Up @@ -378,7 +378,7 @@ menu "On-chip Peripheral Drivers"


config BSP_USING_ON_CHIP_FLASH
select PKG_USING_FAL
select RT_USING_FAL
bool "Enable on-chip FLASH"
default n

Expand Down
2 changes: 1 addition & 1 deletion bsp/nuvoton/libraries/m031/rtt_port/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config SOC_SERIES_M032

config BSP_USING_FMC
bool "Enable Flash Memory Controller(FMC)"
select PKG_USING_FAL
select RT_USING_FAL
default n

config BSP_USING_GPIO
Expand Down
18 changes: 9 additions & 9 deletions bsp/nuvoton/libraries/m031/rtt_port/drv_fmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <rtdevice.h>
#include "NuMicro.h"

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include <fal.h>
#endif

Expand All @@ -31,15 +31,15 @@

/* Private functions ------------------------------------------------------------*/
static int nu_fmc_init(void);
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
static int aprom_read(long offset, uint8_t *buf, size_t size);
static int aprom_write(long offset, const uint8_t *buf, size_t size);
static int aprom_erase(long offset, size_t size);

static int ldrom_read(long offset, uint8_t *buf, size_t size);
static int ldrom_write(long offset, const uint8_t *buf, size_t size);
static int ldrom_erase(long offset, size_t size);
#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

/* Public functions -------------------------------------------------------------*/
int nu_fmc_read(long offset, uint8_t *buf, size_t size);
Expand All @@ -50,10 +50,10 @@ int nu_fmc_erase(long offset, size_t size);
static rt_mutex_t g_mutex_fmc = RT_NULL;

/* Public variables -------------------------------------------------------------*/
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
const struct fal_flash_dev Onchip_aprom_flash = { "OnChip_APROM", FMC_APROM_BASE, FMC_APROM_END, FMC_FLASH_PAGE_SIZE, {NULL, aprom_read, aprom_write, aprom_erase} };
const struct fal_flash_dev Onchip_ldrom_flash = { "OnChip_LDROM", FMC_LDROM_BASE, FMC_LDROM_END, FMC_FLASH_PAGE_SIZE, {NULL, ldrom_read, ldrom_write, ldrom_erase} };
#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

int nu_fmc_read(long addr, uint8_t *buf, size_t size)
{
Expand Down Expand Up @@ -277,7 +277,7 @@ int nu_fmc_erase(long addr, size_t size)
return erased_size;
}

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)

static int aprom_read(long offset, uint8_t *buf, size_t size)
{
Expand Down Expand Up @@ -309,7 +309,7 @@ static int ldrom_erase(long offset, size_t size)
return nu_fmc_erase(Onchip_ldrom_flash.addr + offset, size);
}

#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

static int nu_fmc_init(void)
{
Expand All @@ -319,8 +319,8 @@ static int nu_fmc_init(void)

g_mutex_fmc = rt_mutex_create("nu_fmc_lock", RT_IPC_FLAG_PRIO);

/* PKG_USING_FAL */
#if defined(PKG_USING_FAL)
/* RT_USING_FAL */
#if defined(RT_USING_FAL)
fal_init();
#endif

Expand Down
2 changes: 1 addition & 1 deletion bsp/nuvoton/libraries/m2354/rtt_port/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config SOC_SERIES_M2354

config BSP_USING_FMC
bool "Enable Flash Memory Controller(FMC)"
select PKG_USING_FAL
select RT_USING_FAL
default n

config BSP_USING_GPIO
Expand Down
18 changes: 9 additions & 9 deletions bsp/nuvoton/libraries/m2354/rtt_port/drv_fmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <rtdevice.h>
#include "NuMicro.h"

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include <fal.h>
#endif

Expand All @@ -28,15 +28,15 @@

/* Private functions ------------------------------------------------------------*/
static int nu_fmc_init(void);
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
static int aprom_read(long offset, uint8_t *buf, size_t size);
static int aprom_write(long offset, const uint8_t *buf, size_t size);
static int aprom_erase(long offset, size_t size);

static int ldrom_read(long offset, uint8_t *buf, size_t size);
static int ldrom_write(long offset, const uint8_t *buf, size_t size);
static int ldrom_erase(long offset, size_t size);
#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

/* Public functions -------------------------------------------------------------*/
int nu_fmc_read(long offset, uint8_t *buf, size_t size);
Expand All @@ -47,10 +47,10 @@ int nu_fmc_erase(long offset, size_t size);
static rt_mutex_t g_mutex_fmc = RT_NULL;

/* Public variables -------------------------------------------------------------*/
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
const struct fal_flash_dev Onchip_aprom_flash = { "OnChip_APROM", FMC_APROM_BASE, FMC_APROM_END, FMC_FLASH_PAGE_SIZE, {NULL, aprom_read, aprom_write, aprom_erase} };
const struct fal_flash_dev Onchip_ldrom_flash = { "OnChip_LDROM", FMC_LDROM_BASE, FMC_LDROM_END, FMC_FLASH_PAGE_SIZE, {NULL, ldrom_read, ldrom_write, ldrom_erase} };
#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

int nu_fmc_read(long addr, uint8_t *buf, size_t size)
{
Expand Down Expand Up @@ -274,7 +274,7 @@ int nu_fmc_erase(long addr, size_t size)
return erased_size;
}

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)

static int aprom_read(long offset, uint8_t *buf, size_t size)
{
Expand Down Expand Up @@ -306,7 +306,7 @@ static int ldrom_erase(long offset, size_t size)
return nu_fmc_erase(Onchip_ldrom_flash.addr + offset, size);
}

#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

static int nu_fmc_init(void)
{
Expand All @@ -316,8 +316,8 @@ static int nu_fmc_init(void)

g_mutex_fmc = rt_mutex_create("nu_fmc_lock", RT_IPC_FLAG_PRIO);

/* PKG_USING_FAL */
#if defined(PKG_USING_FAL)
/* RT_USING_FAL */
#if defined(RT_USING_FAL)
fal_init();
#endif

Expand Down
2 changes: 1 addition & 1 deletion bsp/nuvoton/libraries/m480/rtt_port/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config SOC_SERIES_M480

config BSP_USING_FMC
bool "Enable Flash Memory Controller(FMC)"
select PKG_USING_FAL
select RT_USING_FAL
default n

config BSP_USING_GPIO
Expand Down
18 changes: 9 additions & 9 deletions bsp/nuvoton/libraries/m480/rtt_port/drv_fmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <rtdevice.h>
#include "NuMicro.h"

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include <fal.h>
#endif

Expand All @@ -28,15 +28,15 @@

/* Private functions ------------------------------------------------------------*/
static int nu_fmc_init(void);
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
static int aprom_read(long offset, uint8_t *buf, size_t size);
static int aprom_write(long offset, const uint8_t *buf, size_t size);
static int aprom_erase(long offset, size_t size);

static int ldrom_read(long offset, uint8_t *buf, size_t size);
static int ldrom_write(long offset, const uint8_t *buf, size_t size);
static int ldrom_erase(long offset, size_t size);
#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

/* Public functions -------------------------------------------------------------*/
int nu_fmc_read(long offset, uint8_t *buf, size_t size);
Expand All @@ -47,10 +47,10 @@ int nu_fmc_erase(long offset, size_t size);
static rt_mutex_t g_mutex_fmc = RT_NULL;

/* Public variables -------------------------------------------------------------*/
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
const struct fal_flash_dev Onchip_aprom_flash = { "OnChip_APROM", FMC_APROM_BASE, FMC_APROM_END, FMC_FLASH_PAGE_SIZE, {NULL, aprom_read, aprom_write, aprom_erase} };
const struct fal_flash_dev Onchip_ldrom_flash = { "OnChip_LDROM", FMC_LDROM_BASE, FMC_LDROM_END, FMC_FLASH_PAGE_SIZE, {NULL, ldrom_read, ldrom_write, ldrom_erase} };
#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

int nu_fmc_read(long addr, uint8_t *buf, size_t size)
{
Expand Down Expand Up @@ -291,7 +291,7 @@ int nu_fmc_erase(long addr, size_t size)
return erased_size;
}

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)

static int aprom_read(long offset, uint8_t *buf, size_t size)
{
Expand Down Expand Up @@ -323,7 +323,7 @@ static int ldrom_erase(long offset, size_t size)
return nu_fmc_erase(Onchip_ldrom_flash.addr + offset, size);
}

#endif /* PKG_USING_FAL */
#endif /* RT_USING_FAL */

static int nu_fmc_init(void)
{
Expand All @@ -334,8 +334,8 @@ static int nu_fmc_init(void)
g_mutex_fmc = rt_mutex_create("nu_fmc_lock", RT_IPC_FLAG_PRIO);
RT_ASSERT(g_mutex_fmc != RT_NULL);

/* PKG_USING_FAL */
#if defined(PKG_USING_FAL)
/* RT_USING_FAL */
#if defined(RT_USING_FAL)
fal_init();
#endif

Expand Down
4 changes: 2 additions & 2 deletions bsp/nuvoton/nk-980iot/applications/mnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <sys/stat.h>
#include <sys/statfs.h>

#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
#include <fal.h>
#endif

Expand Down Expand Up @@ -214,7 +214,7 @@ INIT_ENV_EXPORT(filesystem_init);
#if defined(BOARD_USING_STORAGE_SPIFLASH)
int mnt_init_spiflash0(void)
{
#if defined(PKG_USING_FAL)
#if defined(RT_USING_FAL)
extern int fal_init_check(void);
if (!fal_init_check())
fal_init();
Expand Down
Loading