![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/targets/TARGET_Atmel/TARGET_SAM_CortexM4/drivers/efc/efc.h@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /** |
kadonotakashi | 0:8fdf9a60065b | 2 | * \file |
kadonotakashi | 0:8fdf9a60065b | 3 | * |
kadonotakashi | 0:8fdf9a60065b | 4 | * \brief Embedded Flash Controller (EFC) driver for SAM. |
kadonotakashi | 0:8fdf9a60065b | 5 | * |
kadonotakashi | 0:8fdf9a60065b | 6 | * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved. |
kadonotakashi | 0:8fdf9a60065b | 7 | * |
kadonotakashi | 0:8fdf9a60065b | 8 | * \asf_license_start |
kadonotakashi | 0:8fdf9a60065b | 9 | * |
kadonotakashi | 0:8fdf9a60065b | 10 | * \page License |
kadonotakashi | 0:8fdf9a60065b | 11 | * |
kadonotakashi | 0:8fdf9a60065b | 12 | * Redistribution and use in source and binary forms, with or without |
kadonotakashi | 0:8fdf9a60065b | 13 | * modification, are permitted provided that the following conditions are met: |
kadonotakashi | 0:8fdf9a60065b | 14 | * |
kadonotakashi | 0:8fdf9a60065b | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
kadonotakashi | 0:8fdf9a60065b | 16 | * this list of conditions and the following disclaimer. |
kadonotakashi | 0:8fdf9a60065b | 17 | * |
kadonotakashi | 0:8fdf9a60065b | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
kadonotakashi | 0:8fdf9a60065b | 19 | * this list of conditions and the following disclaimer in the documentation |
kadonotakashi | 0:8fdf9a60065b | 20 | * and/or other materials provided with the distribution. |
kadonotakashi | 0:8fdf9a60065b | 21 | * |
kadonotakashi | 0:8fdf9a60065b | 22 | * 3. The name of Atmel may not be used to endorse or promote products derived |
kadonotakashi | 0:8fdf9a60065b | 23 | * from this software without specific prior written permission. |
kadonotakashi | 0:8fdf9a60065b | 24 | * |
kadonotakashi | 0:8fdf9a60065b | 25 | * 4. This software may only be redistributed and used in connection with an |
kadonotakashi | 0:8fdf9a60065b | 26 | * Atmel microcontroller product. |
kadonotakashi | 0:8fdf9a60065b | 27 | * |
kadonotakashi | 0:8fdf9a60065b | 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED |
kadonotakashi | 0:8fdf9a60065b | 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
kadonotakashi | 0:8fdf9a60065b | 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE |
kadonotakashi | 0:8fdf9a60065b | 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR |
kadonotakashi | 0:8fdf9a60065b | 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
kadonotakashi | 0:8fdf9a60065b | 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
kadonotakashi | 0:8fdf9a60065b | 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
kadonotakashi | 0:8fdf9a60065b | 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
kadonotakashi | 0:8fdf9a60065b | 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
kadonotakashi | 0:8fdf9a60065b | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
kadonotakashi | 0:8fdf9a60065b | 38 | * POSSIBILITY OF SUCH DAMAGE. |
kadonotakashi | 0:8fdf9a60065b | 39 | * |
kadonotakashi | 0:8fdf9a60065b | 40 | * \asf_license_stop |
kadonotakashi | 0:8fdf9a60065b | 41 | * |
kadonotakashi | 0:8fdf9a60065b | 42 | */ |
kadonotakashi | 0:8fdf9a60065b | 43 | /* |
kadonotakashi | 0:8fdf9a60065b | 44 | * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> |
kadonotakashi | 0:8fdf9a60065b | 45 | */ |
kadonotakashi | 0:8fdf9a60065b | 46 | |
kadonotakashi | 0:8fdf9a60065b | 47 | #ifndef EFC_H_INCLUDED |
kadonotakashi | 0:8fdf9a60065b | 48 | #define EFC_H_INCLUDED |
kadonotakashi | 0:8fdf9a60065b | 49 | |
kadonotakashi | 0:8fdf9a60065b | 50 | #include "compiler.h" |
kadonotakashi | 0:8fdf9a60065b | 51 | |
kadonotakashi | 0:8fdf9a60065b | 52 | /// @cond 0 |
kadonotakashi | 0:8fdf9a60065b | 53 | /**INDENT-OFF**/ |
kadonotakashi | 0:8fdf9a60065b | 54 | #ifdef __cplusplus |
kadonotakashi | 0:8fdf9a60065b | 55 | extern "C" { |
kadonotakashi | 0:8fdf9a60065b | 56 | #endif |
kadonotakashi | 0:8fdf9a60065b | 57 | /**INDENT-ON**/ |
kadonotakashi | 0:8fdf9a60065b | 58 | /// @endcond |
kadonotakashi | 0:8fdf9a60065b | 59 | |
kadonotakashi | 0:8fdf9a60065b | 60 | /*! \name EFC return codes */ |
kadonotakashi | 0:8fdf9a60065b | 61 | //! @{ |
kadonotakashi | 0:8fdf9a60065b | 62 | typedef enum efc_rc { |
kadonotakashi | 0:8fdf9a60065b | 63 | EFC_RC_OK = 0, //!< Operation OK |
kadonotakashi | 0:8fdf9a60065b | 64 | EFC_RC_YES = 0, //!< Yes |
kadonotakashi | 0:8fdf9a60065b | 65 | EFC_RC_NO = 1, //!< No |
kadonotakashi | 0:8fdf9a60065b | 66 | EFC_RC_ERROR = 1, //!< General error |
kadonotakashi | 0:8fdf9a60065b | 67 | EFC_RC_INVALID, //!< Invalid argument input |
kadonotakashi | 0:8fdf9a60065b | 68 | EFC_RC_NOT_SUPPORT = 0xFFFFFFFF //!< Operation is not supported |
kadonotakashi | 0:8fdf9a60065b | 69 | } efc_rc_t; |
kadonotakashi | 0:8fdf9a60065b | 70 | //! @} |
kadonotakashi | 0:8fdf9a60065b | 71 | |
kadonotakashi | 0:8fdf9a60065b | 72 | /*! \name EFC command */ |
kadonotakashi | 0:8fdf9a60065b | 73 | //! @{ |
kadonotakashi | 0:8fdf9a60065b | 74 | #define EFC_FCMD_GETD 0x00 //!< Get Flash Descriptor |
kadonotakashi | 0:8fdf9a60065b | 75 | #define EFC_FCMD_WP 0x01 //!< Write page |
kadonotakashi | 0:8fdf9a60065b | 76 | #define EFC_FCMD_WPL 0x02 //!< Write page and lock |
kadonotakashi | 0:8fdf9a60065b | 77 | #define EFC_FCMD_EWP 0x03 //!< Erase page and write page |
kadonotakashi | 0:8fdf9a60065b | 78 | #define EFC_FCMD_EWPL 0x04 //!< Erase page and write page then lock |
kadonotakashi | 0:8fdf9a60065b | 79 | #define EFC_FCMD_EA 0x05 //!< Erase all |
kadonotakashi | 0:8fdf9a60065b | 80 | #if (SAM3SD8) |
kadonotakashi | 0:8fdf9a60065b | 81 | #define EFC_FCMD_EPL 0x06 //!< Erase plane |
kadonotakashi | 0:8fdf9a60065b | 82 | #endif |
kadonotakashi | 0:8fdf9a60065b | 83 | #if (SAM4S || SAM4E || SAM4N || SAM4C || SAMG || SAM4CP || SAM4CM || \ |
kadonotakashi | 0:8fdf9a60065b | 84 | SAMV71 || SAMV70 || SAMS70 || SAME70) |
kadonotakashi | 0:8fdf9a60065b | 85 | #define EFC_FCMD_EPA 0x07 //!< Erase pages |
kadonotakashi | 0:8fdf9a60065b | 86 | #endif |
kadonotakashi | 0:8fdf9a60065b | 87 | #define EFC_FCMD_SLB 0x08 //!< Set Lock Bit |
kadonotakashi | 0:8fdf9a60065b | 88 | #define EFC_FCMD_CLB 0x09 //!< Clear Lock Bit |
kadonotakashi | 0:8fdf9a60065b | 89 | #define EFC_FCMD_GLB 0x0A //!< Get Lock Bit |
kadonotakashi | 0:8fdf9a60065b | 90 | #define EFC_FCMD_SGPB 0x0B //!< Set GPNVM Bit |
kadonotakashi | 0:8fdf9a60065b | 91 | #define EFC_FCMD_CGPB 0x0C //!< Clear GPNVM Bit |
kadonotakashi | 0:8fdf9a60065b | 92 | #define EFC_FCMD_GGPB 0x0D //!< Get GPNVM Bit |
kadonotakashi | 0:8fdf9a60065b | 93 | #define EFC_FCMD_STUI 0x0E //!< Start unique ID |
kadonotakashi | 0:8fdf9a60065b | 94 | #define EFC_FCMD_SPUI 0x0F //!< Stop unique ID |
kadonotakashi | 0:8fdf9a60065b | 95 | #if (!SAM3U && !SAM3SD8 && !SAM3S8) |
kadonotakashi | 0:8fdf9a60065b | 96 | #define EFC_FCMD_GCALB 0x10 //!< Get CALIB Bit |
kadonotakashi | 0:8fdf9a60065b | 97 | #endif |
kadonotakashi | 0:8fdf9a60065b | 98 | #if (SAM4S || SAM4E || SAM4N || SAM4C || SAMG || SAM4CP || SAM4CM || \ |
kadonotakashi | 0:8fdf9a60065b | 99 | SAMV71 || SAMV70 || SAMS70 || SAME70) |
kadonotakashi | 0:8fdf9a60065b | 100 | #define EFC_FCMD_ES 0x11 //!< Erase sector |
kadonotakashi | 0:8fdf9a60065b | 101 | #define EFC_FCMD_WUS 0x12 //!< Write user signature |
kadonotakashi | 0:8fdf9a60065b | 102 | #define EFC_FCMD_EUS 0x13 //!< Erase user signature |
kadonotakashi | 0:8fdf9a60065b | 103 | #define EFC_FCMD_STUS 0x14 //!< Start read user signature |
kadonotakashi | 0:8fdf9a60065b | 104 | #define EFC_FCMD_SPUS 0x15 //!< Stop read user signature |
kadonotakashi | 0:8fdf9a60065b | 105 | #endif |
kadonotakashi | 0:8fdf9a60065b | 106 | //! @} |
kadonotakashi | 0:8fdf9a60065b | 107 | |
kadonotakashi | 0:8fdf9a60065b | 108 | /*! The IAP function entry address */ |
kadonotakashi | 0:8fdf9a60065b | 109 | #define CHIP_FLASH_IAP_ADDRESS (IROM_ADDR + 8) |
kadonotakashi | 0:8fdf9a60065b | 110 | |
kadonotakashi | 0:8fdf9a60065b | 111 | /*! \name EFC access mode */ |
kadonotakashi | 0:8fdf9a60065b | 112 | //! @{ |
kadonotakashi | 0:8fdf9a60065b | 113 | #define EFC_ACCESS_MODE_128 0 |
kadonotakashi | 0:8fdf9a60065b | 114 | #define EFC_ACCESS_MODE_64 EEFC_FMR_FAM |
kadonotakashi | 0:8fdf9a60065b | 115 | //! @} |
kadonotakashi | 0:8fdf9a60065b | 116 | |
kadonotakashi | 0:8fdf9a60065b | 117 | uint32_t efc_init(Efc *p_efc, uint32_t ul_access_mode, uint32_t ul_fws); |
kadonotakashi | 0:8fdf9a60065b | 118 | #if (SAM4S || SAM4E || SAM4N || SAM4C || SAMG || SAM4CP || SAM4CM || \ |
kadonotakashi | 0:8fdf9a60065b | 119 | SAMV71 || SAMV70 || SAMS70 || SAME70) |
kadonotakashi | 0:8fdf9a60065b | 120 | void efc_enable_cloe(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 121 | void efc_disable_cloe(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 122 | #endif |
kadonotakashi | 0:8fdf9a60065b | 123 | void efc_enable_frdy_interrupt(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 124 | void efc_disable_frdy_interrupt(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 125 | #if (SAMV71 || SAMV70 || SAMS70 || SAME70) |
kadonotakashi | 0:8fdf9a60065b | 126 | void efc_enable_write_protection(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 127 | void efc_disable_write_protection(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 128 | #else |
kadonotakashi | 0:8fdf9a60065b | 129 | void efc_set_flash_access_mode(Efc *p_efc, uint32_t ul_mode); |
kadonotakashi | 0:8fdf9a60065b | 130 | uint32_t efc_get_flash_access_mode(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 131 | #endif |
kadonotakashi | 0:8fdf9a60065b | 132 | void efc_set_wait_state(Efc *p_efc, uint32_t ul_fws); |
kadonotakashi | 0:8fdf9a60065b | 133 | uint32_t efc_get_wait_state(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 134 | uint32_t efc_perform_command(Efc *p_efc, uint32_t ul_command, |
kadonotakashi | 0:8fdf9a60065b | 135 | uint32_t ul_argument); |
kadonotakashi | 0:8fdf9a60065b | 136 | uint32_t efc_get_status(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 137 | uint32_t efc_get_result(Efc *p_efc); |
kadonotakashi | 0:8fdf9a60065b | 138 | uint32_t efc_perform_read_sequence(Efc *p_efc, |
kadonotakashi | 0:8fdf9a60065b | 139 | uint32_t ul_cmd_st, uint32_t ul_cmd_sp, |
kadonotakashi | 0:8fdf9a60065b | 140 | uint32_t *p_ul_buf, uint32_t ul_size); |
kadonotakashi | 0:8fdf9a60065b | 141 | |
kadonotakashi | 0:8fdf9a60065b | 142 | /// @cond 0 |
kadonotakashi | 0:8fdf9a60065b | 143 | /**INDENT-OFF**/ |
kadonotakashi | 0:8fdf9a60065b | 144 | #ifdef __cplusplus |
kadonotakashi | 0:8fdf9a60065b | 145 | } |
kadonotakashi | 0:8fdf9a60065b | 146 | #endif |
kadonotakashi | 0:8fdf9a60065b | 147 | /**INDENT-ON**/ |
kadonotakashi | 0:8fdf9a60065b | 148 | /// @endcond |
kadonotakashi | 0:8fdf9a60065b | 149 | |
kadonotakashi | 0:8fdf9a60065b | 150 | #endif /* EFC_H_INCLUDED */ |