aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/hal_ee25xx.h
diff options
context:
space:
mode:
authorbarthess <barthess@yandex.ru>2016-04-07 16:39:12 +0300
committerbarthess <barthess@yandex.ru>2016-04-07 16:39:12 +0300
commit9d74dd2661b80a5ae8598591f0251b197cc51756 (patch)
tree0c833cbd2f4cf5845358ee0f37fbb3f95b7a447b /os/hal/include/hal_ee25xx.h
parentb86af2c09feea9b50cb241c147a3881e55763a55 (diff)
downloadChibiOS-Contrib-9d74dd2661b80a5ae8598591f0251b197cc51756.tar.gz
ChibiOS-Contrib-9d74dd2661b80a5ae8598591f0251b197cc51756.tar.bz2
ChibiOS-Contrib-9d74dd2661b80a5ae8598591f0251b197cc51756.zip
STM32 mass update to current naming convention in ChibiOS
Diffstat (limited to 'os/hal/include/hal_ee25xx.h')
-rw-r--r--os/hal/include/hal_ee25xx.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/os/hal/include/hal_ee25xx.h b/os/hal/include/hal_ee25xx.h
new file mode 100644
index 0000000..fc2ad6f
--- /dev/null
+++ b/os/hal/include/hal_ee25xx.h
@@ -0,0 +1,63 @@
+/*
+ Copyright 2012 Uladzimir Pylinski aka barthess.
+ You may use this work without restrictions, as long as this notice is included.
+ The work is provided "as is" without warranty of any kind, neither express nor implied.
+*/
+
+#ifndef EE25XX_H
+#define EE25XX_H
+
+#include "hal.h"
+
+#if defined(HAL_USE_EEPROM) && HAL_USE_EEPROM && EEPROM_USE_EE25XX
+
+#define EEPROM_DEV_25XX 25
+
+/**
+ * @extends EepromFileConfig
+ */
+typedef struct {
+ _eeprom_file_config_data
+ /**
+ * Driver connected to IC.
+ */
+ SPIDriver *spip;
+ /**
+ * Config associated with SPI driver.
+ */
+ const SPIConfig *spicfg;
+} SPIEepromFileConfig;
+
+/**
+ * @brief @p SPIEepromFileStream specific data.
+ */
+#define _eeprom_file_stream_data_spi \
+ _eeprom_file_stream_data
+
+/**
+ * @extends EepromFileStream
+ *
+ * @brief EEPROM file stream driver class for SPI device.
+ */
+typedef struct {
+ const struct EepromFileStreamVMT *vmt;
+ _eeprom_file_stream_data_spi
+ /* Overwritten parent data member. */
+ const SPIEepromFileConfig *cfg;
+} SPIEepromFileStream;
+
+/**
+ * Open SPI EEPROM IC as file and return pointer to the file stream object
+ * @note Fucntion allways successfully open file. All checking makes
+ * in read/write functions.
+ */
+EepromFileStream *SPIEepromFileOpen(SPIEepromFileStream *efs,
+ const SPIEepromFileConfig *eepcfg,
+ const EepromDevice *eepdev);
+
+#define SPIEepromFileOpen(efs, eepcfg, eepdev) \
+ EepromFileOpen((EepromFileStream *)efs, (EepromFileConfig *)eepcfg, eepdev);
+
+#endif /* #if defined(EEPROM_USE_EE25XX) && EEPROM_USE_EE25XX */
+
+#endif // EE25XX_H