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