1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2020-05-05     supperthomas this is sample you can change by yourself
9  *
10  */
11 
12 #ifndef _FAL_CFG_H_
13 #define _FAL_CFG_H_
14 
15 #include <rtconfig.h>
16 #include <board.h>
17 
18 #if (defined(BSP_USING_QSPI_FLASH)&&defined(BSP_USING_ON_CHIP_FLASH))
19 
20 #define ON_CHIP_FLASH_DEV_NAME             "mcu_onchip"
21 #define NOR_FLASH_DEV_NAME             "norflash0"
22 
23 extern const struct fal_flash_dev mcu_onchip_flash;
24 extern struct fal_flash_dev nor_flash0;
25 
26 /* flash device table */
27 #define FAL_FLASH_DEV_TABLE                                          \
28     {                                                                    \
29         &mcu_onchip_flash,                                           \
30         &nor_flash0,                                                     \
31     }
32 /* ====================== Partition Configuration ========================== */
33 #ifdef FAL_PART_HAS_TABLE_CFG
34 /* partition table */
35 #define FAL_PART_TABLE                                                               \
36     {                                                                                    \
37         {FAL_PART_MAGIC_WORD, "bl",            ON_CHIP_FLASH_DEV_NAME,         0,   64*1024, 0}, \
38         {FAL_PART_MAGIC_WORD, "app_flash",     ON_CHIP_FLASH_DEV_NAME,   64*1024,  960*1024, 0}, \
39         {FAL_PART_MAGIC_WORD, "nor_flash_part_0", NOR_FLASH_DEV_NAME,         0, 1024*1024, 0}, \
40         {FAL_PART_MAGIC_WORD, "nor_flash_part_1", NOR_FLASH_DEV_NAME, 1024*1024, 7*1024*1024, 0}, \
41     }
42 #endif /* FAL_PART_HAS_TABLE_CFG */
43 
44 #elif defined(BSP_USING_QSPI_FLASH)
45 
46 #define NOR_FLASH_DEV_NAME             "norflash0"
47 extern struct fal_flash_dev nor_flash0;
48 
49 /* flash device table */
50 #define FAL_FLASH_DEV_TABLE                                          \
51     {                                                                    \
52         &nor_flash0,                                                     \
53     }
54 /* ====================== Partition Configuration ========================== */
55 #ifdef FAL_PART_HAS_TABLE_CFG
56 /* partition table */
57 #define FAL_PART_TABLE                                                               \
58     {                                                                                    \
59         {FAL_PART_MAGIC_WORD, "nor_flash_part_0", NOR_FLASH_DEV_NAME,         0, 1024*1024, 0}, \
60         {FAL_PART_MAGIC_WORD,  "nor_flash_part_1", NOR_FLASH_DEV_NAME, 1024*1024, 7*1024*1024, 0}, \
61     }
62 #endif
63 #elif defined(BSP_USING_ON_CHIP_FLASH)
64 extern const struct fal_flash_dev mcu_onchip_flash;
65 #define ON_CHIP_FLASH_DEV_NAME             "mcu_onchip"
66 /* flash device table */
67 #define FAL_FLASH_DEV_TABLE                                          \
68     {                                                                    \
69         &mcu_onchip_flash,                                               \
70     }
71 /* ====================== Partition Configuration ========================== */
72 #ifdef FAL_PART_HAS_TABLE_CFG
73 /* partition table */
74 #define FAL_PART_TABLE                                                               \
75     {                                                                                    \
76         {FAL_PART_MAGIC_WORD,        "bl",           ON_CHIP_FLASH_DEV_NAME,         0,   64*1024, 0}, \
77         {FAL_PART_MAGIC_WORD,       "app_flash",     ON_CHIP_FLASH_DEV_NAME,   64*1024,  960*1024, 0}, \
78     }
79 #endif
80 #endif
81 
82 #endif /* _FAL_CFG_H_ */
83