mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 07:09:48 +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_defines.h>
|
||||
|
||||
/* Define any issues with the Silicon as lines separated by \n
|
||||
* omitting the last \n
|
||||
*/
|
||||
#define ERRATA "This code is not finished yet!"
|
||||
#include "up_arch.h"
|
||||
#include "chip/kinetis_sim.h"
|
||||
|
||||
#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)
|
||||
{
|
||||
*rev = '?';
|
||||
*revstr = "Kinetis K??";
|
||||
uint32_t sim_sdid = getreg32(KINETIS_SIM_SDID);
|
||||
static char chip[sizeof(CHIP_TAG)] = CHIP_TAG;
|
||||
|
||||
if (errata) {
|
||||
*errata = ERRATA;
|
||||
}
|
||||
chip[CHIP_TAG_LEN - 2] = '0' + ((sim_sdid & SIM_SDID_FAMILYID_MASK) >> SIM_SDID_FAMILYID_SHIFT);
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user