aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-05-16 11:14:20 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-05-16 11:14:20 +0000
commit81c35cb4919c12d164a675c0047848ad2bdcdee0 (patch)
tree81a217c8d7bdc1df73336f2290fc81f93f89a292
parente555cd14ab74a2d258b43c86a016f01243c3cfce (diff)
downloadChibiOS-81c35cb4919c12d164a675c0047848ad2bdcdee0.tar.gz
ChibiOS-81c35cb4919c12d164a675c0047848ad2bdcdee0.tar.bz2
ChibiOS-81c35cb4919c12d164a675c0047848ad2bdcdee0.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9490 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/ex/Micron/n25q128_spi.h6
-rw-r--r--os/hal/lib/peripherals/flash/hal_flash.h2
-rw-r--r--os/hal/lib/peripherals/flash/hal_jesd216_flash.c49
-rw-r--r--os/hal/lib/peripherals/flash/hal_jesd216_flash.h122
-rw-r--r--testhal/STM32/STM32L4xx/QSPI-N25Q128/Makefile4
-rw-r--r--testhal/STM32/STM32L4xx/QSPI-N25Q128/halconf.h2
6 files changed, 176 insertions, 9 deletions
diff --git a/os/ex/Micron/n25q128_spi.h b/os/ex/Micron/n25q128_spi.h
index 0dd019e35..6a08f9b8a 100644
--- a/os/ex/Micron/n25q128_spi.h
+++ b/os/ex/Micron/n25q128_spi.h
@@ -145,11 +145,11 @@
*/
typedef struct {
/**
- * @brief SPI driver associated to this L3GD20.
+ * @brief SPI driver associated to this N25Q128.
*/
SPIDriver *spip;
/**
- * @brief SPI configuration associated to this L3GD20.
+ * @brief SPI configuration associated to this N25Q128.
*/
const SPIConfig *spicfg;
} N25Q128Config;
@@ -163,7 +163,7 @@ typedef struct {
/**
* @extends BaseGyroscopeVMT
*
- * @brief @p L3GD20 virtual methods table.
+ * @brief @p N25Q128 virtual methods table.
*/
struct N25Q128DriverVMT {
_n25q128_methods
diff --git a/os/hal/lib/peripherals/flash/hal_flash.h b/os/hal/lib/peripherals/flash/hal_flash.h
index d0416b353..52011a765 100644
--- a/os/hal/lib/peripherals/flash/hal_flash.h
+++ b/os/hal/lib/peripherals/flash/hal_flash.h
@@ -173,8 +173,6 @@ struct BaseFlashVMT {
/**
* @brief @p BaseFlash specific data.
- * @note It is empty because @p BaseFlash is only an interface
- * without implementation.
*/
#define _base_flash_data \
/* Driver state.*/ \
diff --git a/os/hal/lib/peripherals/flash/hal_jesd216_flash.c b/os/hal/lib/peripherals/flash/hal_jesd216_flash.c
new file mode 100644
index 000000000..7687a4aa7
--- /dev/null
+++ b/os/hal/lib/peripherals/flash/hal_jesd216_flash.c
@@ -0,0 +1,49 @@
+/*
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file hal_jesd216_flash.c
+ * @brief JESD216 compliant flash driver class code.
+ *
+ * @addtogroup HAL_JESD216_FLASH
+ * @{
+ */
+
+#include "hal.h"
+
+#include "hal_jesd216_flash.h"
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local variables and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+/** @} */
diff --git a/os/hal/lib/peripherals/flash/hal_jesd216_flash.h b/os/hal/lib/peripherals/flash/hal_jesd216_flash.h
new file mode 100644
index 000000000..0c7d1bef6
--- /dev/null
+++ b/os/hal/lib/peripherals/flash/hal_jesd216_flash.h
@@ -0,0 +1,122 @@
+/*
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file hal_jesd216_flash.h
+ * @brief JESD216 compliant flash driver class header.
+ *
+ * @addtogroup HAL_JESD216_FLASH
+ * @{
+ */
+
+#ifndef HAL_JESD216_FLASH_H
+#define HAL_JESD216_FLASH_H
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/**
+ * @name Common command codes
+ * @{
+ */
+#define JESD216_CMD_READ_ID 0x9F
+#define JESD216_CMD_READ 0x03
+#define JESD216_CMD_WRITE_ENABLE 0x06
+#define JESD216_CMD_WRITE_DISABLE 0x04
+#define JESD216_CMD_READ_STATUS_REGISTER 0x05
+#define JESD216_CMD_WRITE_STATUS_REGISTER 0x01
+#define JESD216_CMD_PAGE_PROGRAM 0x02
+#define JESD216_CMD_ERASE_4K 0x20
+#define JESD216_CMD_ERASE_BULK 0xC7
+#define JESD216_CMD_PROGRAM_ERASE_RESUME 0x7A
+#define JESD216_CMD_PROGRAM_ERASE_SUSPEND 0x75
+#define JESD216_CMD_READ_OTP_ARRAY 0x4B
+#define JESD216_CMD_PROGRAM_OTP_ARRAY 0x42
+/** @} */
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/**
+ * @brief @p JESD215Flash specific methods.
+ * @note No methods so far, just a common ancestor interface.
+ */
+#define _jesd216_flash_methods_alone \
+ /* Read SFDP.*/ \
+ void (*read_id)(void *instance, uint8_t *rp, size_t max);
+
+/**
+ * @brief @p JESD215Flash specific methods with inherited ones.
+ */
+#define _jesd216_flash_methods \
+ _jesd216_flash_methods_alone
+
+/**
+ * @brief @p JESD215Flash virtual methods table.
+ */
+struct JESD215FlashVMT {
+ _jesd216_flash_methods
+};
+
+/**
+ * @brief @p JESD215Flash specific data.
+ */
+#define _jesd216_flash_data
+
+/**
+ * @brief Base flash class.
+ */
+typedef struct {
+ /** @brief Virtual Methods Table.*/
+ const struct JESD215FlashVMT *vmt_jesd216flash;
+ _jesd216_flash_data
+} JESD215Flash;
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/**
+ * @name Macro Functions (BaseFlash)
+ * @{
+ */
+/** @} */
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HAL_JESD216_FLASH_H */
+
+/** @} */
diff --git a/testhal/STM32/STM32L4xx/QSPI-N25Q128/Makefile b/testhal/STM32/STM32L4xx/QSPI-N25Q128/Makefile
index 2ce900855..7a8a46ee0 100644
--- a/testhal/STM32/STM32L4xx/QSPI-N25Q128/Makefile
+++ b/testhal/STM32/STM32L4xx/QSPI-N25Q128/Makefile
@@ -98,7 +98,6 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
-include $(CHIBIOS)/os/ex/ST/l3gd20.mk
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
# Define linker script file here
@@ -113,7 +112,6 @@ CSRC = $(STARTUPSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
- $(L3GD20SRC) \
$(STREAMSSRC) \
main.c
@@ -147,7 +145,7 @@ ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
INCDIR = $(CHIBIOS)/os/license \
$(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
- $(HALINC) $(PLATFORMINC) $(BOARDINC) $(L3GD20INC) \
+ $(HALINC) $(PLATFORMINC) $(BOARDINC) \
$(STREAMSINC) $(CHIBIOS)/os/various
#
diff --git a/testhal/STM32/STM32L4xx/QSPI-N25Q128/halconf.h b/testhal/STM32/STM32L4xx/QSPI-N25Q128/halconf.h
index e0e51673b..5ab199774 100644
--- a/testhal/STM32/STM32L4xx/QSPI-N25Q128/halconf.h
+++ b/testhal/STM32/STM32L4xx/QSPI-N25Q128/halconf.h
@@ -118,7 +118,7 @@
* @brief Enables the QSPI subsystem.
*/
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
-#define HAL_USE_QSPI FALSE
+#define HAL_USE_QSPI TRUE
#endif
/**