1 /* 2 * ArmSpecialFlashMemoryAccess.h 3 * 4 * Memory class for accessing RAM on ARM Cortex devices. 5 * 6 * Copyright (C) 2007 - 2015 Texas Instruments Incorporated - http://www.ti.com/ 7 * 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 13 * Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 16 * Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the 19 * distribution. 20 * 21 * Neither the name of Texas Instruments Incorporated nor the names of 22 * its contributors may be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38 #pragma once 39 40 #include "ArmFlashMemoryAccess.h" 41 42 namespace TI 43 { 44 namespace DLL430 45 { 46 class IDeviceHandle; 47 class ArmBslFlashMemoryAccess : public ArmFlashMemoryAccess 48 { 49 public: 50 ArmBslFlashMemoryAccess( 51 MemoryArea::Name name, 52 IDeviceHandle* devHandle, 53 uint32_t start, 54 uint32_t size, 55 uint32_t seg, 56 uint32_t banks, 57 bool mapped, 58 const bool isProtected, 59 IMemoryManager* mm, 60 uint8_t psa); 61 virtual ~ArmBslFlashMemoryAccess(); 62 63 virtual bool doWrite(uint32_t address, const uint8_t* buffer, size_t count) OVERRIDE; 64 virtual bool erase(uint32_t start, uint32_t end, bool forceUnlock = false) OVERRIDE; 65 virtual bool erase() OVERRIDE; 66 67 private: 68 uint32_t start; 69 uint32_t end; 70 }; 71 72 class ArmInfoFlashMemoryAccess : public ArmFlashMemoryAccess 73 { 74 public: 75 ArmInfoFlashMemoryAccess( 76 MemoryArea::Name name, 77 IDeviceHandle* devHandle, 78 uint32_t start, 79 uint32_t size, 80 uint32_t seg, 81 uint32_t banks, 82 bool mapped, 83 const bool isProtected, 84 IMemoryManager* mm, 85 uint8_t psa 86 ); 87 virtual ~ArmInfoFlashMemoryAccess(); 88 89 virtual bool erase() OVERRIDE; 90 91 private: 92 uint32_t start; 93 uint32_t end; 94 }; 95 96 // MSP32 P4111 special hanlding 97 class ArmFlashMemoryAccess2M : public ArmFlashMemoryAccess 98 { 99 public: 100 ArmFlashMemoryAccess2M( 101 MemoryArea::Name name, 102 IDeviceHandle* devHandle, 103 uint32_t start, 104 uint32_t size, 105 uint32_t seg, 106 uint32_t banks, 107 bool mapped, 108 const bool isProtected, 109 IMemoryManager* mm, 110 uint8_t psa, 111 IWriteProtection *writeProt 112 ); 113 virtual ~ArmFlashMemoryAccess2M(); 114 115 virtual bool wakeup() OVERRIDE; 116 117 private: 118 }; 119 120 121 class ArmBslFlashMemoryAccess2M : public ArmFlashMemoryAccess2M 122 { 123 public: 124 ArmBslFlashMemoryAccess2M( 125 MemoryArea::Name name, 126 IDeviceHandle* devHandle, 127 uint32_t start, 128 uint32_t size, 129 uint32_t seg, 130 uint32_t banks, 131 bool mapped, 132 const bool isProtected, 133 IMemoryManager* mm, 134 uint8_t psa); 135 virtual ~ArmBslFlashMemoryAccess2M(); 136 137 virtual bool doWrite(uint32_t address, const uint8_t* buffer, size_t count) OVERRIDE; 138 virtual bool erase(uint32_t start, uint32_t end, bool forceUnlock = false) OVERRIDE; 139 virtual bool erase() OVERRIDE; 140 141 private: 142 uint32_t start; 143 uint32_t end; 144 }; 145 146 class ArmInfoFlashMemoryAccess2M : public ArmFlashMemoryAccess2M 147 { 148 public: 149 ArmInfoFlashMemoryAccess2M( 150 MemoryArea::Name name, 151 IDeviceHandle* devHandle, 152 uint32_t start, 153 uint32_t size, 154 uint32_t seg, 155 uint32_t banks, 156 bool mapped, 157 const bool isProtected, 158 IMemoryManager* mm, 159 uint8_t psa 160 ); 161 virtual ~ArmInfoFlashMemoryAccess2M(); 162 virtual bool erase() OVERRIDE; 163 164 private: 165 uint32_t start; 166 uint32_t end; 167 }; 168 } 169 } 170