/***************************************************************************
* Copyright (C) 2006 by Magnus Lundin *
* lundin@mlu.mine.nu *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* 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. *
***************************************************************************/
/***************************************************************************
* STELLARIS is tested on LM3S811, LM3S6965
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "replacements.h"
#include "stellaris.h"
#include "cortex_m3.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "binarybuffer.h"
#include "types.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DID0_VER(did0) ((did0>>28)&0x07)
int stellaris_register_commands(struct command_context_s *cmd_ctx);
int stellaris_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int stellaris_erase(struct flash_bank_s *bank, int first, int last);
int stellaris_protect(struct flash_bank_s *bank, int set, int first, int last);
int stellaris_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int stellaris_auto_probe(struct flash_bank_s *bank);
int stellaris_probe(struct flash_bank_s *bank);
int stellaris_protect_check(struct flash_bank_s *bank);
int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size);
int stellaris_read_part_info(struct flash_bank_s *bank);
u32 stellaris_get_flash_status(flash_bank_t *bank);
void stellaris_set_flash_mode(flash_bank_t *bank,int mode);
u32 stellaris_wait_status_busy(flash_bank_t *bank, u32 waitbits, int timeout);
int stellaris_read_part_info(struct flash_bank_s *bank);
int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int stellaris_mass_erase(struct flash_bank_s *bank);
flash_driver_t stellaris_flash =
{
.name = "stellaris",
.register_commands = stellaris_register_commands,
.flash_bank_command = stellaris_flash_bank_command,
.erase = stellaris_erase,
.protect = stellaris_protect,
.write = stellaris_write,
.probe = stellaris_probe,
.auto_probe = stellaris_auto_probe,
.erase_check = default_flash_mem_blank_check,
.protect_check = stellaris_protect_check,
.info = stellaris_info
};
struct {
u32 partno;
char *partname;
} StellarisParts[] =
{
{0x01,"LM3S101"},
{0x02,"LM3S102"},
{0x03,"LM3S1625"},
{0x04,"LM3S1626"},
{0x05,"LM3S1627"},
{0x06,"LM3S1607"},
{0x10,"LM3S1776"},
{0x19,"LM3S300"},
{0x11,"LM3S301"},
{0x12,"LM3S310"},
{0x1A,"LM3S308"},
{0x13,"LM3S315"},
{0x14,"LM3S316"},
{0x17,"LM3S317"},
{0x18,"LM3S318"},
{0x15,"LM3S328"},
{0x2A,"LM3S600"},
{0x21,"LM3S601"},
{0x2B,"LM3S608"},
{0x22,"LM3S610"},
{0x23,"LM3S611"},
{0x24,"LM3S612"},
{0x25,"LM3S613"},
{0x26,"LM3S615"},
{0x28,"LM3S617"},
{0x29,"LM3S618"},
{0x27,"LM3S628"},
{0x38,"LM3S800"},
{0x31,"LM3S801"},
{0x39,"LM3S808"},
{0x32,"LM3S811"},
{0x33,"LM3S812"},
/*{0x33,"LM3S2616"},*/
{0x34,"LM3S815"},
{0x36,"LM3S817"},
{0x37,"LM3S818"},
{0x35,"LM3S828"},
{0x39,"LM3S2276"},
{0x3A,"LM3S2776"},
{0x43,"LM3S3651"},
{0x44,"LM3S3739"},
{0x45,"LM3S3749"},
{0x46,"LM3S3759"},
{0x48,"LM3S3768"},
{0x49,"LM3S3748"},
{0x50,"LM3S2678"},
{0x51,"LM3S2110"},
{0x52,"LM3S2739"},
{