mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 09:23:35 +08:00
boards: update id string from V5X{0-a}{0-a} to V5X{xxxx}{xxxx}
boards: new format for hwtypecmp string boards: update manifest.c to follow the new hw_ver_rev format
This commit is contained in:
@@ -262,7 +262,7 @@
|
||||
|
||||
#if defined(BOARD_HAS_HW_VERSIONING)
|
||||
# define BOARD_HAS_VERSIONING 1
|
||||
# define HW_VER_REV(v,r) ((uint32_t)((v) & 0xff) << 8) | ((uint32_t)(r) & 0xff)
|
||||
# define HW_VER_REV(v,r) ((uint32_t)((v) & 0xffff) << 16) | ((uint32_t)(r) & 0xffff)
|
||||
#endif
|
||||
|
||||
/* Default LED logical to color mapping */
|
||||
|
||||
@@ -52,12 +52,15 @@
|
||||
# define GPIO_HW_REV_DRIVE GPIO_HW_VER_REV_DRIVE
|
||||
# define GPIO_HW_VER_DRIVE GPIO_HW_VER_REV_DRIVE
|
||||
# endif
|
||||
|
||||
#define HW_INFO_SIZE 20 //<! Size to fit hw_info string
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
static int hw_version = 0;
|
||||
static int hw_revision = 0;
|
||||
static char hw_info[] = HW_INFO_INIT;
|
||||
static char hw_info[HW_INFO_SIZE] = {0};
|
||||
|
||||
/****************************************************************************
|
||||
* Protected Functions
|
||||
@@ -338,8 +341,16 @@ int board_determine_hw_info()
|
||||
int rv = determine_hw_info(&hw_revision, &hw_version);
|
||||
|
||||
if (rv == OK) {
|
||||
hw_info[HW_INFO_INIT_REV] = board_get_hw_revision() + '0';
|
||||
hw_info[HW_INFO_INIT_VER] = board_get_hw_version() + '0';
|
||||
|
||||
if (rv == OK) {
|
||||
|
||||
int hw_info_size = snprintf(hw_info, HW_INFO_SIZE, HW_INFO_INIT, hw_version, hw_revision);
|
||||
|
||||
if ((hw_info_size < 0) || (hw_info_size >= HW_INFO_SIZE)) {
|
||||
printf("[boot] Error, hw_info string hasn't been completely written\n");
|
||||
rv = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
@@ -56,12 +56,15 @@
|
||||
# define GPIO_HW_REV_DRIVE GPIO_HW_VER_REV_DRIVE
|
||||
# define GPIO_HW_VER_DRIVE GPIO_HW_VER_REV_DRIVE
|
||||
# endif
|
||||
|
||||
#define HW_INFO_SIZE 20 //<! Size to fit hw_info string
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
static int hw_version = 0;
|
||||
static int hw_revision = 0;
|
||||
static char hw_info[] = HW_INFO_INIT;
|
||||
static char hw_info[HW_INFO_SIZE] = {0};
|
||||
|
||||
static const uint16_t mtd_mft_version = MTD_MFT_v0; //< Current version of structure in EEPROM
|
||||
static const char *mtd_mft_path = "/fs/mtd_mft";
|
||||
@@ -443,16 +446,31 @@ __EXPORT int board_get_hw_revision()
|
||||
|
||||
int board_determine_hw_info()
|
||||
{
|
||||
// ADC hw version range: {0x1 - 0xF}
|
||||
int rv = determine_hw_info(&hw_revision, &hw_version);
|
||||
|
||||
if (rv == OK) {
|
||||
|
||||
hw_info[HW_INFO_INIT_REV] = board_get_hw_revision() < 10 ?
|
||||
board_get_hw_revision() + '0' :
|
||||
board_get_hw_revision() + 'a' - 10;
|
||||
hw_info[HW_INFO_INIT_VER] = board_get_hw_version() < 10 ?
|
||||
board_get_hw_version() + '0' :
|
||||
board_get_hw_version() + 'a' - 10;
|
||||
/* EEPROM hw version range: {0x10 - 0xFFFF} */
|
||||
if (hw_version == HW_VERSION_EEPROM) {
|
||||
|
||||
mtd_mft_t mtd_mft;
|
||||
rv = board_get_eeprom_hw_info(&mtd_mft);
|
||||
|
||||
if (rv == OK) {
|
||||
hw_version = mtd_mft.hw_extended_ver;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rv == OK) {
|
||||
|
||||
int hw_info_size = snprintf(hw_info, HW_INFO_SIZE, HW_INFO_INIT, hw_version, hw_revision);
|
||||
|
||||
if ((hw_info_size < 0) || (hw_info_size >= HW_INFO_SIZE)) {
|
||||
printf("[boot] Error, hw_info string hasn't been completely written\n");
|
||||
rv = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
Reference in New Issue
Block a user