1*17ae5bc4SMatthias Ringwald /* 2*17ae5bc4SMatthias Ringwald * Copyright (C) 2017 BlueKitchen GmbH 3*17ae5bc4SMatthias Ringwald * 4*17ae5bc4SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5*17ae5bc4SMatthias Ringwald * modification, are permitted provided that the following conditions 6*17ae5bc4SMatthias Ringwald * are met: 7*17ae5bc4SMatthias Ringwald * 8*17ae5bc4SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9*17ae5bc4SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10*17ae5bc4SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11*17ae5bc4SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12*17ae5bc4SMatthias Ringwald * documentation and/or other materials provided with the distribution. 13*17ae5bc4SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14*17ae5bc4SMatthias Ringwald * contributors may be used to endorse or promote products derived 15*17ae5bc4SMatthias Ringwald * from this software without specific prior written permission. 16*17ae5bc4SMatthias Ringwald * 17*17ae5bc4SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS 18*17ae5bc4SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19*17ae5bc4SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 20*17ae5bc4SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 21*17ae5bc4SMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 22*17ae5bc4SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23*17ae5bc4SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 24*17ae5bc4SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 25*17ae5bc4SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26*17ae5bc4SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27*17ae5bc4SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28*17ae5bc4SMatthias Ringwald * SUCH DAMAGE. 29*17ae5bc4SMatthias Ringwald * 30*17ae5bc4SMatthias Ringwald */ 31*17ae5bc4SMatthias Ringwald 32*17ae5bc4SMatthias Ringwald /* 33*17ae5bc4SMatthias Ringwald * btstack_tlv_flash_bank.h 34*17ae5bc4SMatthias Ringwald * 35*17ae5bc4SMatthias Ringwald * Implementation for BTstack's Tag Value Length Persistent Storage implementations 36*17ae5bc4SMatthias Ringwald * using hal_flash_bank storage 37*17ae5bc4SMatthias Ringwald */ 38*17ae5bc4SMatthias Ringwald 39*17ae5bc4SMatthias Ringwald #ifndef __BTSTACK_TLV_FLASH_BANK_H 40*17ae5bc4SMatthias Ringwald #define __BTSTACK_TLV_FLASH_BANK_H 41*17ae5bc4SMatthias Ringwald 42*17ae5bc4SMatthias Ringwald #include <stdint.h> 43*17ae5bc4SMatthias Ringwald #include "btstack_tlv.h" 44*17ae5bc4SMatthias Ringwald #include "hal_flash_bank.h" 45*17ae5bc4SMatthias Ringwald 46*17ae5bc4SMatthias Ringwald #if defined __cplusplus 47*17ae5bc4SMatthias Ringwald extern "C" { 48*17ae5bc4SMatthias Ringwald #endif 49*17ae5bc4SMatthias Ringwald 50*17ae5bc4SMatthias Ringwald typedef struct { 51*17ae5bc4SMatthias Ringwald const hal_flash_bank_t * hal_flash_bank_impl; 52*17ae5bc4SMatthias Ringwald void * hal_flash_bank_context; 53*17ae5bc4SMatthias Ringwald int current_bank; 54*17ae5bc4SMatthias Ringwald int write_offset; 55*17ae5bc4SMatthias Ringwald } btstack_tlv_flash_bank_t; 56*17ae5bc4SMatthias Ringwald 57*17ae5bc4SMatthias Ringwald /** 58*17ae5bc4SMatthias Ringwald * Init Tag Length Value Store 59*17ae5bc4SMatthias Ringwald * @param context btstack_tlv_flash_bank_t 60*17ae5bc4SMatthias Ringwald * @param hal_flash_bank_impl of hal_flash_bank interface 61*17ae5bc4SMatthias Ringwald * @Param hal_flash_bank_context of hal_flash_bank_interface 62*17ae5bc4SMatthias Ringwald */ 63*17ae5bc4SMatthias Ringwald const btstack_tlv_t * btstack_tlv_flash_bank_init_instance(btstack_tlv_flash_bank_t * context, const hal_flash_bank_t * hal_flash_bank_impl, void * hal_flash_bank_context); 64*17ae5bc4SMatthias Ringwald 65*17ae5bc4SMatthias Ringwald #if defined __cplusplus 66*17ae5bc4SMatthias Ringwald } 67*17ae5bc4SMatthias Ringwald #endif 68*17ae5bc4SMatthias Ringwald #endif // __BTSTACK_TLV_FLASH_BANK_H 69