📄 devices.c
字号:
/*==========================================================================*\
| |
| Devices.c |
| |
| The file contains functions to distinguish MSP430 devices concerning |
| FLASH programming. |
|----------------------------------------------------------------------------|
| Project: MSP430 Replicator |
| Developed using: IAR Embedded Workbench 3.40B [Kickstart] |
|----------------------------------------------------------------------------|
| Author: STO |
| Version: 1.0 |
| Initial Version: 02-09-06 |
| Last Change: __-__-__ |
|----------------------------------------------------------------------------|
| Version history: |
| 1.0 02/06 STO Initial version. |
|----------------------------------------------------------------------------|
| Designed 2005 by Texas Instruments Germany |
\*==========================================================================*/
#include "Devices.h"
static word DeviceIdx = 0; // This variable that holds the device
// index used to determine family & part
// number. The ID of device is at memory
// location 0x0FF0h on all MSP430 flash devices.
// In this application, the device ID is
// used to determine the JTAG pin
// configuration (dedicated vs. shared)
// of the target device.
struct tsDeviceFeatures {
word Id;
bool TestPin;
bool CpuX;
bool DataQuick;
bool FastFlash;
bool EnhVerify;
bool JTAG;
bool SpyBiWire;
};
static const struct tsDeviceFeatures sDeviceFeatures[] =
{
// TestPin DataQuick EnhVerify SpyBiWire
// Id | CpuX | FastFlash | JTAG |
// | | | | | | | |
/* F13x
F14x */ { 0xF149, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F15x
F16x */ { 0xF169, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F161x */ { 0xF16C, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F11x(1)(A)*/ { 0xF112, TRUE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F11x2 */ { 0x1132, TRUE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F12x(A) */ { 0xF123, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE , FALSE },
/* F12x2 */ { 0x1232, TRUE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F20xx */ { 0xF201, TRUE, FALSE, TRUE , TRUE, FALSE, TRUE , TRUE },
/* F21x1 */ { 0xF213, TRUE, FALSE, TRUE , TRUE, FALSE, TRUE , FALSE },
/* F22x4 */ { 0xF227, TRUE, FALSE, TRUE , TRUE, TRUE, TRUE , TRUE },
/* F41x */ { 0xF413, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE , FALSE },
/* F42x(x) */ { 0xF427, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F43x 80p */ { 0xF437, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* FG43x */ { 0xF439, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* F44x
F43x 100p */ { 0xF449, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE },
/* FG461x */ { 0xF46F, FALSE, TRUE, TRUE , TRUE, TRUE, TRUE , FALSE },
/* GENERIC */ { 0xFFFF, FALSE, FALSE, TRUE , FALSE, FALSE, TRUE , FALSE }
};
void SetDevice (word wDeviceId)
{
for(DeviceIdx = 0; DeviceIdx < (sizeof(sDeviceFeatures)/sizeof(*sDeviceFeatures)); DeviceIdx++)
{
if(sDeviceFeatures[DeviceIdx].Id == wDeviceId)
{
break;
}
}
}
bool DeviceHas_TestPin(void)
{
return (sDeviceFeatures[DeviceIdx].TestPin);
}
bool DeviceHas_CpuX(void)
{
return (sDeviceFeatures[DeviceIdx].CpuX);
}
bool DeviceHas_DataQuick(void)
{
return (sDeviceFeatures[DeviceIdx].DataQuick);
}
bool DeviceHas_FastFlash(void)
{
return (sDeviceFeatures[DeviceIdx].FastFlash);
}
bool DeviceHas_EnhVerify(void)
{
return (sDeviceFeatures[DeviceIdx].EnhVerify);
}
bool DeviceHas_JTAG(void)
{
return (sDeviceFeatures[DeviceIdx].JTAG);
}
bool DeviceHas_SpyBiWire(void)
{
return (sDeviceFeatures[DeviceIdx].SpyBiWire);
}
/****************************************************************************/
/* END OF SOURCE FILE */
/****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -