mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 10:17:45 +08:00
kinetis:Add MCU version decoding
This commit is contained in:
committed by
Daniel Agar
parent
f0c981312f
commit
d466a09708
@@ -40,20 +40,22 @@
|
|||||||
#include <px4_config.h>
|
#include <px4_config.h>
|
||||||
#include <px4_defines.h>
|
#include <px4_defines.h>
|
||||||
|
|
||||||
/* Define any issues with the Silicon as lines separated by \n
|
#include "up_arch.h"
|
||||||
* omitting the last \n
|
#include "chip/kinetis_sim.h"
|
||||||
*/
|
|
||||||
#define ERRATA "This code is not finished yet!"
|
|
||||||
|
|
||||||
|
#define CHIP_TAG "Kinetis K??"
|
||||||
|
#define CHIP_TAG_LEN sizeof(CHIP_TAG)-1
|
||||||
|
|
||||||
int board_mcu_version(char *rev, const char **revstr, const char **errata)
|
int board_mcu_version(char *rev, const char **revstr, const char **errata)
|
||||||
{
|
{
|
||||||
*rev = '?';
|
uint32_t sim_sdid = getreg32(KINETIS_SIM_SDID);
|
||||||
*revstr = "Kinetis K??";
|
static char chip[sizeof(CHIP_TAG)] = CHIP_TAG;
|
||||||
|
|
||||||
if (errata) {
|
chip[CHIP_TAG_LEN - 2] = '0' + ((sim_sdid & SIM_SDID_FAMILYID_MASK) >> SIM_SDID_FAMILYID_SHIFT);
|
||||||
*errata = ERRATA;
|
chip[CHIP_TAG_LEN - 1] = '0' + ((sim_sdid & SIM_SDID_SUBFAMID_MASK) >> SIM_SDID_SUBFAMID_SHIFT);
|
||||||
}
|
*revstr = chip;
|
||||||
|
*rev = '0' + ((sim_sdid & SIM_SDID_REVID_MASK) >> SIM_SDID_REVID_SHIFT);
|
||||||
|
*errata = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user