]> git.sur5r.net Git - openocd/blobdiff - src/flash/nor/stellaris.c
flash: Constify write buffer
[openocd] / src / flash / nor / stellaris.c
index b167fb78c5f35f18e71b14308346c61dda6444d5..7665ab38a9611479d720091d9b18fa2276dd9544 100644 (file)
@@ -18,7 +18,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
  ***************************************************************************/
 
 /***************************************************************************
@@ -124,8 +124,8 @@ struct stellaris_flash_bank {
 };
 
 /* Autogenerated by contrib/gen-stellaris-part-header.pl */
-/* From Stellaris Firmware Development Package revision 8049 */
-static struct {
+/* From Stellaris Firmware Development Package revision 9453 */
+static const struct {
        uint8_t class;
        uint8_t partno;
        const char *partname;
@@ -189,7 +189,6 @@ static struct {
        {0x04, 0xC9, "LM3S1R26"},
        {0x04, 0x30, "LM3S1W16"},
        {0x04, 0x2F, "LM3S1Z16"},
-       {0x01, 0xD4, "LM3S2016"},
        {0x01, 0x51, "LM3S2110"},
        {0x01, 0x84, "LM3S2139"},
        {0x03, 0x39, "LM3S2276"},
@@ -301,9 +300,7 @@ static struct {
        {0x01, 0x8B, "LM3S6637"},
        {0x01, 0xA3, "LM3S6730"},
        {0x01, 0x77, "LM3S6753"},
-       {0x01, 0xD1, "LM3S6816"},
        {0x01, 0xE9, "LM3S6911"},
-       {0x01, 0xD3, "LM3S6916"},
        {0x01, 0xE8, "LM3S6918"},
        {0x01, 0x89, "LM3S6938"},
        {0x01, 0x72, "LM3S6950"},
@@ -350,11 +347,9 @@ static struct {
        {0x04, 0x1E, "LM3S9BN5"},
        {0x04, 0x1F, "LM3S9BN6"},
        {0x06, 0x70, "LM3S9C97"},
-       {0x06, 0x7A, "LM3S9CN5"},
        {0x06, 0xA9, "LM3S9D81"},
        {0x06, 0x7E, "LM3S9D90"},
        {0x06, 0x92, "LM3S9D92"},
-       {0x06, 0xC8, "LM3S9D95"},
        {0x06, 0x9D, "LM3S9D96"},
        {0x06, 0x7B, "LM3S9DN5"},
        {0x06, 0x7C, "LM3S9DN6"},
@@ -365,7 +360,6 @@ static struct {
        {0x06, 0xA8, "LM3S9U81"},
        {0x06, 0x7D, "LM3S9U90"},
        {0x06, 0x90, "LM3S9U92"},
-       {0x06, 0xB7, "LM3S9U95"},
        {0x06, 0x9B, "LM3S9U96"},
        {0x05, 0x18, "LM4F110B2QR"},
        {0x05, 0x19, "LM4F110C4QR"},
@@ -401,6 +395,13 @@ static struct {
        {0x05, 0x60, "LM4F132E5QC"},
        {0x05, 0x61, "LM4F132H5QC"},
        {0x05, 0x65, "LM4F132H5QD"},
+       {0x05, 0x70, "LM4F210E5QR"},
+       {0x05, 0x73, "LM4F210H5QR"},
+       {0x05, 0x80, "LM4F211E5QR"},
+       {0x05, 0x83, "LM4F211H5QR"},
+       {0x05, 0xE9, "LM4F212H5BB"},
+       {0x05, 0xC4, "LM4F212H5QC"},
+       {0x05, 0xC6, "LM4F212H5QD"},
        {0x05, 0xA0, "LM4F230E5QR"},
        {0x05, 0xA1, "LM4F230H5QR"},
        {0x05, 0xB0, "LM4F231E5QR"},
@@ -410,12 +411,13 @@ static struct {
        {0x05, 0xC1, "LM4F232H5QC"},
        {0x05, 0xC5, "LM4F232H5QD"},
        {0x05, 0xE5, "LM4FS1AH5BB"},
+       {0x05, 0xEA, "LM4FS1GH5BB"},
        {0x05, 0xE4, "LM4FS99H5BB"},
-       {0x05, 0xE0, "LM4FSXAH5BB"},
+       {0x05, 0xE1, "LM4FSXLH5BB"},
        {0xFF, 0x00, "Unknown Part"}
 };
 
-static char *StellarisClassname[7] = {
+static const char *StellarisClassname[7] = {
        "Sandstorm",
        "Fury",
        "Unknown",
@@ -995,7 +997,7 @@ static const uint8_t stellaris_write_code[] = {
        0x01, 0x00, 0x42, 0xA4  /* .word        0xA4420001 */
 };
 static int stellaris_write_block(struct flash_bank *bank,
-               uint8_t *buffer, uint32_t offset, uint32_t wcount)
+               const uint8_t *buffer, uint32_t offset, uint32_t wcount)
 {
        struct target *target = bank->target;
        uint32_t buffer_size = 16384;
@@ -1031,8 +1033,7 @@ static int stellaris_write_block(struct flash_bank *bank,
        while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) {
                buffer_size /= 2;
                if (buffer_size <= buf_min) {
-                       if (write_algorithm)
-                               target_free_working_area(target, write_algorithm);
+                       target_free_working_area(target, write_algorithm);
                        return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
                }
                LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)",
@@ -1041,10 +1042,10 @@ static int stellaris_write_block(struct flash_bank *bank,
 
        target_write_buffer(target, write_algorithm->address,
                        sizeof(stellaris_write_code),
-                       (uint8_t *) stellaris_write_code);
+                       stellaris_write_code);
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARMV7M_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
@@ -1077,7 +1078,7 @@ static int stellaris_write_block(struct flash_bank *bank,
        return retval;
 }
 
-static int stellaris_write(struct flash_bank *bank, uint8_t *buffer,
+static int stellaris_write(struct flash_bank *bank, const uint8_t *buffer,
                uint32_t offset, uint32_t count)
 {
        struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
@@ -1398,7 +1399,7 @@ struct flash_driver stellaris_flash = {
        .read = default_flash_read,
        .probe = stellaris_probe,
        .auto_probe = stellaris_probe,
-       .erase_check = default_flash_mem_blank_check,
+       .erase_check = default_flash_blank_check,
        .protect_check = stellaris_protect_check,
        .info = get_stellaris_info,
 };