fet: implemented magic table for FW ver. 20404000
This commit is contained in:
parent
731a1e8b39
commit
6fa975277b
134
fet.c
134
fet.c
|
@ -777,33 +777,30 @@ const static struct device fet_device = {
|
|||
.writemem = fet_writemem
|
||||
};
|
||||
|
||||
static const u_int8_t rf2500_29_magic[] = {
|
||||
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
|
||||
#define MAGIC_DATA_SIZE 0x4a
|
||||
#define MAGIC_PARAM_COUNT 3
|
||||
|
||||
#define MAGIC_SEND_29 0x01
|
||||
#define MAGIC_SEND_2B 0x02
|
||||
|
||||
struct magic_record {
|
||||
int min_version;
|
||||
int flags;
|
||||
u_int32_t param_29[MAGIC_PARAM_COUNT];
|
||||
const u_int8_t data_29[MAGIC_DATA_SIZE];
|
||||
const u_int8_t data_2b[MAGIC_DATA_SIZE];
|
||||
};
|
||||
|
||||
static const u_int8_t chronos_2b_magic[] = {
|
||||
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
|
||||
};
|
||||
|
||||
static const u_int8_t chronos_29_magic[] = {
|
||||
/* The first entry in this table whose version exceeds the version
|
||||
* reported by the FET is used. Therefore, it must be kept in descending
|
||||
* order of version.
|
||||
*/
|
||||
const static struct magic_record magic_table[] = {
|
||||
{ /* TI Chronos */
|
||||
.min_version = 30001000,
|
||||
.flags = MAGIC_SEND_29 | MAGIC_SEND_2B,
|
||||
.param_29 = {0x77, 0x6f, 0x4a},
|
||||
.data_29 = {
|
||||
0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x18,
|
||||
0xff, 0x19, 0x80, 0x00, 0x00, 0x1c, 0xff, 0x2b,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
|
||||
|
@ -814,31 +811,94 @@ static const u_int8_t chronos_29_magic[] = {
|
|||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff
|
||||
},
|
||||
.data_2b = {
|
||||
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
|
||||
}
|
||||
},
|
||||
{ /* RF2500 */
|
||||
.min_version = 30000000,
|
||||
.flags = MAGIC_SEND_29,
|
||||
.param_29 = {0, 0x39, 0x31},
|
||||
.data_29 = {
|
||||
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
|
||||
}
|
||||
},
|
||||
{ /* FET430UIF */
|
||||
.min_version = 20404000,
|
||||
.flags = MAGIC_SEND_29 | MAGIC_SEND_2B,
|
||||
.param_29 = {0, 7, 7},
|
||||
.data_29 = {
|
||||
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
|
||||
},
|
||||
.data_2b = {
|
||||
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
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static int do_magic(void)
|
||||
{
|
||||
if (fet_version >= 30001000) {
|
||||
printf("Sending Chronos init messages...\n");
|
||||
int i;
|
||||
|
||||
if (xfer(0x2b, chronos_2b_magic,
|
||||
sizeof(chronos_2b_magic), 0) < 0) {
|
||||
for (i = 0; i < ARRAY_LEN(magic_table); i++) {
|
||||
const struct magic_record *r = &magic_table[i];
|
||||
|
||||
if (fet_version >= r->min_version) {
|
||||
printf("Sending magic messages for >= %d\n",
|
||||
r->min_version);
|
||||
|
||||
if ((r->flags & MAGIC_SEND_2B) &&
|
||||
xfer(0x2b, r->data_2b, MAGIC_DATA_SIZE, 0) < 0) {
|
||||
fprintf(stderr, "fet: command 0x2b failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (xfer(0x29, chronos_29_magic,
|
||||
sizeof(chronos_29_magic), 3, 0x77, 0x6f, 0x4a) < 0) {
|
||||
if ((r->flags & MAGIC_SEND_29) &&
|
||||
xfer(0x29, r->data_29, MAGIC_DATA_SIZE,
|
||||
3, r->param_29[0], r->param_29[1],
|
||||
r->param_29[2]) < 0) {
|
||||
fprintf(stderr, "fet: command 0x29 failed\n");
|
||||
return -1;
|
||||
}
|
||||
} else if (fet_version >= 30000000) {
|
||||
printf("Sending RF2500 init messages...\n");
|
||||
|
||||
if (xfer(0x29, rf2500_29_magic,
|
||||
sizeof(rf2500_29_magic), 3, 0, 0x39, 0x31) < 0) {
|
||||
fprintf(stderr, "fet: command 0x29 failed\n");
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue