xref: /btstack/port/msp432p401lp-cc256x/hal_flash_bank_msp432.h (revision fc456f6da9c3708d9551b3d5d265a56ce46aa362)
1*fc456f6dSMatthias Ringwald /*
2*fc456f6dSMatthias Ringwald  * Copyright (C) 2017 BlueKitchen GmbH
3*fc456f6dSMatthias Ringwald  *
4*fc456f6dSMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*fc456f6dSMatthias Ringwald  * modification, are permitted provided that the following conditions
6*fc456f6dSMatthias Ringwald  * are met:
7*fc456f6dSMatthias Ringwald  *
8*fc456f6dSMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*fc456f6dSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*fc456f6dSMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*fc456f6dSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*fc456f6dSMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*fc456f6dSMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*fc456f6dSMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*fc456f6dSMatthias Ringwald  *    from this software without specific prior written permission.
16*fc456f6dSMatthias Ringwald  *
17*fc456f6dSMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
18*fc456f6dSMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19*fc456f6dSMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20*fc456f6dSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
21*fc456f6dSMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22*fc456f6dSMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23*fc456f6dSMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24*fc456f6dSMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25*fc456f6dSMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26*fc456f6dSMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27*fc456f6dSMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*fc456f6dSMatthias Ringwald  * SUCH DAMAGE.
29*fc456f6dSMatthias Ringwald  *
30*fc456f6dSMatthias Ringwald  */
31*fc456f6dSMatthias Ringwald 
32*fc456f6dSMatthias Ringwald /*
33*fc456f6dSMatthias Ringwald  *  hal_flash_bank_msp432.h
34*fc456f6dSMatthias Ringwald  *
35*fc456f6dSMatthias Ringwald  *  HAL abstraction for Flash memory that can be written anywhere
36*fc456f6dSMatthias Ringwald  *  after being erased
37*fc456f6dSMatthias Ringwald  */
38*fc456f6dSMatthias Ringwald 
39*fc456f6dSMatthias Ringwald #ifndef __HAL_FLASH_BANK_MSP432_H
40*fc456f6dSMatthias Ringwald #define __HAL_FLASH_BANK_MSP432_H
41*fc456f6dSMatthias Ringwald 
42*fc456f6dSMatthias Ringwald #include <stdint.h>
43*fc456f6dSMatthias Ringwald #include "hal_flash_bank.h"
44*fc456f6dSMatthias Ringwald 
45*fc456f6dSMatthias Ringwald #if defined __cplusplus
46*fc456f6dSMatthias Ringwald extern "C" {
47*fc456f6dSMatthias Ringwald #endif
48*fc456f6dSMatthias Ringwald 
49*fc456f6dSMatthias Ringwald typedef struct {
50*fc456f6dSMatthias Ringwald 	uint32_t   sector_size;
51*fc456f6dSMatthias Ringwald 	uint32_t   sectors[2];
52*fc456f6dSMatthias Ringwald 	uintptr_t  banks[2];
53*fc456f6dSMatthias Ringwald } hal_flash_bank_msp432_t;
54*fc456f6dSMatthias Ringwald 
55*fc456f6dSMatthias Ringwald /**
56*fc456f6dSMatthias Ringwald  * Configure MSP432 HAL Flash Implementation
57*fc456f6dSMatthias Ringwald  *
58*fc456f6dSMatthias Ringwald  * @param context of hal_flash_bank_msp432_t
59*fc456f6dSMatthias Ringwald  * @param bank_size
60*fc456f6dSMatthias Ringwald  * @param bank_0_sector id
61*fc456f6dSMatthias Ringwald  * @param bank_1_sector id
62*fc456f6dSMatthias Ringwald  * @param bank_0_addr
63*fc456f6dSMatthias Ringwald  * @param bank_1_addr
64*fc456f6dSMatthias Ringwald  * @return
65*fc456f6dSMatthias Ringwald  */
66*fc456f6dSMatthias Ringwald const hal_flash_bank_t * hal_flash_bank_msp432_init_instance(hal_flash_bank_msp432_t * context, uint32_t bank_size,
67*fc456f6dSMatthias Ringwald 		uint32_t bank_0_sector, uint32_t bank_1_sector, uintptr_t bank_0_addr, uintptr_t bank_1_addr);
68*fc456f6dSMatthias Ringwald 
69*fc456f6dSMatthias Ringwald #if defined __cplusplus
70*fc456f6dSMatthias Ringwald }
71*fc456f6dSMatthias Ringwald #endif
72*fc456f6dSMatthias Ringwald #endif
73