From bdb6f51e8bf387e6326ef2846df75711514bba8e Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 21 Jun 2023 02:57:09 -0700 Subject: [PATCH] px4 mtd:Support FlexSPI attached Devices --- platforms/common/include/px4_platform_common/px4_manifest.h | 1 + platforms/common/include/px4_platform_common/px4_mtd.h | 2 ++ platforms/nuttx/src/px4/common/px4_mtd.cpp | 3 +++ 3 files changed, 6 insertions(+) diff --git a/platforms/common/include/px4_platform_common/px4_manifest.h b/platforms/common/include/px4_platform_common/px4_manifest.h index bdb6ad1984..fc8341801c 100644 --- a/platforms/common/include/px4_platform_common/px4_manifest.h +++ b/platforms/common/include/px4_platform_common/px4_manifest.h @@ -49,6 +49,7 @@ typedef struct { I2C = 0, SPI = 1, ONCHIP = 2, + FLEXSPI = 3 } bus_type; uint32_t devid; diff --git a/platforms/common/include/px4_platform_common/px4_mtd.h b/platforms/common/include/px4_platform_common/px4_mtd.h index 7313bd78a9..ce8e99013f 100644 --- a/platforms/common/include/px4_platform_common/px4_mtd.h +++ b/platforms/common/include/px4_platform_common/px4_mtd.h @@ -82,4 +82,6 @@ int px4_at24c_initialize(FAR struct i2c_master_s *dev, void px4_at24c_deinitialize(void); +weak_function int flexspi_attach(mtd_instance_s *instance); + __END_DECLS diff --git a/platforms/nuttx/src/px4/common/px4_mtd.cpp b/platforms/nuttx/src/px4/common/px4_mtd.cpp index f4b3476722..932e9fdad9 100644 --- a/platforms/nuttx/src/px4/common/px4_mtd.cpp +++ b/platforms/nuttx/src/px4/common/px4_mtd.cpp @@ -352,6 +352,9 @@ memoryout: } else if (mtd_list->entries[num_entry]->device->bus_type == px4_mft_device_t::SPI) { rv = ramtron_attach(*instances[i]); + } else if (mtd_list->entries[num_entry]->device->bus_type == px4_mft_device_t::FLEXSPI) { + rv = flexspi_attach(instances[i]); + } else if (mtd_list->entries[num_entry]->device->bus_type == px4_mft_device_t::ONCHIP) { instances[i]->n_partitions_current++; return 0;