1*5fd0122aSMatthias Ringwald /* --COPYRIGHT--,BSD 2*5fd0122aSMatthias Ringwald * Copyright (c) 2017, Texas Instruments Incorporated 3*5fd0122aSMatthias Ringwald * All rights reserved. 4*5fd0122aSMatthias Ringwald * 5*5fd0122aSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 6*5fd0122aSMatthias Ringwald * modification, are permitted provided that the following conditions 7*5fd0122aSMatthias Ringwald * are met: 8*5fd0122aSMatthias Ringwald * 9*5fd0122aSMatthias Ringwald * * Redistributions of source code must retain the above copyright 10*5fd0122aSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 11*5fd0122aSMatthias Ringwald * 12*5fd0122aSMatthias Ringwald * * Redistributions in binary form must reproduce the above copyright 13*5fd0122aSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 14*5fd0122aSMatthias Ringwald * documentation and/or other materials provided with the distribution. 15*5fd0122aSMatthias Ringwald * 16*5fd0122aSMatthias Ringwald * * Neither the name of Texas Instruments Incorporated nor the names of 17*5fd0122aSMatthias Ringwald * its contributors may be used to endorse or promote products derived 18*5fd0122aSMatthias Ringwald * from this software without specific prior written permission. 19*5fd0122aSMatthias Ringwald * 20*5fd0122aSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21*5fd0122aSMatthias Ringwald * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22*5fd0122aSMatthias Ringwald * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23*5fd0122aSMatthias Ringwald * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24*5fd0122aSMatthias Ringwald * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25*5fd0122aSMatthias Ringwald * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26*5fd0122aSMatthias Ringwald * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27*5fd0122aSMatthias Ringwald * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28*5fd0122aSMatthias Ringwald * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29*5fd0122aSMatthias Ringwald * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30*5fd0122aSMatthias Ringwald * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*5fd0122aSMatthias Ringwald * --/COPYRIGHT--*/ 32*5fd0122aSMatthias Ringwald #ifndef __FLASH_H__ 33*5fd0122aSMatthias Ringwald #define __FLASH_H__ 34*5fd0122aSMatthias Ringwald 35*5fd0122aSMatthias Ringwald #include <stdbool.h> 36*5fd0122aSMatthias Ringwald #include <ti/devices/msp432p4xx/inc/msp.h> 37*5fd0122aSMatthias Ringwald 38*5fd0122aSMatthias Ringwald /* Define to ensure that our current MSP432 has the FLCTL module. This 39*5fd0122aSMatthias Ringwald definition is included in the device specific header file */ 40*5fd0122aSMatthias Ringwald #ifdef __MCU_HAS_FLCTL__ 41*5fd0122aSMatthias Ringwald 42*5fd0122aSMatthias Ringwald //***************************************************************************** 43*5fd0122aSMatthias Ringwald // 44*5fd0122aSMatthias Ringwald //! \addtogroup flash_api 45*5fd0122aSMatthias Ringwald //! @{ 46*5fd0122aSMatthias Ringwald // 47*5fd0122aSMatthias Ringwald //***************************************************************************** 48*5fd0122aSMatthias Ringwald 49*5fd0122aSMatthias Ringwald //***************************************************************************** 50*5fd0122aSMatthias Ringwald // 51*5fd0122aSMatthias Ringwald // If building with a C++ compiler, make all of the definitions in this header 52*5fd0122aSMatthias Ringwald // have a C binding. 53*5fd0122aSMatthias Ringwald // 54*5fd0122aSMatthias Ringwald //***************************************************************************** 55*5fd0122aSMatthias Ringwald #ifdef __cplusplus 56*5fd0122aSMatthias Ringwald extern "C" 57*5fd0122aSMatthias Ringwald { 58*5fd0122aSMatthias Ringwald #endif 59*5fd0122aSMatthias Ringwald 60*5fd0122aSMatthias Ringwald //***************************************************************************** 61*5fd0122aSMatthias Ringwald // 62*5fd0122aSMatthias Ringwald // Control specific variables 63*5fd0122aSMatthias Ringwald // 64*5fd0122aSMatthias Ringwald //***************************************************************************** 65*5fd0122aSMatthias Ringwald #define FLASH_BURST_PRG_BIT 0x03 66*5fd0122aSMatthias Ringwald 67*5fd0122aSMatthias Ringwald /* Interrupts */ 68*5fd0122aSMatthias Ringwald #define FLASH_PROGRAM_ERROR FLCTL_IFG_PRG_ERR 69*5fd0122aSMatthias Ringwald #define FLASH_BENCHMARK_INT FLCTL_IFG_BMRK 70*5fd0122aSMatthias Ringwald #define FLASH_ERASE_COMPLETE FLCTL_IFG_ERASE 71*5fd0122aSMatthias Ringwald #define FLASH_BRSTPRGM_COMPLETE FLCTL_IFG_PRGB 72*5fd0122aSMatthias Ringwald #define FLASH_WRDPRGM_COMPLETE FLCTL_IFG_PRG 73*5fd0122aSMatthias Ringwald #define FLASH_POSTVERIFY_FAILED FLCTL_IFG_AVPST 74*5fd0122aSMatthias Ringwald #define FLASH_PREVERIFY_FAILED FLCTL_IFG_AVPRE 75*5fd0122aSMatthias Ringwald #define FLASH_BRSTRDCMP_COMPLETE FLCTL_IFG_RDBRST 76*5fd0122aSMatthias Ringwald 77*5fd0122aSMatthias Ringwald #define FLASH_NORMAL_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_0 78*5fd0122aSMatthias Ringwald #define FLASH_MARGIN0_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_1 79*5fd0122aSMatthias Ringwald #define FLASH_MARGIN1_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_2 80*5fd0122aSMatthias Ringwald #define FLASH_PROGRAM_VERIFY_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_3 81*5fd0122aSMatthias Ringwald #define FLASH_ERASE_VERIFY_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_4 82*5fd0122aSMatthias Ringwald #define FLASH_LEAKAGE_VERIFY_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_5 83*5fd0122aSMatthias Ringwald #define FLASH_MARGIN0B_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_9 84*5fd0122aSMatthias Ringwald #define FLASH_MARGIN1B_READ_MODE FLCTL_BANK0_RDCTL_RD_MODE_10 85*5fd0122aSMatthias Ringwald 86*5fd0122aSMatthias Ringwald #define FLASH_PRGBRSTCTLSTAT_BURSTSTATUS_COMPLETE FLCTL_PRGBRST_CTLSTAT_BURST_STATUS_7 87*5fd0122aSMatthias Ringwald 88*5fd0122aSMatthias Ringwald #define FLASH_BANK0 0x00 89*5fd0122aSMatthias Ringwald #define FLASH_BANK1 0x01 90*5fd0122aSMatthias Ringwald #define FLASH_DATA_READ 0x00 91*5fd0122aSMatthias Ringwald #define FLASH_INSTRUCTION_FETCH 0x01 92*5fd0122aSMatthias Ringwald 93*5fd0122aSMatthias Ringwald #define FLASH_MAIN_MEMORY_SPACE_BANK0 0x01 94*5fd0122aSMatthias Ringwald #define FLASH_MAIN_MEMORY_SPACE_BANK1 0x02 95*5fd0122aSMatthias Ringwald #define FLASH_INFO_MEMORY_SPACE_BANK0 0x03 96*5fd0122aSMatthias Ringwald #define FLASH_INFO_MEMORY_SPACE_BANK1 0x04 97*5fd0122aSMatthias Ringwald 98*5fd0122aSMatthias Ringwald #define FLASH_MAIN_SPACE FLCTL_RDBRST_CTLSTAT_MEM_TYPE_0 99*5fd0122aSMatthias Ringwald #define FLASH_INFO_SPACE FLCTL_RDBRST_CTLSTAT_MEM_TYPE_1 100*5fd0122aSMatthias Ringwald #define FLASH_1_PATTERN FLCTL_RDBRST_CTLSTAT_DATA_CMP 101*5fd0122aSMatthias Ringwald #define FLASH_0_PATTERN 0x00 102*5fd0122aSMatthias Ringwald 103*5fd0122aSMatthias Ringwald #define FLASH_SECTOR0 FLCTL_BANK0_MAIN_WEPROT_PROT0 104*5fd0122aSMatthias Ringwald #define FLASH_SECTOR1 FLCTL_BANK0_MAIN_WEPROT_PROT1 105*5fd0122aSMatthias Ringwald #define FLASH_SECTOR2 FLCTL_BANK0_MAIN_WEPROT_PROT2 106*5fd0122aSMatthias Ringwald #define FLASH_SECTOR3 FLCTL_BANK0_MAIN_WEPROT_PROT3 107*5fd0122aSMatthias Ringwald #define FLASH_SECTOR4 FLCTL_BANK0_MAIN_WEPROT_PROT4 108*5fd0122aSMatthias Ringwald #define FLASH_SECTOR5 FLCTL_BANK0_MAIN_WEPROT_PROT5 109*5fd0122aSMatthias Ringwald #define FLASH_SECTOR6 FLCTL_BANK0_MAIN_WEPROT_PROT6 110*5fd0122aSMatthias Ringwald #define FLASH_SECTOR7 FLCTL_BANK0_MAIN_WEPROT_PROT7 111*5fd0122aSMatthias Ringwald #define FLASH_SECTOR8 FLCTL_BANK0_MAIN_WEPROT_PROT8 112*5fd0122aSMatthias Ringwald #define FLASH_SECTOR9 FLCTL_BANK0_MAIN_WEPROT_PROT9 113*5fd0122aSMatthias Ringwald #define FLASH_SECTOR10 FLCTL_BANK0_MAIN_WEPROT_PROT10 114*5fd0122aSMatthias Ringwald #define FLASH_SECTOR11 FLCTL_BANK0_MAIN_WEPROT_PROT11 115*5fd0122aSMatthias Ringwald #define FLASH_SECTOR12 FLCTL_BANK0_MAIN_WEPROT_PROT12 116*5fd0122aSMatthias Ringwald #define FLASH_SECTOR13 FLCTL_BANK0_MAIN_WEPROT_PROT13 117*5fd0122aSMatthias Ringwald #define FLASH_SECTOR14 FLCTL_BANK0_MAIN_WEPROT_PROT14 118*5fd0122aSMatthias Ringwald #define FLASH_SECTOR15 FLCTL_BANK0_MAIN_WEPROT_PROT15 119*5fd0122aSMatthias Ringwald #define FLASH_SECTOR16 FLCTL_BANK0_MAIN_WEPROT_PROT16 120*5fd0122aSMatthias Ringwald #define FLASH_SECTOR17 FLCTL_BANK0_MAIN_WEPROT_PROT17 121*5fd0122aSMatthias Ringwald #define FLASH_SECTOR18 FLCTL_BANK0_MAIN_WEPROT_PROT18 122*5fd0122aSMatthias Ringwald #define FLASH_SECTOR19 FLCTL_BANK0_MAIN_WEPROT_PROT19 123*5fd0122aSMatthias Ringwald #define FLASH_SECTOR20 FLCTL_BANK0_MAIN_WEPROT_PROT20 124*5fd0122aSMatthias Ringwald #define FLASH_SECTOR21 FLCTL_BANK0_MAIN_WEPROT_PROT21 125*5fd0122aSMatthias Ringwald #define FLASH_SECTOR22 FLCTL_BANK0_MAIN_WEPROT_PROT22 126*5fd0122aSMatthias Ringwald #define FLASH_SECTOR23 FLCTL_BANK0_MAIN_WEPROT_PROT23 127*5fd0122aSMatthias Ringwald #define FLASH_SECTOR24 FLCTL_BANK0_MAIN_WEPROT_PROT24 128*5fd0122aSMatthias Ringwald #define FLASH_SECTOR25 FLCTL_BANK0_MAIN_WEPROT_PROT25 129*5fd0122aSMatthias Ringwald #define FLASH_SECTOR26 FLCTL_BANK0_MAIN_WEPROT_PROT26 130*5fd0122aSMatthias Ringwald #define FLASH_SECTOR27 FLCTL_BANK0_MAIN_WEPROT_PROT27 131*5fd0122aSMatthias Ringwald #define FLASH_SECTOR28 FLCTL_BANK0_MAIN_WEPROT_PROT28 132*5fd0122aSMatthias Ringwald #define FLASH_SECTOR29 FLCTL_BANK0_MAIN_WEPROT_PROT29 133*5fd0122aSMatthias Ringwald #define FLASH_SECTOR30 FLCTL_BANK0_MAIN_WEPROT_PROT30 134*5fd0122aSMatthias Ringwald #define FLASH_SECTOR31 FLCTL_BANK0_MAIN_WEPROT_PROT31 135*5fd0122aSMatthias Ringwald 136*5fd0122aSMatthias Ringwald #define FLASH_NOVER 0 137*5fd0122aSMatthias Ringwald #define FLASH_BURSTPOST FLCTL_PRGBRST_CTLSTAT_AUTO_PST 138*5fd0122aSMatthias Ringwald #define FLASH_BURSTPRE FLCTL_PRGBRST_CTLSTAT_AUTO_PRE 139*5fd0122aSMatthias Ringwald #define FLASH_REGPRE FLCTL_PRG_CTLSTAT_VER_PRE 140*5fd0122aSMatthias Ringwald #define FLASH_REGPOST FLCTL_PRG_CTLSTAT_VER_PST 141*5fd0122aSMatthias Ringwald #define FLASH_FULLVER (FLCTL_PRGBRST_CTLSTAT_AUTO_PST | \ 142*5fd0122aSMatthias Ringwald FLCTL_PRGBRST_CTLSTAT_AUTO_PRE | FLCTL_PRG_CTLSTAT_VER_PRE \ 143*5fd0122aSMatthias Ringwald | FLCTL_PRG_CTLSTAT_VER_PST) 144*5fd0122aSMatthias Ringwald 145*5fd0122aSMatthias Ringwald #define FLASH_COLLATED_WRITE_MODE 0x01 146*5fd0122aSMatthias Ringwald #define FLASH_IMMEDIATE_WRITE_MODE 0x02 147*5fd0122aSMatthias Ringwald 148*5fd0122aSMatthias Ringwald #define __INFO_FLASH_TECH_START__ 0x00200000 149*5fd0122aSMatthias Ringwald #define __INFO_FLASH_TECH_MIDDLE__ 0x00202000 150*5fd0122aSMatthias Ringwald 151*5fd0122aSMatthias Ringwald 152*5fd0122aSMatthias Ringwald //***************************************************************************** 153*5fd0122aSMatthias Ringwald // 154*5fd0122aSMatthias Ringwald // Prototypes for the APIs. 155*5fd0122aSMatthias Ringwald // 156*5fd0122aSMatthias Ringwald //***************************************************************************** 157*5fd0122aSMatthias Ringwald 158*5fd0122aSMatthias Ringwald //***************************************************************************** 159*5fd0122aSMatthias Ringwald // 160*5fd0122aSMatthias Ringwald //! Calculates the flash bank and sector number given an address. Stores the 161*5fd0122aSMatthias Ringwald //! results into the two pointers given as parameters. The user must provide 162*5fd0122aSMatthias Ringwald //! a valid memory address (an address in SRAM for example will give an invalid 163*5fd0122aSMatthias Ringwald //! result). 164*5fd0122aSMatthias Ringwald //! 165*5fd0122aSMatthias Ringwald //! \param addr Address to calculate the bank/sector information for 166*5fd0122aSMatthias Ringwald //! 167*5fd0122aSMatthias Ringwald //! \param bankNum The bank number will be stored in here after the function 168*5fd0122aSMatthias Ringwald //! completes. 169*5fd0122aSMatthias Ringwald //! 170*5fd0122aSMatthias Ringwald //! \param sectorNum The sector number will be stored in here after the function 171*5fd0122aSMatthias Ringwald //! completes. 172*5fd0122aSMatthias Ringwald //! 173*5fd0122aSMatthias Ringwald //! \note For simplicity, this API only works with address in MAIN flash memory. 174*5fd0122aSMatthias Ringwald //! For calculating the sector/bank number of an address in info memory, 175*5fd0122aSMatthias Ringwald //! please refer to your device datasheet/ 176*5fd0122aSMatthias Ringwald //! 177*5fd0122aSMatthias Ringwald //! \return None. 178*5fd0122aSMatthias Ringwald // 179*5fd0122aSMatthias Ringwald //***************************************************************************** 180*5fd0122aSMatthias Ringwald extern void FlashCtl_getMemoryInfo(uint32_t addr, uint32_t *bankNum, 181*5fd0122aSMatthias Ringwald uint32_t *sectorNum); 182*5fd0122aSMatthias Ringwald 183*5fd0122aSMatthias Ringwald //***************************************************************************** 184*5fd0122aSMatthias Ringwald // 185*5fd0122aSMatthias Ringwald //! Enables read buffering on accesses to a specified bank of flash memory 186*5fd0122aSMatthias Ringwald //! 187*5fd0122aSMatthias Ringwald //! \param memoryBank is the value of the memory bank to enable read 188*5fd0122aSMatthias Ringwald //! buffering. Must be only one of the following values: 189*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK0, 190*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK1 191*5fd0122aSMatthias Ringwald //! 192*5fd0122aSMatthias Ringwald //! \param accessMethod is the value of the access type to enable read 193*5fd0122aSMatthias Ringwald //! buffering. Must be only one of the following values: 194*5fd0122aSMatthias Ringwald //! - \b FLASH_DATA_READ, 195*5fd0122aSMatthias Ringwald //! - \b FLASH_INSTRUCTION_FETCH 196*5fd0122aSMatthias Ringwald //! 197*5fd0122aSMatthias Ringwald //! \return None. 198*5fd0122aSMatthias Ringwald // 199*5fd0122aSMatthias Ringwald //***************************************************************************** 200*5fd0122aSMatthias Ringwald extern void FlashCtl_enableReadBuffering(uint_fast8_t memoryBank, 201*5fd0122aSMatthias Ringwald uint_fast8_t accessMethod); 202*5fd0122aSMatthias Ringwald 203*5fd0122aSMatthias Ringwald //***************************************************************************** 204*5fd0122aSMatthias Ringwald // 205*5fd0122aSMatthias Ringwald //! Disables read buffering on accesses to a specified bank of flash memory 206*5fd0122aSMatthias Ringwald //! 207*5fd0122aSMatthias Ringwald //! \param memoryBank is the value of the memory bank to disable read 208*5fd0122aSMatthias Ringwald //! buffering. Must be only one of the following values: 209*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK0, 210*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK1 211*5fd0122aSMatthias Ringwald //! 212*5fd0122aSMatthias Ringwald //! \param accessMethod is the value of the access type to disable read 213*5fd0122aSMatthias Ringwald //! buffering. Must ne only one of the following values: 214*5fd0122aSMatthias Ringwald //! - \b FLASH_DATA_READ, 215*5fd0122aSMatthias Ringwald //! - \b FLASH_INSTRUCTION_FETCH 216*5fd0122aSMatthias Ringwald //! 217*5fd0122aSMatthias Ringwald //! \return None. 218*5fd0122aSMatthias Ringwald // 219*5fd0122aSMatthias Ringwald //***************************************************************************** 220*5fd0122aSMatthias Ringwald extern void FlashCtl_disableReadBuffering(uint_fast8_t memoryBank, 221*5fd0122aSMatthias Ringwald uint_fast8_t accessMethod); 222*5fd0122aSMatthias Ringwald 223*5fd0122aSMatthias Ringwald //***************************************************************************** 224*5fd0122aSMatthias Ringwald // 225*5fd0122aSMatthias Ringwald //! Disables program protection on the given sector mask. This setting can be 226*5fd0122aSMatthias Ringwald //! applied on a sector-wise bases on a given memory space (INFO or MAIN). 227*5fd0122aSMatthias Ringwald //! 228*5fd0122aSMatthias Ringwald //! \param memorySpace is the value of the memory bank to disable program 229*5fd0122aSMatthias Ringwald //! protection. Must be only one of the following values: 230*5fd0122aSMatthias Ringwald //! - \b FLASH_MAIN_MEMORY_SPACE_BANK0, 231*5fd0122aSMatthias Ringwald //! - \b FLASH_MAIN_MEMORY_SPACE_BANK1, 232*5fd0122aSMatthias Ringwald //! - \b FLASH_INFO_MEMORY_SPACE_BANK0, 233*5fd0122aSMatthias Ringwald //! - \b FLASH_INFO_MEMORY_SPACE_BANK1 234*5fd0122aSMatthias Ringwald //! 235*5fd0122aSMatthias Ringwald //! \param sectorMask is a bit mask of the sectors to disable program 236*5fd0122aSMatthias Ringwald //! protection. Must be a bitfield of the following values: 237*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR0, 238*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR1, 239*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR2, 240*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR3, 241*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR4, 242*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR5, 243*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR6, 244*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR7, 245*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR8, 246*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR9, 247*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR10, 248*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR11, 249*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR12, 250*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR13, 251*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR14, 252*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR15, 253*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR16, 254*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR17, 255*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR18, 256*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR19, 257*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR20, 258*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR21, 259*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR22, 260*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR23, 261*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR24, 262*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR25, 263*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR26, 264*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR27, 265*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR28, 266*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR29, 267*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR30, 268*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR31 269*5fd0122aSMatthias Ringwald //! 270*5fd0122aSMatthias Ringwald //! \note Flash sector sizes are 4KB and the number of sectors may vary 271*5fd0122aSMatthias Ringwald //! depending on the specific device. Also, for INFO memory space, only sectors 272*5fd0122aSMatthias Ringwald //! \b FLASH_SECTOR0 and \b FLASH_SECTOR1 will exist. 273*5fd0122aSMatthias Ringwald //! 274*5fd0122aSMatthias Ringwald //! \note Not all devices will contain a dedicated INFO memory. Please check the 275*5fd0122aSMatthias Ringwald //! device datasheet to see if your device has INFO memory available for use. 276*5fd0122aSMatthias Ringwald //! For devices without INFO memory, any operation related to the INFO memory 277*5fd0122aSMatthias Ringwald //! will be ignored by the hardware. 278*5fd0122aSMatthias Ringwald //! 279*5fd0122aSMatthias Ringwald //! \return true if sector protection disabled false otherwise. 280*5fd0122aSMatthias Ringwald // 281*5fd0122aSMatthias Ringwald //***************************************************************************** 282*5fd0122aSMatthias Ringwald extern bool FlashCtl_unprotectSector(uint_fast8_t memorySpace, 283*5fd0122aSMatthias Ringwald uint32_t sectorMask); 284*5fd0122aSMatthias Ringwald 285*5fd0122aSMatthias Ringwald //***************************************************************************** 286*5fd0122aSMatthias Ringwald // 287*5fd0122aSMatthias Ringwald //! Enables program protection on the given sector mask. This setting can be 288*5fd0122aSMatthias Ringwald //! applied on a sector-wise bases on a given memory space (INFO or MAIN). 289*5fd0122aSMatthias Ringwald //! 290*5fd0122aSMatthias Ringwald //! \param memorySpace is the value of the memory bank to enable program 291*5fd0122aSMatthias Ringwald //! protection. Must be only one of the following values: 292*5fd0122aSMatthias Ringwald //! - \b FLASH_MAIN_MEMORY_SPACE_BANK0, 293*5fd0122aSMatthias Ringwald //! - \b FLASH_MAIN_MEMORY_SPACE_BANK1, 294*5fd0122aSMatthias Ringwald //! - \b FLASH_INFO_MEMORY_SPACE_BANK0, 295*5fd0122aSMatthias Ringwald //! - \b FLASH_INFO_MEMORY_SPACE_BANK1 296*5fd0122aSMatthias Ringwald //! 297*5fd0122aSMatthias Ringwald //! \param sectorMask is a bit mask of the sectors to enable program 298*5fd0122aSMatthias Ringwald //! protection. Must be a bitfield of the following values: 299*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR0, 300*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR1, 301*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR2, 302*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR3, 303*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR4, 304*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR5, 305*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR6, 306*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR7, 307*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR8, 308*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR9, 309*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR10, 310*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR11, 311*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR12, 312*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR13, 313*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR14, 314*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR15, 315*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR16, 316*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR17, 317*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR18, 318*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR19, 319*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR20, 320*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR21, 321*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR22, 322*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR23, 323*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR24, 324*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR25, 325*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR26, 326*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR27, 327*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR28, 328*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR29, 329*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR30, 330*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR31 331*5fd0122aSMatthias Ringwald //! 332*5fd0122aSMatthias Ringwald //! \note Flash sector sizes are 4KB and the number of sectors may vary 333*5fd0122aSMatthias Ringwald //! depending on the specific device. Also, for INFO memory space, only sectors 334*5fd0122aSMatthias Ringwald //! \b FLASH_SECTOR0 and \b FLASH_SECTOR1 will exist. 335*5fd0122aSMatthias Ringwald //! 336*5fd0122aSMatthias Ringwald //! \note Not all devices will contain a dedicated INFO memory. Please check the 337*5fd0122aSMatthias Ringwald //! device datasheet to see if your device has INFO memory available for use. 338*5fd0122aSMatthias Ringwald //! For devices without INFO memory, any operation related to the INFO memory 339*5fd0122aSMatthias Ringwald //! will be ignored by the hardware. 340*5fd0122aSMatthias Ringwald //! 341*5fd0122aSMatthias Ringwald //! \return true if sector protection enabled false otherwise. 342*5fd0122aSMatthias Ringwald // 343*5fd0122aSMatthias Ringwald //***************************************************************************** 344*5fd0122aSMatthias Ringwald extern bool FlashCtl_protectSector(uint_fast8_t memorySpace, 345*5fd0122aSMatthias Ringwald uint32_t sectorMask); 346*5fd0122aSMatthias Ringwald 347*5fd0122aSMatthias Ringwald //***************************************************************************** 348*5fd0122aSMatthias Ringwald // 349*5fd0122aSMatthias Ringwald //! Returns the sector protection for given sector mask and memory space 350*5fd0122aSMatthias Ringwald //! 351*5fd0122aSMatthias Ringwald //! \param memorySpace is the value of the memory bank to check for program 352*5fd0122aSMatthias Ringwald //! protection. Must be only one of the following values: 353*5fd0122aSMatthias Ringwald //! - \b FLASH_MAIN_MEMORY_SPACE_BANK0, 354*5fd0122aSMatthias Ringwald //! - \b FLASH_MAIN_MEMORY_SPACE_BANK1, 355*5fd0122aSMatthias Ringwald //! - \b FLASH_INFO_MEMORY_SPACE_BANK0, 356*5fd0122aSMatthias Ringwald //! - \b FLASH_INFO_MEMORY_SPACE_BANK1 357*5fd0122aSMatthias Ringwald //! 358*5fd0122aSMatthias Ringwald //! \param sector is the sector to check for program protection. 359*5fd0122aSMatthias Ringwald //! Must be one of the following values: 360*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR0, 361*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR1, 362*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR2, 363*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR3, 364*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR4, 365*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR5, 366*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR6, 367*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR7, 368*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR8, 369*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR9, 370*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR10, 371*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR11, 372*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR12, 373*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR13, 374*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR14, 375*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR15, 376*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR16, 377*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR17, 378*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR18, 379*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR19, 380*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR20, 381*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR21, 382*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR22, 383*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR23, 384*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR24, 385*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR25, 386*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR26, 387*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR27, 388*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR28, 389*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR29, 390*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR30, 391*5fd0122aSMatthias Ringwald //! - \b FLASH_SECTOR31 392*5fd0122aSMatthias Ringwald //! 393*5fd0122aSMatthias Ringwald //! Note that flash sector sizes are 4KB and the number of sectors may vary 394*5fd0122aSMatthias Ringwald //! depending on the specific device. Also, for INFO memory space, only sectors 395*5fd0122aSMatthias Ringwald //! FLASH_SECTOR0 and FLASH_SECTOR1 will exist. 396*5fd0122aSMatthias Ringwald //! 397*5fd0122aSMatthias Ringwald //! \note Not all devices will contain a dedicated INFO memory. Please check the 398*5fd0122aSMatthias Ringwald //! device datasheet to see if your device has INFO memory available for use. 399*5fd0122aSMatthias Ringwald //! For devices without INFO memory, any operation related to the INFO memory 400*5fd0122aSMatthias Ringwald //! will be ignored by the hardware. 401*5fd0122aSMatthias Ringwald //! 402*5fd0122aSMatthias Ringwald //! \return true if sector protection enabled false otherwise. 403*5fd0122aSMatthias Ringwald // 404*5fd0122aSMatthias Ringwald //***************************************************************************** 405*5fd0122aSMatthias Ringwald extern bool FlashCtl_isSectorProtected(uint_fast8_t memorySpace, 406*5fd0122aSMatthias Ringwald uint32_t sector); 407*5fd0122aSMatthias Ringwald 408*5fd0122aSMatthias Ringwald //***************************************************************************** 409*5fd0122aSMatthias Ringwald // 410*5fd0122aSMatthias Ringwald //! Verifies a given segment of memory based off either a high (1) or low (0) 411*5fd0122aSMatthias Ringwald //! state. 412*5fd0122aSMatthias Ringwald //! 413*5fd0122aSMatthias Ringwald //! \param verifyAddr Start address where verification will begin 414*5fd0122aSMatthias Ringwald //! 415*5fd0122aSMatthias Ringwald //! \param length Length in bytes to verify based off the pattern 416*5fd0122aSMatthias Ringwald //! 417*5fd0122aSMatthias Ringwald //! \param pattern The pattern which verification will check versus. This can 418*5fd0122aSMatthias Ringwald //! either be a low pattern (each register will be checked versus a pattern 419*5fd0122aSMatthias Ringwald //! of 32 zeros, or a high pattern (each register will be checked versus a 420*5fd0122aSMatthias Ringwald //! pattern of 32 ones). Valid values are: FLASH_0_PATTERN, FLASH_1_PATTERN 421*5fd0122aSMatthias Ringwald //! 422*5fd0122aSMatthias Ringwald //! \note There are no sector/boundary restrictions for this function, 423*5fd0122aSMatthias Ringwald //! however it is encouraged to proved a start address aligned on 32-bit 424*5fd0122aSMatthias Ringwald //! boundaries. Providing an unaligned address will result in unaligned data 425*5fd0122aSMatthias Ringwald //! accesses and detriment efficiency. 426*5fd0122aSMatthias Ringwald //! 427*5fd0122aSMatthias Ringwald //! \note This function is blocking and will not exit until operation has 428*5fd0122aSMatthias Ringwald //! either completed or failed due to an error. Furthermore, given the 429*5fd0122aSMatthias Ringwald //! complex verification requirements of the flash controller, master 430*5fd0122aSMatthias Ringwald //! interrupts are disabled throughout execution of this function. The original 431*5fd0122aSMatthias Ringwald //! interrupt context is saved at the start of execution and restored prior 432*5fd0122aSMatthias Ringwald //! to exit of the API. 433*5fd0122aSMatthias Ringwald //! 434*5fd0122aSMatthias Ringwald //! \note Due to the hardware limitations of the flash controller, this 435*5fd0122aSMatthias Ringwald //! function cannot verify a memory address in the same flash bank that it 436*5fd0122aSMatthias Ringwald //! is executing from. If using the ROM version of this API (by using the 437*5fd0122aSMatthias Ringwald //! (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides 438*5fd0122aSMatthias Ringwald //! in flash then special care needs to be taken to ensure no code execution 439*5fd0122aSMatthias Ringwald //! or reads happen in the flash bank being programmed while this API is 440*5fd0122aSMatthias Ringwald //! being executed. 441*5fd0122aSMatthias Ringwald //! 442*5fd0122aSMatthias Ringwald //! \return true if memory verification is successful, false otherwise. 443*5fd0122aSMatthias Ringwald // 444*5fd0122aSMatthias Ringwald //***************************************************************************** 445*5fd0122aSMatthias Ringwald extern bool FlashCtl_verifyMemory(void* verifyAddr, uint32_t length, 446*5fd0122aSMatthias Ringwald uint_fast8_t pattern); 447*5fd0122aSMatthias Ringwald 448*5fd0122aSMatthias Ringwald //***************************************************************************** 449*5fd0122aSMatthias Ringwald // 450*5fd0122aSMatthias Ringwald //! Performs a mass erase on all unprotected flash sectors. Protected sectors 451*5fd0122aSMatthias Ringwald //! are ignored. 452*5fd0122aSMatthias Ringwald //! 453*5fd0122aSMatthias Ringwald //! \note This function is blocking and will not exit until operation has 454*5fd0122aSMatthias Ringwald //! either completed or failed due to an error. Furthermore, given the 455*5fd0122aSMatthias Ringwald //! complex verification requirements of the flash controller, master 456*5fd0122aSMatthias Ringwald //! interrupts are disabled throughout execution of this function. The original 457*5fd0122aSMatthias Ringwald //! interrupt context is saved at the start of execution and restored prior 458*5fd0122aSMatthias Ringwald //! to exit of the API. 459*5fd0122aSMatthias Ringwald //! 460*5fd0122aSMatthias Ringwald //! \note Due to the hardware limitations of the flash controller, this 461*5fd0122aSMatthias Ringwald //! function cannot erase a memory address in the same flash bank that it 462*5fd0122aSMatthias Ringwald //! is executing from. If using the ROM version of this API (by using the 463*5fd0122aSMatthias Ringwald //! (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides 464*5fd0122aSMatthias Ringwald //! in flash then special care needs to be taken to ensure no code execution 465*5fd0122aSMatthias Ringwald //! or reads happen in the flash bank being programmed while this API is 466*5fd0122aSMatthias Ringwald //! being executed. 467*5fd0122aSMatthias Ringwald //! 468*5fd0122aSMatthias Ringwald //! \return true if mass erase completes successfully, false otherwise 469*5fd0122aSMatthias Ringwald // 470*5fd0122aSMatthias Ringwald //***************************************************************************** 471*5fd0122aSMatthias Ringwald extern bool FlashCtl_performMassErase(void); 472*5fd0122aSMatthias Ringwald 473*5fd0122aSMatthias Ringwald //***************************************************************************** 474*5fd0122aSMatthias Ringwald // 475*5fd0122aSMatthias Ringwald //! Initiates a mass erase and returns control back to the program. This is a 476*5fd0122aSMatthias Ringwald //! non-blocking function, however it is the user's responsibility to perform 477*5fd0122aSMatthias Ringwald //! the necessary verification requirements after the interrupt is set to 478*5fd0122aSMatthias Ringwald //! signify completion. 479*5fd0122aSMatthias Ringwald //! 480*5fd0122aSMatthias Ringwald //! \return None 481*5fd0122aSMatthias Ringwald // 482*5fd0122aSMatthias Ringwald //***************************************************************************** 483*5fd0122aSMatthias Ringwald extern void FlashCtl_initiateMassErase(void); 484*5fd0122aSMatthias Ringwald 485*5fd0122aSMatthias Ringwald //***************************************************************************** 486*5fd0122aSMatthias Ringwald // 487*5fd0122aSMatthias Ringwald //! Erases a sector of MAIN or INFO flash memory. 488*5fd0122aSMatthias Ringwald //! 489*5fd0122aSMatthias Ringwald //! \param addr The start of the sector to erase. Note that with flash, 490*5fd0122aSMatthias Ringwald //! the minimum allowed size that can be erased is a flash sector 491*5fd0122aSMatthias Ringwald //! (which is 4KB on the MSP432 family). If an address is provided to 492*5fd0122aSMatthias Ringwald //! this function which is not on a 4KB boundary, the entire sector 493*5fd0122aSMatthias Ringwald //! will still be erased. 494*5fd0122aSMatthias Ringwald //! 495*5fd0122aSMatthias Ringwald //! \note This function is blocking and will not exit until operation has 496*5fd0122aSMatthias Ringwald //! either completed or failed due to an error. Furthermore, given the 497*5fd0122aSMatthias Ringwald //! complex verification requirements of the flash controller, master 498*5fd0122aSMatthias Ringwald //! interrupts are disabled throughout execution of this function. The original 499*5fd0122aSMatthias Ringwald //! interrupt context is saved at the start of execution and restored prior 500*5fd0122aSMatthias Ringwald //! to exit of the API. 501*5fd0122aSMatthias Ringwald //! 502*5fd0122aSMatthias Ringwald //! \note Due to the hardware limitations of the flash controller, this 503*5fd0122aSMatthias Ringwald //! function cannot erase a memory addressin the same flash bank that it 504*5fd0122aSMatthias Ringwald //! is executing from. If using the ROM version of this API (by using the 505*5fd0122aSMatthias Ringwald //! (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides 506*5fd0122aSMatthias Ringwald //! in flash then special care needs to be taken to ensure no code execution 507*5fd0122aSMatthias Ringwald //! or reads happen in the flash bank being programmed while this API is 508*5fd0122aSMatthias Ringwald //! being executed. 509*5fd0122aSMatthias Ringwald //! 510*5fd0122aSMatthias Ringwald //! \return true if sector erase is successful, false otherwise. 511*5fd0122aSMatthias Ringwald // 512*5fd0122aSMatthias Ringwald //***************************************************************************** 513*5fd0122aSMatthias Ringwald extern bool FlashCtl_eraseSector(uint32_t addr); 514*5fd0122aSMatthias Ringwald 515*5fd0122aSMatthias Ringwald //***************************************************************************** 516*5fd0122aSMatthias Ringwald // 517*5fd0122aSMatthias Ringwald //! Program a portion of flash memory with the provided data 518*5fd0122aSMatthias Ringwald //! 519*5fd0122aSMatthias Ringwald //! \param src Pointer to the data source to program into flash 520*5fd0122aSMatthias Ringwald //! 521*5fd0122aSMatthias Ringwald //! \param dest Pointer to the destination in flash to program 522*5fd0122aSMatthias Ringwald //! 523*5fd0122aSMatthias Ringwald //! \param length Length in bytes to program 524*5fd0122aSMatthias Ringwald //! 525*5fd0122aSMatthias Ringwald //! \note There are no sector/boundary restrictions for this function, 526*5fd0122aSMatthias Ringwald //! however it is encouraged to proved a start address aligned on 32-bit 527*5fd0122aSMatthias Ringwald //! boundaries. Providing an unaligned address will result in unaligned data 528*5fd0122aSMatthias Ringwald //! accesses and detriment efficiency. 529*5fd0122aSMatthias Ringwald //! 530*5fd0122aSMatthias Ringwald //! \note This function is blocking and will not exit until operation has 531*5fd0122aSMatthias Ringwald //! either completed or failed due to an error. Furthermore, given the 532*5fd0122aSMatthias Ringwald //! complex verification requirements of the flash controller, master 533*5fd0122aSMatthias Ringwald //! interrupts are disabled throughout execution of this function. The original 534*5fd0122aSMatthias Ringwald //! interrupt context is saved at the start of execution and restored prior 535*5fd0122aSMatthias Ringwald //! to exit of the API. 536*5fd0122aSMatthias Ringwald //! 537*5fd0122aSMatthias Ringwald //! \note Due to the hardware limitations of the flash controller, this 538*5fd0122aSMatthias Ringwald //! function cannot program a memory addressin the same flash bank that it 539*5fd0122aSMatthias Ringwald //! is executing from. If using the ROM version of this API (by using the 540*5fd0122aSMatthias Ringwald //! (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides 541*5fd0122aSMatthias Ringwald //! in flash then special care needs to be taken to ensure no code execution 542*5fd0122aSMatthias Ringwald //! or reads happen in the flash bank being programmed while this API is 543*5fd0122aSMatthias Ringwald //! being executed. 544*5fd0122aSMatthias Ringwald //! 545*5fd0122aSMatthias Ringwald //! \return Whether or not the program succeeded 546*5fd0122aSMatthias Ringwald // 547*5fd0122aSMatthias Ringwald //***************************************************************************** 548*5fd0122aSMatthias Ringwald extern bool FlashCtl_programMemory(void* src, void* dest, uint32_t length); 549*5fd0122aSMatthias Ringwald 550*5fd0122aSMatthias Ringwald //***************************************************************************** 551*5fd0122aSMatthias Ringwald // 552*5fd0122aSMatthias Ringwald //! Setups pre/post verification of burst and regular flash programming 553*5fd0122aSMatthias Ringwald //! instructions. Note that this API is for advanced users that are programming 554*5fd0122aSMatthias Ringwald //! their own flash drivers. The program/erase APIs are not affected by this 555*5fd0122aSMatthias Ringwald //! setting and take care of the verification requirements. 556*5fd0122aSMatthias Ringwald //! 557*5fd0122aSMatthias Ringwald //! \param verificationSetting Verification setting to set. This value can 558*5fd0122aSMatthias Ringwald //! be a bitwise OR of the following values: 559*5fd0122aSMatthias Ringwald //! - \b FLASH_BURSTPOST, 560*5fd0122aSMatthias Ringwald //! - \b FLASH_BURSTPRE, 561*5fd0122aSMatthias Ringwald //! - \b FLASH_REGPRE, 562*5fd0122aSMatthias Ringwald //! - \b FLASH_REGPOST 563*5fd0122aSMatthias Ringwald //! - \b FLASH_NOVER No verification enabled 564*5fd0122aSMatthias Ringwald //! - \b FLASH_FULLVER Full verification enabled 565*5fd0122aSMatthias Ringwald //! 566*5fd0122aSMatthias Ringwald //! \return none 567*5fd0122aSMatthias Ringwald // 568*5fd0122aSMatthias Ringwald //***************************************************************************** 569*5fd0122aSMatthias Ringwald extern void FlashCtl_setProgramVerification(uint32_t verificationSetting); 570*5fd0122aSMatthias Ringwald 571*5fd0122aSMatthias Ringwald //***************************************************************************** 572*5fd0122aSMatthias Ringwald // 573*5fd0122aSMatthias Ringwald //! Clears pre/post verification of burst and regular flash programming 574*5fd0122aSMatthias Ringwald //! instructions. Note that this API is for advanced users that are programming 575*5fd0122aSMatthias Ringwald //! their own flash drivers. The program/erase APIs are not affected by this 576*5fd0122aSMatthias Ringwald //! setting and take care of the verification requirements. 577*5fd0122aSMatthias Ringwald //! 578*5fd0122aSMatthias Ringwald //! \param verificationSetting Verification setting to clear. This value can 579*5fd0122aSMatthias Ringwald //! be a bitwise OR of the following values: 580*5fd0122aSMatthias Ringwald //! - \b FLASH_BURSTPOST, 581*5fd0122aSMatthias Ringwald //! - \b FLASH_BURSTPRE, 582*5fd0122aSMatthias Ringwald //! - \b FLASH_REGPRE, 583*5fd0122aSMatthias Ringwald //! - \b FLASH_REGPOST 584*5fd0122aSMatthias Ringwald //! - \b FLASH_NOVER No verification enabled 585*5fd0122aSMatthias Ringwald //! - \b FLASH_FULLVER Full verification enabled 586*5fd0122aSMatthias Ringwald //! 587*5fd0122aSMatthias Ringwald //! \return none 588*5fd0122aSMatthias Ringwald // 589*5fd0122aSMatthias Ringwald //***************************************************************************** 590*5fd0122aSMatthias Ringwald extern void FlashCtl_clearProgramVerification(uint32_t verificationSetting); 591*5fd0122aSMatthias Ringwald 592*5fd0122aSMatthias Ringwald //***************************************************************************** 593*5fd0122aSMatthias Ringwald // 594*5fd0122aSMatthias Ringwald //! Enables word programming of flash memory. 595*5fd0122aSMatthias Ringwald //! 596*5fd0122aSMatthias Ringwald //! This function will enable word programming of the flash memory and set the 597*5fd0122aSMatthias Ringwald //! mode of behavior when the flash write occurs. 598*5fd0122aSMatthias Ringwald //! 599*5fd0122aSMatthias Ringwald //! \param mode The mode specifies the behavior of the flash controller when 600*5fd0122aSMatthias Ringwald //! programming words to flash. In \b FLASH_IMMEDIATE_WRITE_MODE, the 601*5fd0122aSMatthias Ringwald //! program operation happens immediately on the write to flash while 602*5fd0122aSMatthias Ringwald //! in \b FLASH_COLLATED_WRITE_MODE the write will be delayed until a full 603*5fd0122aSMatthias Ringwald //! 128-bits have been collated. Possible values include: 604*5fd0122aSMatthias Ringwald //! - \b FLASH_IMMEDIATE_WRITE_MODE 605*5fd0122aSMatthias Ringwald //! - \b FLASH_COLLATED_WRITE_MODE 606*5fd0122aSMatthias Ringwald //! 607*5fd0122aSMatthias Ringwald //! 608*5fd0122aSMatthias Ringwald //! Refer to the user's guide for further documentation. 609*5fd0122aSMatthias Ringwald //! 610*5fd0122aSMatthias Ringwald //! \return none 611*5fd0122aSMatthias Ringwald // 612*5fd0122aSMatthias Ringwald //***************************************************************************** 613*5fd0122aSMatthias Ringwald extern void FlashCtl_enableWordProgramming(uint32_t mode); 614*5fd0122aSMatthias Ringwald 615*5fd0122aSMatthias Ringwald //***************************************************************************** 616*5fd0122aSMatthias Ringwald // 617*5fd0122aSMatthias Ringwald //! Disables word programming of flash memory. 618*5fd0122aSMatthias Ringwald //! 619*5fd0122aSMatthias Ringwald //! Refer to FlashCtl_enableWordProgramming and the user's guide for description 620*5fd0122aSMatthias Ringwald //! on the difference between full word and immediate programming 621*5fd0122aSMatthias Ringwald //! 622*5fd0122aSMatthias Ringwald //! \return None. 623*5fd0122aSMatthias Ringwald // 624*5fd0122aSMatthias Ringwald //***************************************************************************** 625*5fd0122aSMatthias Ringwald extern void FlashCtl_disableWordProgramming(void); 626*5fd0122aSMatthias Ringwald 627*5fd0122aSMatthias Ringwald //***************************************************************************** 628*5fd0122aSMatthias Ringwald // 629*5fd0122aSMatthias Ringwald //! Returns if word programming mode is enabled (and if it is, the specific mode) 630*5fd0122aSMatthias Ringwald //! 631*5fd0122aSMatthias Ringwald //! Refer to FlashCtl_enableWordProgramming and the user's guide for description 632*5fd0122aSMatthias Ringwald //! on the difference between full word and immediate programming 633*5fd0122aSMatthias Ringwald //! 634*5fd0122aSMatthias Ringwald //! \return a zero value if word programming is disabled, 635*5fd0122aSMatthias Ringwald //! - \b FLASH_IMMEDIATE_WRITE_MODE 636*5fd0122aSMatthias Ringwald //! - \b FLASH_COLLATED_WRITE_MODE 637*5fd0122aSMatthias Ringwald //! 638*5fd0122aSMatthias Ringwald // 639*5fd0122aSMatthias Ringwald //***************************************************************************** 640*5fd0122aSMatthias Ringwald extern uint32_t FlashCtl_isWordProgrammingEnabled(void); 641*5fd0122aSMatthias Ringwald 642*5fd0122aSMatthias Ringwald //***************************************************************************** 643*5fd0122aSMatthias Ringwald // 644*5fd0122aSMatthias Ringwald //! Sets the flash read mode to be used by default flash read operations. 645*5fd0122aSMatthias Ringwald //! Note that the proper wait states must be set prior to entering this 646*5fd0122aSMatthias Ringwald //! function. 647*5fd0122aSMatthias Ringwald //! 648*5fd0122aSMatthias Ringwald //! \param flashBank Flash bank to set read mode for. Valid values are: 649*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK0 650*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK1 651*5fd0122aSMatthias Ringwald //! 652*5fd0122aSMatthias Ringwald //! \param readMode The read mode to set. Valid values are: 653*5fd0122aSMatthias Ringwald //! - \b FLASH_NORMAL_READ_MODE, 654*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN0_READ_MODE, 655*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN1_READ_MODE, 656*5fd0122aSMatthias Ringwald //! - \b FLASH_PROGRAM_VERIFY_READ_MODE, 657*5fd0122aSMatthias Ringwald //! - \b FLASH_ERASE_VERIFY_READ_MODE, 658*5fd0122aSMatthias Ringwald //! - \b FLASH_LEAKAGE_VERIFY_READ_MODE, 659*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN0B_READ_MODE, 660*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN1B_READ_MODE 661*5fd0122aSMatthias Ringwald //! 662*5fd0122aSMatthias Ringwald //! \return None. 663*5fd0122aSMatthias Ringwald // 664*5fd0122aSMatthias Ringwald //***************************************************************************** 665*5fd0122aSMatthias Ringwald extern bool FlashCtl_setReadMode(uint32_t flashBank, uint32_t readMode); 666*5fd0122aSMatthias Ringwald 667*5fd0122aSMatthias Ringwald //***************************************************************************** 668*5fd0122aSMatthias Ringwald // 669*5fd0122aSMatthias Ringwald //! Gets the flash read mode to be used by default flash read operations. 670*5fd0122aSMatthias Ringwald //! 671*5fd0122aSMatthias Ringwald //! \param flashBank Flash bank to set read mode for. Valid values are: 672*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK0 673*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK1 674*5fd0122aSMatthias Ringwald //! 675*5fd0122aSMatthias Ringwald //! \return Returns the read mode to set. Valid values are: 676*5fd0122aSMatthias Ringwald //! - \b FLASH_NORMAL_READ_MODE, 677*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN0_READ_MODE, 678*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN1_READ_MODE, 679*5fd0122aSMatthias Ringwald //! - \b FLASH_PROGRAM_VERIFY_READ_MODE, 680*5fd0122aSMatthias Ringwald //! - \b FLASH_ERASE_VERIFY_READ_MODE, 681*5fd0122aSMatthias Ringwald //! - \b FLASH_LEAKAGE_VERIFY_READ_MODE, 682*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN0B_READ_MODE, 683*5fd0122aSMatthias Ringwald //! - \b FLASH_MARGIN1B_READ_MODE 684*5fd0122aSMatthias Ringwald //! 685*5fd0122aSMatthias Ringwald // 686*5fd0122aSMatthias Ringwald //***************************************************************************** 687*5fd0122aSMatthias Ringwald extern uint32_t FlashCtl_getReadMode(uint32_t flashBank); 688*5fd0122aSMatthias Ringwald 689*5fd0122aSMatthias Ringwald //***************************************************************************** 690*5fd0122aSMatthias Ringwald // 691*5fd0122aSMatthias Ringwald //! Changes the number of wait states that are used by the flash controller 692*5fd0122aSMatthias Ringwald //! for read operations. When changing frequency ranges of the clock, this 693*5fd0122aSMatthias Ringwald //! functions must be used in order to allow for readable flash memory. 694*5fd0122aSMatthias Ringwald //! 695*5fd0122aSMatthias Ringwald //! \param waitState The number of wait states to set. Note that only 696*5fd0122aSMatthias Ringwald //! bits 0-3 are used. 697*5fd0122aSMatthias Ringwald //! 698*5fd0122aSMatthias Ringwald //! \param flashBank Flash bank to set wait state for. Valid values are: 699*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK0 700*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK1 701*5fd0122aSMatthias Ringwald //! 702*5fd0122aSMatthias Ringwald // 703*5fd0122aSMatthias Ringwald //***************************************************************************** 704*5fd0122aSMatthias Ringwald extern void FlashCtl_setWaitState(uint32_t bank, uint32_t waitState); 705*5fd0122aSMatthias Ringwald 706*5fd0122aSMatthias Ringwald //***************************************************************************** 707*5fd0122aSMatthias Ringwald // 708*5fd0122aSMatthias Ringwald //! Returns the set number of flash wait states for the given flash bank. 709*5fd0122aSMatthias Ringwald //! 710*5fd0122aSMatthias Ringwald //! \param flashBank Flash bank to set wait state for. Valid values are: 711*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK0 712*5fd0122aSMatthias Ringwald //! - \b FLASH_BANK1 713*5fd0122aSMatthias Ringwald //! 714*5fd0122aSMatthias Ringwald //! \return The wait state setting for the specified flash bank 715*5fd0122aSMatthias Ringwald // 716*5fd0122aSMatthias Ringwald //***************************************************************************** 717*5fd0122aSMatthias Ringwald extern uint32_t FlashCtl_getWaitState(uint32_t bank); 718*5fd0122aSMatthias Ringwald 719*5fd0122aSMatthias Ringwald //***************************************************************************** 720*5fd0122aSMatthias Ringwald // 721*5fd0122aSMatthias Ringwald //! Enables individual flash control interrupt sources. 722*5fd0122aSMatthias Ringwald //! 723*5fd0122aSMatthias Ringwald //! \param flags is a bit mask of the interrupt sources to be enabled. Must 724*5fd0122aSMatthias Ringwald //! be a logical OR of: 725*5fd0122aSMatthias Ringwald //! - \b FLASH_PROGRAM_ERROR, 726*5fd0122aSMatthias Ringwald //! - \b FLASH_BENCHMARK_INT, 727*5fd0122aSMatthias Ringwald //! - \b FLASH_ERASE_COMPLETE, 728*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTPRGM_COMPLETE, 729*5fd0122aSMatthias Ringwald //! - \b FLASH_WRDPRGM_COMPLETE, 730*5fd0122aSMatthias Ringwald //! - \b FLASH_POSTVERIFY_FAILED, 731*5fd0122aSMatthias Ringwald //! - \b FLASH_PREVERIFY_FAILED, 732*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTRDCMP_COMPLETE 733*5fd0122aSMatthias Ringwald //! 734*5fd0122aSMatthias Ringwald //! This function enables the indicated flash system interrupt sources. Only 735*5fd0122aSMatthias Ringwald //! the sources that are enabled can be reflected to the processor interrupt; 736*5fd0122aSMatthias Ringwald //! disabled sources have no effect on the processor. 737*5fd0122aSMatthias Ringwald //! 738*5fd0122aSMatthias Ringwald //! \note The interrupt sources vary based on the part in use. 739*5fd0122aSMatthias Ringwald //! Please consult the data sheet for the part you are using to determine 740*5fd0122aSMatthias Ringwald //! which interrupt sources are available. 741*5fd0122aSMatthias Ringwald //! 742*5fd0122aSMatthias Ringwald //! \return None. 743*5fd0122aSMatthias Ringwald // 744*5fd0122aSMatthias Ringwald //***************************************************************************** 745*5fd0122aSMatthias Ringwald extern void FlashCtl_enableInterrupt(uint32_t flags); 746*5fd0122aSMatthias Ringwald 747*5fd0122aSMatthias Ringwald //***************************************************************************** 748*5fd0122aSMatthias Ringwald // 749*5fd0122aSMatthias Ringwald //! Disables individual flash system interrupt sources. 750*5fd0122aSMatthias Ringwald //! 751*5fd0122aSMatthias Ringwald //! \param flags is a bit mask of the interrupt sources to be disabled. Must 752*5fd0122aSMatthias Ringwald //! be a logical OR of: 753*5fd0122aSMatthias Ringwald //! - \b FLASH_PROGRAM_ERROR, 754*5fd0122aSMatthias Ringwald //! - \b FLASH_BENCHMARK_INT, 755*5fd0122aSMatthias Ringwald //! - \b FLASH_ERASE_COMPLETE, 756*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTPRGM_COMPLETE, 757*5fd0122aSMatthias Ringwald //! - \b FLASH_WRDPRGM_COMPLETE, 758*5fd0122aSMatthias Ringwald //! - \b FLASH_POSTVERIFY_FAILED, 759*5fd0122aSMatthias Ringwald //! - \b FLASH_PREVERIFY_FAILED, 760*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTRDCMP_COMPLETE 761*5fd0122aSMatthias Ringwald //! 762*5fd0122aSMatthias Ringwald //! This function disables the indicated flash system interrupt sources. 763*5fd0122aSMatthias Ringwald //! Only the sources that are enabled can be reflected to the processor 764*5fd0122aSMatthias Ringwald //! interrupt; disabled sources have no effect on the processor. 765*5fd0122aSMatthias Ringwald //! 766*5fd0122aSMatthias Ringwald //! 767*5fd0122aSMatthias Ringwald //! \return None. 768*5fd0122aSMatthias Ringwald // 769*5fd0122aSMatthias Ringwald //***************************************************************************** 770*5fd0122aSMatthias Ringwald extern void FlashCtl_disableInterrupt(uint32_t flags); 771*5fd0122aSMatthias Ringwald 772*5fd0122aSMatthias Ringwald //***************************************************************************** 773*5fd0122aSMatthias Ringwald // 774*5fd0122aSMatthias Ringwald //! Gets the current interrupt status masked with the enabled interrupts. 775*5fd0122aSMatthias Ringwald //! This function is useful to call in ISRs to get a list 776*5fd0122aSMatthias Ringwald //! of pending interrupts that are actually enabled and could have caused the 777*5fd0122aSMatthias Ringwald //! ISR. 778*5fd0122aSMatthias Ringwald //! 779*5fd0122aSMatthias Ringwald //! \return The current interrupt status, enumerated as a bit field of 780*5fd0122aSMatthias Ringwald //! - \b FLASH_PROGRAM_ERROR, 781*5fd0122aSMatthias Ringwald //! - \b FLASH_BENCHMARK_INT, 782*5fd0122aSMatthias Ringwald //! - \b FLASH_ERASE_COMPLETE, 783*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTPRGM_COMPLETE, 784*5fd0122aSMatthias Ringwald //! - \b FLASH_WRDPRGM_COMPLETE, 785*5fd0122aSMatthias Ringwald //! - \b FLASH_POSTVERIFY_FAILED, 786*5fd0122aSMatthias Ringwald //! - \b FLASH_PREVERIFY_FAILED, 787*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTRDCMP_COMPLETE 788*5fd0122aSMatthias Ringwald //! 789*5fd0122aSMatthias Ringwald //! \note The interrupt sources vary based on the part in use. 790*5fd0122aSMatthias Ringwald //! Please consult the data sheet for the part you are using to determine 791*5fd0122aSMatthias Ringwald //! which interrupt sources are available. 792*5fd0122aSMatthias Ringwald // 793*5fd0122aSMatthias Ringwald //***************************************************************************** 794*5fd0122aSMatthias Ringwald extern uint32_t FlashCtl_getEnabledInterruptStatus(void); 795*5fd0122aSMatthias Ringwald 796*5fd0122aSMatthias Ringwald //***************************************************************************** 797*5fd0122aSMatthias Ringwald // 798*5fd0122aSMatthias Ringwald //! Gets the current interrupt status. 799*5fd0122aSMatthias Ringwald //! 800*5fd0122aSMatthias Ringwald //! \return The current interrupt status, enumerated as a bit field of: 801*5fd0122aSMatthias Ringwald //! - \b FLASH_PROGRAM_ERROR, 802*5fd0122aSMatthias Ringwald //! - \b FLASH_BENCHMARK_INT, 803*5fd0122aSMatthias Ringwald //! - \b FLASH_ERASE_COMPLETE, 804*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTPRGM_COMPLETE, 805*5fd0122aSMatthias Ringwald //! - \b FLASH_WRDPRGM_COMPLETE, 806*5fd0122aSMatthias Ringwald //! - \b FLASH_POSTVERIFY_FAILED, 807*5fd0122aSMatthias Ringwald //! - \b FLASH_PREVERIFY_FAILED, 808*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTRDCMP_COMPLETE 809*5fd0122aSMatthias Ringwald //! 810*5fd0122aSMatthias Ringwald //! \note The interrupt sources vary based on the part in use. 811*5fd0122aSMatthias Ringwald //! Please consult the data sheet for the part you are using to determine 812*5fd0122aSMatthias Ringwald //! which interrupt sources are available. 813*5fd0122aSMatthias Ringwald // 814*5fd0122aSMatthias Ringwald //***************************************************************************** 815*5fd0122aSMatthias Ringwald extern uint32_t FlashCtl_getInterruptStatus(void); 816*5fd0122aSMatthias Ringwald 817*5fd0122aSMatthias Ringwald //***************************************************************************** 818*5fd0122aSMatthias Ringwald // 819*5fd0122aSMatthias Ringwald //! Clears flash system interrupt sources. 820*5fd0122aSMatthias Ringwald //! 821*5fd0122aSMatthias Ringwald //! \param flags is a bit mask of the interrupt sources to be cleared. Must 822*5fd0122aSMatthias Ringwald //! be a logical OR of: 823*5fd0122aSMatthias Ringwald //! - \b FLASH_PROGRAM_ERROR, 824*5fd0122aSMatthias Ringwald //! - \b FLASH_BENCHMARK_INT, 825*5fd0122aSMatthias Ringwald //! - \b FLASH_ERASE_COMPLETE, 826*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTPRGM_COMPLETE, 827*5fd0122aSMatthias Ringwald //! - \b FLASH_WRDPRGM_COMPLETE, 828*5fd0122aSMatthias Ringwald //! - \b FLASH_POSTVERIFY_FAILED, 829*5fd0122aSMatthias Ringwald //! - \b FLASH_PREVERIFY_FAILED, 830*5fd0122aSMatthias Ringwald //! - \b FLASH_BRSTRDCMP_COMPLETE 831*5fd0122aSMatthias Ringwald //! 832*5fd0122aSMatthias Ringwald //! The specified flash system interrupt sources are cleared, so that they no 833*5fd0122aSMatthias Ringwald //! longer assert. This function must be called in the interrupt handler to 834*5fd0122aSMatthias Ringwald //! keep it from being called again immediately upon exit. 835*5fd0122aSMatthias Ringwald //! 836*5fd0122aSMatthias Ringwald //! \note Because there is a write buffer in the Cortex-M processor, it may 837*5fd0122aSMatthias Ringwald //! take several clock cycles before the interrupt source is actually cleared. 838*5fd0122aSMatthias Ringwald //! Therefore, it is recommended that the interrupt source be cleared early in 839*5fd0122aSMatthias Ringwald //! the interrupt handler (as opposed to the very last action) to avoid 840*5fd0122aSMatthias Ringwald //! returning from the interrupt handler before the interrupt source is 841*5fd0122aSMatthias Ringwald //! actually cleared. Failure to do so may result in the interrupt handler 842*5fd0122aSMatthias Ringwald //! being immediately reentered (because the interrupt controller still sees 843*5fd0122aSMatthias Ringwald //! the interrupt source asserted). 844*5fd0122aSMatthias Ringwald //! 845*5fd0122aSMatthias Ringwald //! \note The interrupt sources vary based on the part in use. 846*5fd0122aSMatthias Ringwald //! Please consult the data sheet for the part you are using to determine 847*5fd0122aSMatthias Ringwald //! which interrupt sources are available. 848*5fd0122aSMatthias Ringwald //! 849*5fd0122aSMatthias Ringwald //! \return None. 850*5fd0122aSMatthias Ringwald // 851*5fd0122aSMatthias Ringwald //***************************************************************************** 852*5fd0122aSMatthias Ringwald extern void FlashCtl_clearInterruptFlag(uint32_t flags); 853*5fd0122aSMatthias Ringwald 854*5fd0122aSMatthias Ringwald //***************************************************************************** 855*5fd0122aSMatthias Ringwald // 856*5fd0122aSMatthias Ringwald //! Registers an interrupt handler for flash clock system interrupt. 857*5fd0122aSMatthias Ringwald //! 858*5fd0122aSMatthias Ringwald //! \param intHandler is a pointer to the function to be called when the clock 859*5fd0122aSMatthias Ringwald //! system interrupt occurs. 860*5fd0122aSMatthias Ringwald //! 861*5fd0122aSMatthias Ringwald //! This function registers the handler to be called when a clock system 862*5fd0122aSMatthias Ringwald //! interrupt occurs. This function enables the global interrupt in the 863*5fd0122aSMatthias Ringwald //! interrupt controller; specific flash controller interrupts must be enabled 864*5fd0122aSMatthias Ringwald //! via FlashCtl_enableInterrupt(). It is the interrupt handler's 865*5fd0122aSMatthias Ringwald //! responsibility to clear the interrupt source via 866*5fd0122aSMatthias Ringwald //! FlashCtl_clearInterruptFlag(). 867*5fd0122aSMatthias Ringwald //! 868*5fd0122aSMatthias Ringwald //! \sa Interrupt_registerInterrupt() for important information about 869*5fd0122aSMatthias Ringwald //! registering interrupt handlers. 870*5fd0122aSMatthias Ringwald //! 871*5fd0122aSMatthias Ringwald //! \return None. 872*5fd0122aSMatthias Ringwald // 873*5fd0122aSMatthias Ringwald //***************************************************************************** 874*5fd0122aSMatthias Ringwald extern void FlashCtl_registerInterrupt(void (*intHandler)(void)); 875*5fd0122aSMatthias Ringwald 876*5fd0122aSMatthias Ringwald //***************************************************************************** 877*5fd0122aSMatthias Ringwald // 878*5fd0122aSMatthias Ringwald //! Unregisters the interrupt handler for the flash system. 879*5fd0122aSMatthias Ringwald //! 880*5fd0122aSMatthias Ringwald //! This function unregisters the handler to be called when a clock system 881*5fd0122aSMatthias Ringwald //! interrupt occurs. This function also masks off the interrupt in the 882*5fd0122aSMatthias Ringwald //! interrupt controller so that the interrupt handler no longer is called. 883*5fd0122aSMatthias Ringwald //! 884*5fd0122aSMatthias Ringwald //! \sa Interrupt_registerInterrupt() for important information about 885*5fd0122aSMatthias Ringwald //! registering interrupt handlers. 886*5fd0122aSMatthias Ringwald //! 887*5fd0122aSMatthias Ringwald //! \return None. 888*5fd0122aSMatthias Ringwald // 889*5fd0122aSMatthias Ringwald //***************************************************************************** 890*5fd0122aSMatthias Ringwald extern void FlashCtl_unregisterInterrupt(void); 891*5fd0122aSMatthias Ringwald 892*5fd0122aSMatthias Ringwald 893*5fd0122aSMatthias Ringwald //***************************************************************************** 894*5fd0122aSMatthias Ringwald // 895*5fd0122aSMatthias Ringwald //! Initiates a sector erase of MAIN or INFO flash memory. Note that this 896*5fd0122aSMatthias Ringwald //! function simply initaites the sector erase, but does no verification 897*5fd0122aSMatthias Ringwald //! which is required by the flash controller. The user must manually set 898*5fd0122aSMatthias Ringwald //! and enable interrupts on the flash controller to fire on erase completion 899*5fd0122aSMatthias Ringwald //! and then use the FlashCtl_verifyMemory function to verify that the sector 900*5fd0122aSMatthias Ringwald //! was actually erased 901*5fd0122aSMatthias Ringwald //! 902*5fd0122aSMatthias Ringwald //! \param addr The start of the sector to erase. Note that with flash, 903*5fd0122aSMatthias Ringwald //! the minimum allowed size that can be erased is a flash sector 904*5fd0122aSMatthias Ringwald //! (which is 4KB on the MSP432 family). If an address is provided to 905*5fd0122aSMatthias Ringwald //! this function which is not on a 4KB boundary, the entire sector 906*5fd0122aSMatthias Ringwald //! will still be erased. 907*5fd0122aSMatthias Ringwald //! 908*5fd0122aSMatthias Ringwald //! \return None 909*5fd0122aSMatthias Ringwald // 910*5fd0122aSMatthias Ringwald //***************************************************************************** 911*5fd0122aSMatthias Ringwald extern void FlashCtl_initiateSectorErase(uint32_t addr); 912*5fd0122aSMatthias Ringwald 913*5fd0122aSMatthias Ringwald 914*5fd0122aSMatthias Ringwald /* The following functions are advanced functions that are used by the flash 915*5fd0122aSMatthias Ringwald * driver to remask a failed bit in the event of a post or pre verification 916*5fd0122aSMatthias Ringwald * failure. They are meant to be advanced functions and should not be used 917*5fd0122aSMatthias Ringwald * by the majority of users (unless you are writing your own flash driver). 918*5fd0122aSMatthias Ringwald */ 919*5fd0122aSMatthias Ringwald extern uint8_t __FlashCtl_remaskData8Post(uint8_t data, uint32_t addr); 920*5fd0122aSMatthias Ringwald extern uint8_t __FlashCtl_remaskData8Pre(uint8_t data, uint32_t addr); 921*5fd0122aSMatthias Ringwald extern uint32_t __FlashCtl_remaskData32Post(uint32_t data, uint32_t addr); 922*5fd0122aSMatthias Ringwald extern uint32_t __FlashCtl_remaskData32Pre(uint32_t data, uint32_t addr); 923*5fd0122aSMatthias Ringwald extern void __FlashCtl_remaskBurstDataPost(uint32_t addr, uint32_t size); 924*5fd0122aSMatthias Ringwald extern void __FlashCtl_remaskBurstDataPre(uint32_t addr, uint32_t size); 925*5fd0122aSMatthias Ringwald 926*5fd0122aSMatthias Ringwald //***************************************************************************** 927*5fd0122aSMatthias Ringwald // 928*5fd0122aSMatthias Ringwald // Mark the end of the C bindings section for C++ compilers. 929*5fd0122aSMatthias Ringwald // 930*5fd0122aSMatthias Ringwald //***************************************************************************** 931*5fd0122aSMatthias Ringwald #ifdef __cplusplus 932*5fd0122aSMatthias Ringwald } 933*5fd0122aSMatthias Ringwald #endif 934*5fd0122aSMatthias Ringwald 935*5fd0122aSMatthias Ringwald //***************************************************************************** 936*5fd0122aSMatthias Ringwald // 937*5fd0122aSMatthias Ringwald // Close the Doxygen group. 938*5fd0122aSMatthias Ringwald //! @} 939*5fd0122aSMatthias Ringwald // 940*5fd0122aSMatthias Ringwald //***************************************************************************** 941*5fd0122aSMatthias Ringwald 942*5fd0122aSMatthias Ringwald #endif /* __MCU_HAS_FLCTL__ */ 943*5fd0122aSMatthias Ringwald 944*5fd0122aSMatthias Ringwald #endif // __FLASH_H__ 945