Merge PR #19575 (changes to pr-extendend_hw_ver_rev_format)

- 4096 of 3 hex digits each for rev and ver is enough.
    #defines used in SPI versions do not be long format, use use the macro
 - Board provides a prefix and the formatting is sized and built in
 - No need for funky board_get_base_eeprom_mtd_manifest interface
    Original mft is used where the abstraction is done with the MFT interface

Co-authored-by: David Sidrane <David.Sidrane@Nscdg.com>
This commit is contained in:
Igor Mišić
2022-07-05 09:29:26 +02:00
committed by Beat Küng
co-authored by David Sidrane
parent f7d542e720
commit 4b503c310e
44 changed files with 199 additions and 188 deletions
@@ -32,9 +32,10 @@
****************************************************************************/
#pragma once
#include "micro_hal.h"
__BEGIN_DECLS
#define HW_INFO_SUFFIX "%0" STRINGIFY(HW_INFO_VER_DIGITS) "x%0" STRINGIFY(HW_INFO_REV_DIGITS) "x"
/************************************************************************************
* Name: board_determine_hw_info
*
@@ -71,6 +71,7 @@ __BEGIN_DECLS
* Function for writing hardware info to EEPROM
*
* Input Parameters:
* *path - path to mtd_mft
* *mtd_mft_unk - pointer to mtd_mft to write hw_info
*
* Returned Value:
@@ -80,9 +81,9 @@ __BEGIN_DECLS
************************************************************************************/
#if !defined(BOARD_HAS_SIMPLE_HW_VERSIONING) && defined(BOARD_HAS_VERSIONING)
__EXPORT int board_set_eeprom_hw_info(mtd_mft_t *mtd_mft_unk);
__EXPORT int board_set_eeprom_hw_info(const char *path, mtd_mft_t *mtd_mft_unk);
#else
static inline int board_set_eeprom_hw_info(mtd_mft_t *mtd_mft_unk) { return -ENOSYS; }
static inline int board_set_eeprom_hw_info(const char *path, mtd_mft_t *mtd_mft_unk) { return -ENOSYS; }
#endif
/************************************************************************************
@@ -101,9 +102,9 @@ static inline int board_set_eeprom_hw_info(mtd_mft_t *mtd_mft_unk) { return -ENO
************************************************************************************/
#if !defined(BOARD_HAS_SIMPLE_HW_VERSIONING) && defined(BOARD_HAS_VERSIONING)
__EXPORT int board_get_eeprom_hw_info(mtd_mft_t *mtd_mft);
__EXPORT int board_get_eeprom_hw_info(const char *path, mtd_mft_t *mtd_mft);
#else
static inline int board_get_eeprom_hw_info(mtd_mft_t *mtd_mft) { return -ENOSYS; }
static inline int board_get_eeprom_hw_info(const char *path, mtd_mft_t *mtd_mft) { return -ENOSYS; }
#endif
__END_DECLS
@@ -100,7 +100,7 @@ __EXPORT int px4_mft_query(const px4_mft_s *mft, px4_manifest_types_e type,
if (mft->mfts[m]->type == type)
switch (type) {
case MTD:
return px4_mtd_query(sub, val);
return px4_mtd_query(sub, val, nullptr);
break;
case MFT:
@@ -44,7 +44,7 @@
static int hw_version = 0;
static int hw_revision = 0;
static char hw_info[] = HW_INFO_INIT;
static char hw_info[] = HW_INFO_INIT_PREFIX HW_INFO_SUFFIX;
__EXPORT const char *board_get_hw_type_name(void)
{