mbed library sources. Supersedes mbed-src. Edited target satm32f446 for user USART3 pins
Fork of mbed-dev by
targets/TARGET_Maxim/TARGET_MAX32620C/mxc/flc.h@186:707f6e361f3e, 2018-06-22 (annotated)
- Committer:
- Anna Bridge
- Date:
- Fri Jun 22 16:45:37 2018 +0100
- Revision:
- 186:707f6e361f3e
mbed-dev library. Release version 162
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Anna Bridge |
186:707f6e361f3e | 1 | /** |
Anna Bridge |
186:707f6e361f3e | 2 | * @file |
Anna Bridge |
186:707f6e361f3e | 3 | * @brief Flash Controller (FLC) function prototypes and data types. |
Anna Bridge |
186:707f6e361f3e | 4 | */ |
Anna Bridge |
186:707f6e361f3e | 5 | |
Anna Bridge |
186:707f6e361f3e | 6 | /* **************************************************************************** |
Anna Bridge |
186:707f6e361f3e | 7 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
Anna Bridge |
186:707f6e361f3e | 8 | * |
Anna Bridge |
186:707f6e361f3e | 9 | * Permission is hereby granted, free of charge, to any person obtaining a |
Anna Bridge |
186:707f6e361f3e | 10 | * copy of this software and associated documentation files (the "Software"), |
Anna Bridge |
186:707f6e361f3e | 11 | * to deal in the Software without restriction, including without limitation |
Anna Bridge |
186:707f6e361f3e | 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
Anna Bridge |
186:707f6e361f3e | 13 | * and/or sell copies of the Software, and to permit persons to whom the |
Anna Bridge |
186:707f6e361f3e | 14 | * Software is furnished to do so, subject to the following conditions: |
Anna Bridge |
186:707f6e361f3e | 15 | * |
Anna Bridge |
186:707f6e361f3e | 16 | * The above copyright notice and this permission notice shall be included |
Anna Bridge |
186:707f6e361f3e | 17 | * in all copies or substantial portions of the Software. |
Anna Bridge |
186:707f6e361f3e | 18 | * |
Anna Bridge |
186:707f6e361f3e | 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
Anna Bridge |
186:707f6e361f3e | 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
Anna Bridge |
186:707f6e361f3e | 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
Anna Bridge |
186:707f6e361f3e | 22 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
Anna Bridge |
186:707f6e361f3e | 23 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
Anna Bridge |
186:707f6e361f3e | 24 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
Anna Bridge |
186:707f6e361f3e | 25 | * OTHER DEALINGS IN THE SOFTWARE. |
Anna Bridge |
186:707f6e361f3e | 26 | * |
Anna Bridge |
186:707f6e361f3e | 27 | * Except as contained in this notice, the name of Maxim Integrated |
Anna Bridge |
186:707f6e361f3e | 28 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
Anna Bridge |
186:707f6e361f3e | 29 | * Products, Inc. Branding Policy. |
Anna Bridge |
186:707f6e361f3e | 30 | * |
Anna Bridge |
186:707f6e361f3e | 31 | * The mere transfer of this software does not imply any licenses |
Anna Bridge |
186:707f6e361f3e | 32 | * of trade secrets, proprietary technology, copyrights, patents, |
Anna Bridge |
186:707f6e361f3e | 33 | * trademarks, maskwork rights, or any other form of intellectual |
Anna Bridge |
186:707f6e361f3e | 34 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
Anna Bridge |
186:707f6e361f3e | 35 | * ownership rights. |
Anna Bridge |
186:707f6e361f3e | 36 | * |
Anna Bridge |
186:707f6e361f3e | 37 | * $Date: 2017-02-16 12:09:00 -0600 (Thu, 16 Feb 2017) $ |
Anna Bridge |
186:707f6e361f3e | 38 | * $Revision: 26470 $ |
Anna Bridge |
186:707f6e361f3e | 39 | * |
Anna Bridge |
186:707f6e361f3e | 40 | *************************************************************************** */ |
Anna Bridge |
186:707f6e361f3e | 41 | |
Anna Bridge |
186:707f6e361f3e | 42 | /* Define to prevent redundant inclusion */ |
Anna Bridge |
186:707f6e361f3e | 43 | #ifndef _FLC_H_ |
Anna Bridge |
186:707f6e361f3e | 44 | #define _FLC_H_ |
Anna Bridge |
186:707f6e361f3e | 45 | |
Anna Bridge |
186:707f6e361f3e | 46 | /* **** Includes **** */ |
Anna Bridge |
186:707f6e361f3e | 47 | #include "flc_regs.h" |
Anna Bridge |
186:707f6e361f3e | 48 | |
Anna Bridge |
186:707f6e361f3e | 49 | #ifdef __cplusplus |
Anna Bridge |
186:707f6e361f3e | 50 | extern "C" { |
Anna Bridge |
186:707f6e361f3e | 51 | #endif |
Anna Bridge |
186:707f6e361f3e | 52 | |
Anna Bridge |
186:707f6e361f3e | 53 | /** |
Anna Bridge |
186:707f6e361f3e | 54 | * @ingroup periphlibs |
Anna Bridge |
186:707f6e361f3e | 55 | * @defgroup flc Flash Controller |
Anna Bridge |
186:707f6e361f3e | 56 | * @brief Internal Flash Controller (FLC) API. |
Anna Bridge |
186:707f6e361f3e | 57 | * @{ |
Anna Bridge |
186:707f6e361f3e | 58 | */ |
Anna Bridge |
186:707f6e361f3e | 59 | |
Anna Bridge |
186:707f6e361f3e | 60 | /* **** Definitions **** */ |
Anna Bridge |
186:707f6e361f3e | 61 | |
Anna Bridge |
186:707f6e361f3e | 62 | /* **** Globals **** */ |
Anna Bridge |
186:707f6e361f3e | 63 | |
Anna Bridge |
186:707f6e361f3e | 64 | /* **** Function Prototypes **** */ |
Anna Bridge |
186:707f6e361f3e | 65 | |
Anna Bridge |
186:707f6e361f3e | 66 | /** |
Anna Bridge |
186:707f6e361f3e | 67 | * @brief Prepares the Flash Controller for in-application flash operations. This function |
Anna Bridge |
186:707f6e361f3e | 68 | * only needs to be called one time after a reset event. |
Anna Bridge |
186:707f6e361f3e | 69 | * |
Anna Bridge |
186:707f6e361f3e | 70 | * @return #E_NO_ERROR if flash controller initialized correctly, error if |
Anna Bridge |
186:707f6e361f3e | 71 | * unsuccessful. |
Anna Bridge |
186:707f6e361f3e | 72 | */ |
Anna Bridge |
186:707f6e361f3e | 73 | int FLC_Init(void); |
Anna Bridge |
186:707f6e361f3e | 74 | |
Anna Bridge |
186:707f6e361f3e | 75 | /** |
Anna Bridge |
186:707f6e361f3e | 76 | * @brief This function will erase a single page of flash. |
Anna Bridge |
186:707f6e361f3e | 77 | * |
Anna Bridge |
186:707f6e361f3e | 78 | * @param address Address of the page to be erased. |
Anna Bridge |
186:707f6e361f3e | 79 | * @param erase_code Flash erase code; defined as |
Anna Bridge |
186:707f6e361f3e | 80 | * #MXC_V_FLC_ERASE_CODE_PAGE_ERASE for page erase |
Anna Bridge |
186:707f6e361f3e | 81 | * @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY. |
Anna Bridge |
186:707f6e361f3e | 82 | * |
Anna Bridge |
186:707f6e361f3e | 83 | * @returns #E_NO_ERROR if page erase successful, error if unsuccessful. |
Anna Bridge |
186:707f6e361f3e | 84 | */ |
Anna Bridge |
186:707f6e361f3e | 85 | int FLC_PageErase(uint32_t address, uint8_t erase_code, uint8_t unlock_key); |
Anna Bridge |
186:707f6e361f3e | 86 | |
Anna Bridge |
186:707f6e361f3e | 87 | /** |
Anna Bridge |
186:707f6e361f3e | 88 | * @brief This function writes data to the flash device through the flash |
Anna Bridge |
186:707f6e361f3e | 89 | * controller interface |
Anna Bridge |
186:707f6e361f3e | 90 | * |
Anna Bridge |
186:707f6e361f3e | 91 | * @param address Start address for desired write. @note This address |
Anna Bridge |
186:707f6e361f3e | 92 | * must be 32-bit word aligned |
Anna Bridge |
186:707f6e361f3e | 93 | * @param data A pointer to the buffer containing the data to write. |
Anna Bridge |
186:707f6e361f3e | 94 | * @param length Size of the data to write in bytes. @note The length |
Anna Bridge |
186:707f6e361f3e | 95 | * must be in 32-bit multiples. |
Anna Bridge |
186:707f6e361f3e | 96 | * @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY. |
Anna Bridge |
186:707f6e361f3e | 97 | * |
Anna Bridge |
186:707f6e361f3e | 98 | * @returns #E_NO_ERROR if data written successfully, error if unsuccessful. |
Anna Bridge |
186:707f6e361f3e | 99 | */ |
Anna Bridge |
186:707f6e361f3e | 100 | int FLC_Write(uint32_t address, const void *data, uint32_t length, uint8_t unlock_key); |
Anna Bridge |
186:707f6e361f3e | 101 | |
Anna Bridge |
186:707f6e361f3e | 102 | /** |
Anna Bridge |
186:707f6e361f3e | 103 | * @brief This function will mass erase the flash. |
Anna Bridge |
186:707f6e361f3e | 104 | * |
Anna Bridge |
186:707f6e361f3e | 105 | * @param erase_code Flash erase code, #MXC_V_FLC_ERASE_CODE_MASS_ERASE. |
Anna Bridge |
186:707f6e361f3e | 106 | * @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY. |
Anna Bridge |
186:707f6e361f3e | 107 | * |
Anna Bridge |
186:707f6e361f3e | 108 | * @returns #E_NO_ERROR if device mass erase successful, error if unsuccessful. |
Anna Bridge |
186:707f6e361f3e | 109 | */ |
Anna Bridge |
186:707f6e361f3e | 110 | int FLC_MassErase(uint8_t erase_code, uint8_t unlock_key); |
Anna Bridge |
186:707f6e361f3e | 111 | |
Anna Bridge |
186:707f6e361f3e | 112 | /**@} end of group flc */ |
Anna Bridge |
186:707f6e361f3e | 113 | |
Anna Bridge |
186:707f6e361f3e | 114 | #ifdef __cplusplus |
Anna Bridge |
186:707f6e361f3e | 115 | } |
Anna Bridge |
186:707f6e361f3e | 116 | #endif |
Anna Bridge |
186:707f6e361f3e | 117 | |
Anna Bridge |
186:707f6e361f3e | 118 | #endif /* _FLC_H_ */ |