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 "hardware/flash.h"
12 #include "hal_flash_bank.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 // 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
19 #ifndef PICO_FLASH_BANK_TOTAL_SIZE
20 #define PICO_FLASH_BANK_TOTAL_SIZE (FLASH_SECTOR_SIZE * 2u)
21 #endif
22 
23 // 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
24 #ifndef PICO_FLASH_BANK_STORAGE_OFFSET
25 #define PICO_FLASH_BANK_STORAGE_OFFSET (PICO_FLASH_SIZE_BYTES - PICO_FLASH_BANK_TOTAL_SIZE)
26 #endif
27 
28 /**
29  * \brief Return the singleton BTstack HAL flash instance, used for non-volatile storage
30  * \ingroup pico_btstack
31  *
32  * \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)
33  */
34 const hal_flash_bank_t *pico_flash_bank_instance(void);
35 
36 #ifdef __cplusplus
37 }
38 #endif
39 #endif
40