1 /*
2  * Copyright (c) 2023 Raspberry Pi (Trading) Ltd.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _PICO_BTSTACK_FLASH_BANK_H
8 #define _PICO_BTSTACK_FLASH_BANK_H
9 
10 #include "pico.h"
11 #include "hal_flash_bank.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 // PICO_CONFIG: PICO_FLASH_BANK_TOTAL_SIZE, Total size of the Bluetooth flash storage. Must be an even multiple of FLASH_SECTOR_SIZE, type=int, default=FLASH_SECTOR_SIZE * 2, group=pico_btstack
18 #ifndef PICO_FLASH_BANK_TOTAL_SIZE
19 #define PICO_FLASH_BANK_TOTAL_SIZE (FLASH_SECTOR_SIZE * 2u)
20 #endif
21 
22 // PICO_CONFIG: PICO_FLASH_BANK_STORAGE_OFFSET, Offset in flash of the Bluetooth flash storage, type=int, default=PICO_FLASH_SIZE_BYTES - PICO_FLASH_BANK_TOTAL_SIZE, group=pico_btstack
23 #ifndef PICO_FLASH_BANK_STORAGE_OFFSET
24 #define PICO_FLASH_BANK_STORAGE_OFFSET (PICO_FLASH_SIZE_BYTES - PICO_FLASH_BANK_TOTAL_SIZE)
25 #endif
26 
27 /**
28  * \brief Return the singleton BTstack HAL flash instance, used for non-volatile storage
29  * \ingroup pico_btstack
30  *
31  * \note By default two sectors at the end of flash are used (see \c PICO_FLASH_BANK_STORAGE_OFFSET and \c PICO_FLASH_BANK_TOTAL_SIZE)
32  */
33 const hal_flash_bank_t *pico_flash_bank_instance(void);
34 
35 #ifdef __cplusplus
36 }
37 #endif
38 #endif
39