forked from Archive/PX4-Autopilot
nxp Support BOARD_HAS_HW_SPLIT_VERSIONING
This commit is contained in:
parent
84dddb5f40
commit
150a161efb
|
@ -50,7 +50,7 @@
|
||||||
#include <lib/crc/crc.h>
|
#include <lib/crc/crc.h>
|
||||||
#include <lib/systemlib/px4_macros.h>
|
#include <lib/systemlib/px4_macros.h>
|
||||||
|
|
||||||
#if defined(BOARD_HAS_HW_VERSIONING)
|
#if defined(BOARD_HAS_HW_VERSIONING) || defined(BOARD_HAS_HW_SPLIT_VERSIONING)
|
||||||
|
|
||||||
# if defined(GPIO_HW_VER_REV_DRIVE)
|
# if defined(GPIO_HW_VER_REV_DRIVE)
|
||||||
# define GPIO_HW_REV_DRIVE GPIO_HW_VER_REV_DRIVE
|
# define GPIO_HW_REV_DRIVE GPIO_HW_VER_REV_DRIVE
|
||||||
|
@ -66,6 +66,9 @@
|
||||||
static int hw_version = 0;
|
static int hw_version = 0;
|
||||||
static int hw_revision = 0;
|
static int hw_revision = 0;
|
||||||
static char hw_info[HW_INFO_SIZE] = {0};
|
static char hw_info[HW_INFO_SIZE] = {0};
|
||||||
|
#if defined(BOARD_HAS_HW_SPLIT_VERSIONING)
|
||||||
|
static char hw_base_info[HW_INFO_SIZE] = {0};
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Protected Functions
|
* Protected Functions
|
||||||
|
@ -279,6 +282,27 @@ __EXPORT const char *board_get_hw_type_name()
|
||||||
return (const char *) hw_info;
|
return (const char *) hw_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(BOARD_HAS_HW_SPLIT_VERSIONING)
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: board_get_hw_base_type_name
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Optional returns a 0 terminated string defining the base type.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* a 0 terminated string defining the HW type. This my be a 0 length string ""
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
__EXPORT const char *board_get_hw_base_type_name()
|
||||||
|
{
|
||||||
|
return (const char *) hw_base_info;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: board_get_hw_version
|
* Name: board_get_hw_version
|
||||||
*
|
*
|
||||||
|
@ -380,7 +404,12 @@ int board_determine_hw_info()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv == OK) {
|
if (rv == OK) {
|
||||||
|
#if defined(BOARD_HAS_HW_SPLIT_VERSIONING)
|
||||||
|
snprintf(hw_info, sizeof(hw_info), HW_INFO_INIT_PREFIX HW_INFO_FMUM_SUFFIX, GET_HW_FMUM_ID());
|
||||||
|
snprintf(hw_base_info, sizeof(hw_info), HW_INFO_BASE_SUFFIX, GET_HW_BASE_ID());
|
||||||
|
#else
|
||||||
snprintf(hw_info, sizeof(hw_info), HW_INFO_INIT_PREFIX HW_INFO_SUFFIX, hw_version, hw_revision);
|
snprintf(hw_info, sizeof(hw_info), HW_INFO_INIT_PREFIX HW_INFO_SUFFIX, hw_version, hw_revision);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -186,6 +186,20 @@ static inline constexpr SPI::bus_device_external_cfg_t initSPIConfigExternal(SPI
|
||||||
struct px4_spi_bus_array_t {
|
struct px4_spi_bus_array_t {
|
||||||
px4_spi_bus_t item[SPI_BUS_MAX_BUS_ITEMS];
|
px4_spi_bus_t item[SPI_BUS_MAX_BUS_ITEMS];
|
||||||
};
|
};
|
||||||
|
#if defined(BOARD_HAS_HW_SPLIT_VERSIONING)
|
||||||
|
static inline constexpr px4_spi_bus_all_hw_t initSPIFmumID(hw_fmun_id_t hw_fmun_id,
|
||||||
|
const px4_spi_bus_array_t &bus_items)
|
||||||
|
{
|
||||||
|
px4_spi_bus_all_hw_t ret{};
|
||||||
|
|
||||||
|
for (int i = 0; i < SPI_BUS_MAX_BUS_ITEMS; ++i) {
|
||||||
|
ret.buses[i] = bus_items.item[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.board_hw_fmun_id = hw_fmun_id;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
static inline constexpr px4_spi_bus_all_hw_t initSPIHWVersion(int hw_version_revision,
|
static inline constexpr px4_spi_bus_all_hw_t initSPIHWVersion(int hw_version_revision,
|
||||||
const px4_spi_bus_array_t &bus_items)
|
const px4_spi_bus_array_t &bus_items)
|
||||||
{
|
{
|
||||||
|
@ -198,6 +212,7 @@ static inline constexpr px4_spi_bus_all_hw_t initSPIHWVersion(int hw_version_rev
|
||||||
ret.board_hw_version_revision = hw_version_revision;
|
ret.board_hw_version_revision = hw_version_revision;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
constexpr bool validateSPIConfig(const px4_spi_bus_t spi_buses_conf[SPI_BUS_MAX_BUS_ITEMS]);
|
constexpr bool validateSPIConfig(const px4_spi_bus_t spi_buses_conf[SPI_BUS_MAX_BUS_ITEMS]);
|
||||||
|
|
||||||
constexpr bool validateSPIConfig(const px4_spi_bus_all_hw_t spi_buses_conf[BOARD_NUM_SPI_CFG_HW_VERSIONS])
|
constexpr bool validateSPIConfig(const px4_spi_bus_all_hw_t spi_buses_conf[BOARD_NUM_SPI_CFG_HW_VERSIONS])
|
||||||
|
|
Loading…
Reference in New Issue