blob: 99c578dc4b0f178bc732720f8f0db1fcd364d641 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#include "Logger.hpp"
#include "McuSt10f269.hpp"
#include "fw_st10f269.hpp"
using FwSt10f269::fw_st10f269;
using FwSt10f269::fw_st10f269_length;
#define ST10F269_FLASH_SIZE (256 * 1024)
#define ST10F269_IDMANUF 0x0401
#define ST10F269_IDCHIP 0x10D0
#define ST10F269_ERASE_TIMEOUT 15000 // Ms
#define RET_ERASE_ERROR 0x030
#define RET_WRITE_ERROR 0x031
bool
CMcuSt10f269::hasThisId(uint16_t idmanuf, uint16_t idchip)
{
// Mask out revision bits 3 - 0 from idchip value
return ((idmanuf == ST10F269_IDMANUF)
&& ((idchip & 0xfff0) == ST10F269_IDCHIP));
}
CMcuSt10f269::CMcuSt10f269()
{
mBlockSizes.push_back(16);
mBlockSizes.push_back(8);
mBlockSizes.push_back(8);
mBlockSizes.push_back(32);
mBlockSizes.push_back(64);
mBlockSizes.push_back(64);
mBlockSizes.push_back(64);
}
CMcuSt10f269::~CMcuSt10f269()
{
;
}
string
CMcuSt10f269::getName()
{
return string("ST10F269");
}
uint8_t *
CMcuSt10f269::getFirmware()
{
return fw_st10f269;
}
int
CMcuSt10f269::getFirmwareLength()
{
return fw_st10f269_length;
}
const list<uint32_t>
CMcuSt10f269::getBlockSizes()
{
return mBlockSizes;
}
uint32_t
CMcuSt10f269::getFlashSize()
{
return ST10F269_FLASH_SIZE;
}
int
CMcuSt10f269::getEraseTimeout()
{
return ST10F269_ERASE_TIMEOUT;
}
string
CMcuSt10f269::getMessageForRetCode(uint16_t ret)
{
string s;
switch (ret) {
case RET_ERASE_ERROR:
s = "Error while erasing memory";
break;
case RET_WRITE_ERROR:
s = "Error while writing memory";
break;
default:
s = "";
break;
}
return s;
}
const list<uint16_t>
CMcuSt10f269::getConfigData(float mcuFrequency)
{
list<uint16_t> ret;
ret.push_back(0x00); // Any byte value
return ret;
}
|