1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

libatrf: new function atrf_identify to identify the chip

- tools/lib/atrf.h, tools/lib/atrf.c (atrf_identify): added chip
  identification function to library
- tools/atrf-id/atrf-id.c (show_info): print information returned by
  atrf_identify
- tools/atrf-id/atrf-id.c (show_info): decode JEDEC manufacturer ID
This commit is contained in:
Werner Almesberger
2011-01-07 12:35:51 -03:00
parent 4ef7a829c2
commit a9321cea7c
3 changed files with 66 additions and 5 deletions

View File

@@ -1,8 +1,8 @@
/*
* lib/atrf.c - ATRF access functions library
*
* Written 2010 by Werner Almesberger
* Copyright 2010 Werner Almesberger
* Written 2010-2011 by Werner Almesberger
* Copyright 2010-2011 Werner Almesberger
*
* 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
@@ -14,6 +14,8 @@
#include <stdlib.h>
#include <stdio.h>
#include "at86rf230.h"
#include "driver.h"
#include "atrf.h"
@@ -99,6 +101,37 @@ void atrf_reset_rf(struct atrf_dsc *dsc)
}
enum atrf_chip_id atrf_identify(struct atrf_dsc *dsc)
{
uint8_t part, version;
part = atrf_reg_read(dsc, REG_PART_NUM);
version = atrf_reg_read(dsc, REG_VERSION_NUM);
switch (part) {
case 2: /* AT86RF230 */
switch (version) {
case 1: /* rev A */
case 2: /* rev B */
return artf_at86rf230;
default:
return atrf_unknown_chip;
}
break;
case 3: /* AT86RF231 */
switch (version) {
case 2: /* rev A */
return artf_at86rf231;
default:
return atrf_unknown_chip;
}
break;
default:
return atrf_unknown_chip;
}
return atrf_unknown_chip;
}
int atrf_test_mode(struct atrf_dsc *dsc)
{
if (!dsc->driver->test_mode)