xref: /btstack/port/max32630-fthr/src/hal_flash_bank_mxc.h (revision 2fca4dad957cd7b88f4657ed51e89c12615dda72)
117ae5bc4SMatthias Ringwald /*
217ae5bc4SMatthias Ringwald  * Copyright (C) 2017 BlueKitchen GmbH
317ae5bc4SMatthias Ringwald  *
417ae5bc4SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
517ae5bc4SMatthias Ringwald  * modification, are permitted provided that the following conditions
617ae5bc4SMatthias Ringwald  * are met:
717ae5bc4SMatthias Ringwald  *
817ae5bc4SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
917ae5bc4SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
1017ae5bc4SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
1117ae5bc4SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
1217ae5bc4SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
1317ae5bc4SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
1417ae5bc4SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
1517ae5bc4SMatthias Ringwald  *    from this software without specific prior written permission.
1617ae5bc4SMatthias Ringwald  *
17*2fca4dadSMilanka Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
1817ae5bc4SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1917ae5bc4SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20*2fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
21*2fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2217ae5bc4SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2317ae5bc4SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2417ae5bc4SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2517ae5bc4SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2617ae5bc4SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
2717ae5bc4SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2817ae5bc4SMatthias Ringwald  * SUCH DAMAGE.
2917ae5bc4SMatthias Ringwald  *
3017ae5bc4SMatthias Ringwald  */
3117ae5bc4SMatthias Ringwald 
3217ae5bc4SMatthias Ringwald /*
3317ae5bc4SMatthias Ringwald  *  hal_flash_sector_maxim.h
3417ae5bc4SMatthias Ringwald  *
3517ae5bc4SMatthias Ringwald  *  HAL abstraction for Flash memory that can be written anywhere
3617ae5bc4SMatthias Ringwald  *  after being erased implemented with memory
3717ae5bc4SMatthias Ringwald  */
3817ae5bc4SMatthias Ringwald 
3917ae5bc4SMatthias Ringwald #ifndef __HAL_FLASH_BANK_MAXIM_H
4017ae5bc4SMatthias Ringwald #define __HAL_FLASH_BANK_MAXIM_H
4117ae5bc4SMatthias Ringwald 
4217ae5bc4SMatthias Ringwald #include <stdint.h>
4317ae5bc4SMatthias Ringwald #include "hal_flash_bank.h"
4417ae5bc4SMatthias Ringwald 
4517ae5bc4SMatthias Ringwald #if defined __cplusplus
4617ae5bc4SMatthias Ringwald extern "C" {
4717ae5bc4SMatthias Ringwald #endif
4817ae5bc4SMatthias Ringwald 
4917ae5bc4SMatthias Ringwald typedef struct {
5017ae5bc4SMatthias Ringwald 	uint32_t   sector_size;
5117ae5bc4SMatthias Ringwald 	uintptr_t  banks[2];
5217ae5bc4SMatthias Ringwald 
5317ae5bc4SMatthias Ringwald } hal_flash_bank_mxc_t;
5417ae5bc4SMatthias Ringwald 
5517ae5bc4SMatthias Ringwald /**
5617ae5bc4SMatthias Ringwald  * Configure MXC HAL Flash Implementation
5717ae5bc4SMatthias Ringwald  *
5817ae5bc4SMatthias Ringwald  * @param context of hal_flash_bank_mxc_t
5917ae5bc4SMatthias Ringwald  * @param sector_size
6017ae5bc4SMatthias Ringwald  * @param bank_0_addr
6117ae5bc4SMatthias Ringwald  * @param bank_1_addr
6217ae5bc4SMatthias Ringwald  * @return
6317ae5bc4SMatthias Ringwald  */
6417ae5bc4SMatthias Ringwald const hal_flash_bank_t * hal_flash_bank_mxc_init_instance(hal_flash_bank_mxc_t * context, uint32_t sector_size, uintptr_t bank_0_addr, uintptr_t bank_1_addr);
6517ae5bc4SMatthias Ringwald 
6617ae5bc4SMatthias Ringwald #if defined __cplusplus
6717ae5bc4SMatthias Ringwald }
6817ae5bc4SMatthias Ringwald #endif
6917ae5bc4SMatthias Ringwald #endif
70