485 lines
16 KiB
C
485 lines
16 KiB
C
/* MSPDebug - debugging tool for MSP430 MCUs
|
|
* Copyright (C) 2009, 2010 Daniel Beer
|
|
*
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <string.h>
|
|
#include "fet_db.h"
|
|
#include "util.h"
|
|
|
|
static const struct fet_db_record fet_db[] = {
|
|
{
|
|
.name = "MSP430F147",
|
|
.msg28_data = {
|
|
0xf1, 0x49, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0xf0, 0x1a,
|
|
0x12, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x05, 0x05},
|
|
.msg29_data = {
|
|
0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10,
|
|
0xff, 0x10, 0x80, 0x00, 0x00, 0x02, 0xff, 0x05,
|
|
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
|
|
0x00, 0x00, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xf3, 0x30, 0xd3, 0x30,
|
|
0xc0, 0x30,
|
|
},
|
|
.msg2b_data = {
|
|
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00,
|
|
},
|
|
},
|
|
{
|
|
.name = "MSP430F148",
|
|
.msg28_data = {
|
|
0xf1, 0x49, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0xf0, 0x39,
|
|
0x11, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x06, 0x06},
|
|
.msg29_data = {
|
|
0x00, 0x40, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10,
|
|
0xff, 0x10, 0x80, 0x00, 0x00, 0x02, 0xff, 0x09,
|
|
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
|
|
0x00, 0x00, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xf3, 0x30, 0xd3, 0x30,
|
|
0xc0, 0x30
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x00,
|
|
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00,
|
|
}
|
|
},
|
|
{
|
|
.name = "MSP430F149",
|
|
.msg28_data = {
|
|
0xF1, 0x49, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0xF0, 0x1A,
|
|
0x10, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x07, 0x07},
|
|
.msg29_data = {
|
|
0x00, 0x11, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10,
|
|
0xff, 0x10, 0x80, 0x00, 0x00, 0x02, 0xff, 0x09,
|
|
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
|
|
0x00, 0x00, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xf3, 0x30, 0xd3, 0x30,
|
|
0xc0, 0x30
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x00,
|
|
0x03, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
},
|
|
},
|
|
{
|
|
.name = "MSP430F1611",
|
|
.msg28_data = {
|
|
0xF1, 0x6C, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x01, 0x61, 0x01, 0x00, 0xD1, 0x4D,
|
|
0x80, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x2a, 0x23},
|
|
.msg29_data = {
|
|
0x00, 0x40, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x10,
|
|
0xFF, 0x10, 0x80, 0x00, 0x00, 0x02, 0xFF, 0x09,
|
|
0x00, 0x11, 0xFF, 0x38, 0x08, 0x00, 0x03, 0x00,
|
|
0x02, 0x00, 0xD7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0E, 0xC4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xF3, 0x30, 0xD3, 0x30,
|
|
0xC0, 0x30
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x0C, 0xFF, 0x0F, 0x00, 0x02, 0x02, 0x00,
|
|
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
},
|
|
{
|
|
.name = "MSP430F249",
|
|
.msg28_data = {
|
|
0xF2, 0x49, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x02, 0x02, 0x01, 0x00, 0xF3, 0x2B,
|
|
0x80, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x4f, 0x47},
|
|
.msg29_data = {
|
|
0x00, 0x11, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x10,
|
|
0xFF, 0x10, 0x40, 0x00, 0x00, 0x02, 0xFF, 0x09,
|
|
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
|
|
0x02, 0x00, 0xD7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0E, 0xC4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1B, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x33, 0x0F, 0x1F, 0x0F,
|
|
0xFF, 0xFF
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x0C, 0xFF, 0x0F, 0x00, 0x02, 0x00, 0x00,
|
|
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
},
|
|
{
|
|
.name = "MSP430F2616",
|
|
.msg28_data = {
|
|
0xf2, 0x6f, 0x04, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x02, 0x12, 0x01, 0x00, 0xf5, 0x1d,
|
|
0x88, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x41, 0x39},
|
|
.msg29_data = {
|
|
0x00, 0x21, 0xff, 0xff, 0x01, 0x00, 0x00, 0x10,
|
|
0xff, 0x10, 0x40, 0x00, 0x00, 0x02, 0xff, 0x09,
|
|
0x00, 0x11, 0xff, 0x20, 0x08, 0x00, 0x03, 0x00,
|
|
0x02, 0x00, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x33, 0x0f, 0x1f, 0x0f,
|
|
0xff, 0xff
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x02, 0x00,
|
|
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
},
|
|
{
|
|
.name = "MSP430F5437A",
|
|
.msg28_data = {
|
|
0x04, 0x80, 0x11, 0x11, 0x08, 0x0a, 0x26, 0x87,
|
|
0xb4, 0x46, 0x18, 0x0c, 0xec, 0x0f, 0xf8, 0xfe,
|
|
0x30, 0x41
|
|
},
|
|
.msg29_params = {0x00, 0x5c, 0x54},
|
|
.msg29_data = {
|
|
0x00, 0x5c, 0xff, 0x5b, 0x04, 0x00, 0x00, 0x18,
|
|
0xff, 0x19, 0x80, 0x00, 0x00, 0x1c, 0xff, 0x5b,
|
|
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x03, 0x00,
|
|
0x02, 0x00, 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x02, 0x00,
|
|
0x0a, 0x00, 0x40, 0x00, 0x0a, 0x91, 0x8e, 0x9d,
|
|
0x00, 0x00, 0x28, 0x29, 0x2a, 0x2b, 0x80, 0xd8,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
},
|
|
},
|
|
{
|
|
.name = "MSP430F5438",
|
|
.msg28_data = {
|
|
0x54, 0x38, 0x10, 0x10, 0x08, 0x0a, 0x03, 0x05,
|
|
0xca, 0x47, 0x1a, 0x00, 0x19, 0x00, 0xf8, 0xfe,
|
|
0x00, 0x00,
|
|
},
|
|
.msg29_params = {0x00, 0x5c, 0x54},
|
|
.msg29_data = {
|
|
0x00, 0x5c, 0xff, 0x5b, 0x04, 0x00, 0x00, 0x18,
|
|
0xff, 0x19, 0x80, 0x00, 0x00, 0x1c, 0xff, 0x5b,
|
|
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x03, 0x00,
|
|
0x02, 0x00, 0x17, 0x04, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x02, 0x00,
|
|
0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
},
|
|
{
|
|
.name = "CC430F6137",
|
|
.msg28_data = {
|
|
0x61, 0x37, 0x10, 0x10, 0x08, 0x0a, 0xff, 0xff,
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
0x77, 0x7d
|
|
},
|
|
.msg29_params = {0x77, 0x6f, 0x4a},
|
|
.msg29_data = {
|
|
0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x18,
|
|
0xff, 0x19, 0x80, 0x00, 0x00, 0x1c, 0xff, 0x2b,
|
|
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
|
|
0x02, 0x00, 0x07, 0x24, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x01, 0x00,
|
|
0x04, 0x00, 0x40, 0x00, 0x0a, 0x91, 0x8e, 0x00,
|
|
0x00, 0xb0, 0x28, 0x29, 0x2a, 0x2b, 0x80, 0xd8,
|
|
0xa8, 0x60, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
},
|
|
{
|
|
.name = "MSP430F2274",
|
|
.msg28_data = {
|
|
0xf2, 0x27, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x02, 0x01, 0x01, 0x04, 0xb1, 0x62,
|
|
0x80, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x39, 0x31},
|
|
.msg29_data = {
|
|
0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10,
|
|
0xff, 0x10, 0x40, 0x00, 0x00, 0x02, 0xff, 0x05,
|
|
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x33, 0x0f, 0x1f, 0x0f,
|
|
0xff, 0xff
|
|
},
|
|
.msg2b_data = { /* Copied from MSP430F2616 */
|
|
0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x02, 0x00,
|
|
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
},
|
|
{
|
|
.name = "MSP430F2013",
|
|
.msg28_data = {
|
|
0xf2, 0x01, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00,
|
|
0x00, 0x00
|
|
},
|
|
.msg29_params = {0x00, 0x39, 0x31},
|
|
.msg29_data = { /* Copied from MSP430F2274 */
|
|
0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10,
|
|
0xff, 0x10, 0x40, 0x00, 0x00, 0x02, 0xff, 0x05,
|
|
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x33, 0x0f, 0x1f, 0x0f,
|
|
0xff, 0xff
|
|
},
|
|
.msg2b_data = { /* Copied from MSP430F2616 */
|
|
0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x02, 0x00,
|
|
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
},
|
|
{
|
|
.name = "MSP430F5438A",
|
|
.msg28_data = {
|
|
0x05, 0x80, 0x11, 0x11, 0x08, 0x0a, 0x85, 0x0f,
|
|
0xb0, 0x46, 0x20, 0x00, 0x0c, 0x00, 0xf8, 0xfe,
|
|
0x00, 0x00
|
|
/* extra bytes: 0x91, 0x03, 0x01, 0x00,
|
|
* 0x1a, 0x00, 0x04, 0x05
|
|
*/
|
|
},
|
|
.msg29_params = {0x00, 0x8c, 0x84},
|
|
.msg29_data = {
|
|
0x00, 0x5c, 0xff, 0x5b, 0x04, 0x00, 0x00, 0x18,
|
|
0xff, 0x19, 0x80, 0x00, 0x00, 0x1c, 0xff, 0x5b,
|
|
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x07, 0x00,
|
|
0x02, 0x00, 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17,
|
|
0x58, 0x1b, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff
|
|
},
|
|
.msg2b_data = {
|
|
0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x02, 0x00,
|
|
0x0a, 0x00, 0x40, 0x00, 0x0a, 0x91, 0x8e, 0x9d,
|
|
0x00, 0x00, 0x28, 0x29, 0x2a, 0x2b, 0x8a, 0xd8,
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
|
|
0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00
|
|
}
|
|
}
|
|
};
|
|
|
|
const struct fet_db_record *fet_db_find_by_msg28(uint8_t *data, int len)
|
|
{
|
|
int i;
|
|
int best_score = 0;
|
|
int best = -1;
|
|
|
|
if (len < 2)
|
|
return NULL;
|
|
|
|
if (len > FET_DB_MSG28_LEN)
|
|
len = FET_DB_MSG28_LEN;
|
|
|
|
for (i = 0; i < ARRAY_LEN(fet_db); i++) {
|
|
const struct fet_db_record *r = &fet_db[i];
|
|
|
|
if (r->msg28_data[0] == data[0] &&
|
|
r->msg28_data[1] == data[1]) {
|
|
int score = 0;
|
|
int j;
|
|
|
|
for (j = 0; j < len; j++)
|
|
if (r->msg28_data[j] == data[j])
|
|
score++;
|
|
|
|
if (best < 0 || score > best_score) {
|
|
best = i;
|
|
best_score = score;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (best >= 0)
|
|
return &fet_db[best];
|
|
|
|
return NULL;
|
|
}
|
|
|
|
const struct fet_db_record *fet_db_find_by_name(const char *name)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < ARRAY_LEN(fet_db); i++) {
|
|
const struct fet_db_record *r = &fet_db[i];
|
|
|
|
if (!strcasecmp(r->name, name))
|
|
return r;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
int fet_db_enum(fet_db_enum_func_t func, void *user_data)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < ARRAY_LEN(fet_db); i++)
|
|
if (func(user_data, &fet_db[i]) < 0)
|
|
return -1;
|
|
|
|
return 0;
|
|
}
|