MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
flc.h
1 
7 /* ****************************************************************************
8  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
24  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  *
28  * Except as contained in this notice, the name of Maxim Integrated
29  * Products, Inc. shall not be used except as stated in the Maxim Integrated
30  * Products, Inc. Branding Policy.
31  *
32  * The mere transfer of this software does not imply any licenses
33  * of trade secrets, proprietary technology, copyrights, patents,
34  * trademarks, maskwork rights, or any other form of intellectual
35  * property whatsoever. Maxim Integrated Products, Inc. retains all
36  * ownership rights.
37  *
38  * $Date: 2018-11-08 09:36:51 -0600 (Thu, 08 Nov 2018) $
39  * $Revision: 39038 $
40  *
41  *************************************************************************** */
42 
43 #ifndef _FLC_H_
44 #define _FLC_H_
45 
46 /* **** Includes **** */
47 #include "flc_regs.h"
48 #include "mxc_sys.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
60 /***** Definitions *****/
61 
63 #define MXC_FLASH_PAGE_MASK ~(MXC_FLASH_PAGE_SIZE - 1)
64 
66 #define MXC_FLASH_PAGE_ADDR(page) (MXC_FLASH_MEM_BASE + ((unsigned long)page * MXC_FLASH_PAGE_SIZE))
67 
68 /***** Function Prototypes *****/
69 
74 int FLC_Init(const sys_cfg_t *sys_cfg);
75 
82 int FLC_Busy(void);
83 
89 int FLC_MassErase(void);
90 
97 int FLC_PageErase(uint32_t address);
98 
106 int FLC_MultiPageErase(uint32_t start, uint32_t end);
107 
123 int FLC_Erase(uint32_t start, uint32_t end, uint32_t *buffer, unsigned length);
124 
133 int FLC_Write32(uint32_t address, uint32_t data);
134 
143 int FLC_Write128(uint32_t address, uint32_t *data);
144 
154 int FLC_Write(uint32_t address, uint32_t length, uint32_t *buffer);
155 
161 int FLC_EnableInt(uint32_t mask);
162 
168 int FLC_DisableInt(uint32_t mask);
169 
174 int FLC_GetFlags(void);
175 
182 int FLC_ClearFlags(uint32_t mask);
183 
191 int FLC_UnlockInfoBlock(uint32_t address);
192 
199 int FLC_LockInfoBlock(uint32_t address);
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif /* _FLC_H_ */
int FLC_PageErase(uint32_t address)
Erases the page of flash at the specified address.
int FLC_MassErase(void)
Erases the entire flash array.
int FLC_Write(uint32_t address, uint32_t length, uint32_t *buffer)
Writes data to flash.
int FLC_GetFlags(void)
Retrieve flash interrupt flags.
int FLC_DisableInt(uint32_t mask)
Disable flash interrupts.
int FLC_Write32(uint32_t address, uint32_t data)
Writes the specified 32-bit value to flash.
int FLC_Init(const sys_cfg_t *sys_cfg)
Initializes the Flash Controller for erase/write operations.
int FLC_Write128(uint32_t address, uint32_t *data)
Writes the specified 128-bits of data to flash.
int FLC_EnableInt(uint32_t mask)
Enable flash interrupts.
int FLC_UnlockInfoBlock(uint32_t address)
Unlock info block.
int FLC_Busy(void)
Checks if Flash Controller is busy.
int FLC_LockInfoBlock(uint32_t address)
Lock info block.
int FLC_ClearFlags(uint32_t mask)
Clear flash interrupt flags.
int FLC_MultiPageErase(uint32_t start, uint32_t end)
Erases flash pages from start to end address inclusive.
int FLC_Erase(uint32_t start, uint32_t end, uint32_t *buffer, unsigned length)
Erase a range from start to end address.