mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
mtd/at25ee: Use eeprom/spi_xx25xx internally
In order to reduce code duplication, use the eeprom/spi_xx25xx driver within mtd/at25ee. The eeprom/xxx.h includes have been merged into eeprom/eeprom.h, to provide a common include file like mtd/mtd.h. Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
This commit is contained in:
committed by
simbit18
parent
963b421c39
commit
d5633f75a8
+2
-3
@@ -501,7 +501,6 @@ Documentation/components/binfmt.rst matias@protobits.dev xiaoxiang@xiaomi.com co
|
||||
Documentation/components/boards.rst raiden00@railab.me
|
||||
Documentation/components/cmake.rst raiden00@railab.me
|
||||
Documentation/components/crypto.rst raiden00@railab.me
|
||||
Documentation/components/drivers/block/eeprom.rst raiden00@railab.me
|
||||
Documentation/components/drivers/block/index.rst raiden00@railab.me matias@protobits.dev bashton@brennanashton.com xiaoxiang@xiaomi.com
|
||||
Documentation/components/drivers/block/ramdisk.rst raiden00@railab.me
|
||||
Documentation/components/drivers/character/1wire.rst raiden00@railab.me
|
||||
@@ -525,6 +524,7 @@ Documentation/components/drivers/character/can.rst matias@protobits.dev raiden00
|
||||
Documentation/components/drivers/character/contactless.rst raiden00@railab.me
|
||||
Documentation/components/drivers/character/crypto/index.rst raiden00@railab.me
|
||||
Documentation/components/drivers/character/crypto/se05x.rst raiden00@railab.me
|
||||
Documentation/components/drivers/character/eeprom.rst raiden00@railab.me
|
||||
Documentation/components/drivers/character/efuse.rst raiden00@railab.me
|
||||
Documentation/components/drivers/character/i2s.rst raiden00@railab.me
|
||||
Documentation/components/drivers/character/index.rst matias@protobits.dev raiden00@railab.me bashton@brennanashton.com xiaoxiang@xiaomi.com michallenc@seznam.cz
|
||||
@@ -19674,8 +19674,7 @@ include/nuttx/drivers/ramdisk.h alin.jerpelea@sony.com
|
||||
include/nuttx/drivers/rpmsgblk.h wangbowen6@xiaomi.com devel@sumpfralle.de alin.jerpelea@sony.com
|
||||
include/nuttx/drivers/rpmsgdev.h wangbowen6@xiaomi.com zhanghongyu@xiaomi.com devel@sumpfralle.de alin.jerpelea@sony.com wangjianyu3@xiaomi.com
|
||||
include/nuttx/drivers/rwbuffer.h alin.jerpelea@sony.com xiaoxiang@xiaomi.com anjiahao@xiaomi.com spudarnia@yahoo.com
|
||||
include/nuttx/eeprom/i2c_xx24xx.h acassis@gmail.com sebastien@lorquet.fr xiaoxiang@xiaomi.com alin.jerpelea@sony.com
|
||||
include/nuttx/eeprom/spi_xx25xx.h alin.jerpelea@sony.com petro.karashchenko@gmail.com xiaoxiang@xiaomi.com 56726697+TimJTi@users.noreply.github.com
|
||||
include/nuttx/eeprom/eeprom.h acassis@gmail.com alin.jerpelea@sony.com petro.karashchenko@gmail.com sebastien@lorquet.fr xiaoxiang@xiaomi.com 56726697+TimJTi@users.noreply.github.com
|
||||
include/nuttx/efuse/efuse.h acassis@gmail.com 56726697+TimJTi@users.noreply.github.com gustavo.nihei@espressif.com alin.jerpelea@sony.com
|
||||
include/nuttx/efuse/sama5_sfc_fuses.h 56726697+TimJTi@users.noreply.github.com alin.jerpelea@sony.com
|
||||
include/nuttx/elf.h xiaoxiang@xiaomi.com anchao@xiaomi.com masayuki.ishikawa@gmail.com anthony@vergeaero.com
|
||||
|
||||
@@ -145,6 +145,9 @@ character driver interface may also be preferred to reduce footprint or for
|
||||
very trivial usage of the EEPROM (e.g. storing parameters without having to
|
||||
rely on a filesystem).
|
||||
|
||||
The MTD driver for 25xxxx family EEPROMs is a wrapper around the character
|
||||
driver, their performance is therefore almost identical.
|
||||
|
||||
CFI FLASH
|
||||
=========
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/eeprom/i2c_xx24xx.h>
|
||||
#include <nuttx/eeprom/eeprom.h>
|
||||
|
||||
#include "stm32f401rc-rs485.h"
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/eeprom/i2c_xx24xx.h>
|
||||
#include <nuttx/eeprom/eeprom.h>
|
||||
#include "stm32_i2c.h"
|
||||
|
||||
#include "linum-stm32h753bi.h"
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <nuttx/eeprom/eeprom.h>
|
||||
#include <nuttx/eeprom/i2c_xx24xx.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
@@ -164,7 +163,7 @@ static ssize_t at24cs_read_uuid(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
/* Supported device geometries.
|
||||
* One geometry can fit more than one device.
|
||||
* The user will use an enum'ed index from include/eeprom/i2c_xx24xx.h
|
||||
* The user will use an enum'ed index from include/eeprom/eeprom.h
|
||||
*/
|
||||
|
||||
static const struct ee24xx_geom_s g_ee24xx_devices[] =
|
||||
|
||||
+547
-212
File diff suppressed because it is too large
Load Diff
+5
-40
@@ -516,12 +516,17 @@ config MTD_AT25EE
|
||||
default n
|
||||
select SPI
|
||||
select MTD_BYTE_WRITE
|
||||
select EEPROM
|
||||
select SPI_EE_25XX
|
||||
---help---
|
||||
Build support for SPI-based AT25xx type EEPROMs. MTD on EEPROM can
|
||||
perform poorly, so it is possible only usable if the EEPROM has a
|
||||
clock speed 10MHz or higher. EEPROMs that use the same commands as
|
||||
the 25AA160 should work OK.
|
||||
|
||||
This is a convenience wrapper around the eeprom/spi_xx25xx driver.
|
||||
It can be configured from the "EEPROM support" menu.
|
||||
|
||||
if MTD_AT25EE
|
||||
|
||||
choice
|
||||
@@ -564,46 +569,6 @@ config AT25EE_ENABLE_BLOCK_ERASE
|
||||
file system requires this) block erase (i.e. writing each byte to
|
||||
0xff) can be enabled here.
|
||||
|
||||
config AT25EE_SPIMODE
|
||||
int "AT25EE SPI Mode"
|
||||
default 0
|
||||
|
||||
config AT25EE_SPIFREQUENCY
|
||||
int "AT25EE SPI Frequency"
|
||||
default 10000000
|
||||
|
||||
config AT25EE_START_DELAY
|
||||
int "AT25EE startdelay"
|
||||
---help---
|
||||
The delay between CS active and first CLK. In ns.
|
||||
depends on SPI_DELAY_CONTROL
|
||||
range 0 1000000
|
||||
default 5000
|
||||
|
||||
config AT25EE_STOP_DELAY
|
||||
int "AT25EE stopdelay"
|
||||
---help---
|
||||
The delay between last CLK and CS inactive. In ns.
|
||||
depends on SPI_DELAY_CONTROL
|
||||
range 0 1000000
|
||||
default 5000
|
||||
|
||||
config AT25EE_CS_DELAY
|
||||
int "AT25EE csdelay"
|
||||
---help---
|
||||
The delay between CS inactive and CS active again. In ns.
|
||||
depends on SPI_DELAY_CONTROL
|
||||
range 0 1000000
|
||||
default 5000
|
||||
|
||||
config AT25EE_IFDELAY
|
||||
int "AT25EE ifdelay"
|
||||
---help---
|
||||
The delay between frames. In ns.
|
||||
depends on SPI_DELAY_CONTROL
|
||||
range 0 1000000
|
||||
default 5000
|
||||
|
||||
endif # MTD_AT25EE
|
||||
|
||||
config MTD_AT25
|
||||
|
||||
+248
-676
File diff suppressed because it is too large
Load Diff
+251
-11
@@ -1,10 +1,8 @@
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* include/nuttx/eeprom/eeprom.h
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* EEPROM IOCTL commands
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
@@ -20,7 +18,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/* This file includes common definitions to be used in all EEPROM drivers
|
||||
* (when applicable).
|
||||
@@ -29,9 +27,9 @@
|
||||
#ifndef __INCLUDE_NUTTX_EEPROM_EEPROM_H
|
||||
#define __INCLUDE_NUTTX_EEPROM_EEPROM_H
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -40,11 +38,11 @@
|
||||
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/* EEPROM IOCTL Commands ************************************************************/
|
||||
/* EEPROM IOCTL Commands ****************************************************/
|
||||
|
||||
#define EEPIOC_GEOMETRY _EEPIOC(0x000) /* Similar to BIOC_GEOMETRY:
|
||||
* Return the geometry of the
|
||||
@@ -89,9 +87,9 @@
|
||||
* IN: Which blocks as integer.
|
||||
* OUT: OK (0) on success. */
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Type Definitions
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
struct eeprom_geometry_s
|
||||
{
|
||||
@@ -100,4 +98,246 @@ struct eeprom_geometry_s
|
||||
blksize_t pagesize; /* Size of one page in bytes */
|
||||
};
|
||||
|
||||
#if defined(CONFIG_MTD_AT25EE) || defined(CONFIG_MTD_AT24XX)
|
||||
struct eeprom_dev_s
|
||||
{
|
||||
/* The following methods operate on the EEPROM */
|
||||
|
||||
CODE ssize_t (*read)(FAR struct eeprom_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR uint8_t *buffer);
|
||||
CODE ssize_t (*write)(FAR struct eeprom_dev_s *dev, off_t offset,
|
||||
size_t nbytes, FAR const uint8_t *buffer);
|
||||
|
||||
CODE int (*ioctl)(FAR struct eeprom_dev_s *dev, int cmd,
|
||||
unsigned long arg);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C_EE_24XX
|
||||
enum eeprom_24xx_e
|
||||
{
|
||||
/* Microchip geometries */
|
||||
|
||||
EEPROM_24XX00,
|
||||
EEPROM_24XX01,
|
||||
EEPROM_24XX02,
|
||||
EEPROM_24XX04,
|
||||
EEPROM_24XX08,
|
||||
EEPROM_24XX16,
|
||||
EEPROM_24XX32,
|
||||
EEPROM_24XX64,
|
||||
EEPROM_24XX128,
|
||||
EEPROM_24XX256,
|
||||
EEPROM_24XX512,
|
||||
EEPROM_24XX1025,
|
||||
EEPROM_24XX1026,
|
||||
EEPROM_24CM02,
|
||||
|
||||
/* Atmel geometries - none... */
|
||||
|
||||
/* STM geometries */
|
||||
|
||||
EEPROM_M24C01,
|
||||
EEPROM_M24C02,
|
||||
EEPROM_M24M02,
|
||||
|
||||
/* Aliases (devices similar to previously defined ones) */
|
||||
|
||||
EEPROM_AT24C01 = EEPROM_24XX01,
|
||||
EEPROM_AT24C02 = EEPROM_24XX02,
|
||||
EEPROM_AT24C04 = EEPROM_24XX04,
|
||||
EEPROM_AT24C08 = EEPROM_24XX08,
|
||||
EEPROM_AT24C16 = EEPROM_24XX16,
|
||||
EEPROM_AT24C32 = EEPROM_24XX32,
|
||||
EEPROM_AT24C64 = EEPROM_24XX64,
|
||||
EEPROM_AT24C128 = EEPROM_24XX128,
|
||||
EEPROM_AT24C256 = EEPROM_24XX256,
|
||||
EEPROM_AT24C512 = EEPROM_24XX512,
|
||||
EEPROM_AT24C1024 = EEPROM_24XX1026,
|
||||
EEPROM_AT24CM02 = EEPROM_24CM02,
|
||||
|
||||
EEPROM_M24C04 = EEPROM_24XX04,
|
||||
EEPROM_M24C08 = EEPROM_24XX08,
|
||||
EEPROM_M24C16 = EEPROM_24XX16,
|
||||
EEPROM_M24C32 = EEPROM_24XX32,
|
||||
EEPROM_M24C64 = EEPROM_24XX64,
|
||||
EEPROM_M24128 = EEPROM_24XX128,
|
||||
EEPROM_M24256 = EEPROM_24XX256,
|
||||
EEPROM_M24512 = EEPROM_24XX512,
|
||||
EEPROM_M24M01 = EEPROM_24XX1026,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPI_EE_25XX
|
||||
enum eeprom_25xx_e
|
||||
{
|
||||
/* Microchip geometries */
|
||||
|
||||
EEPROM_25XX010,
|
||||
EEPROM_25XX020,
|
||||
EEPROM_25XX040,
|
||||
EEPROM_25XX080A, /* 16 bytes pages */
|
||||
EEPROM_25XX080B, /* 32 bytes pages */
|
||||
EEPROM_25XX160A, /* 16 bytes pages */
|
||||
EEPROM_25XX160B, /* 32 bytes pages */
|
||||
EEPROM_25XX320,
|
||||
EEPROM_25XX640,
|
||||
EEPROM_25XX128,
|
||||
EEPROM_25XX256,
|
||||
EEPROM_25XX512, /* Additional erase commands */
|
||||
EEPROM_25XX1024, /* Additional erase commands */
|
||||
|
||||
/* Atmel geometries */
|
||||
|
||||
EEPROM_AT25010B,
|
||||
EEPROM_AT25020B,
|
||||
EEPROM_AT25040B,
|
||||
EEPROM_AT25512,
|
||||
EEPROM_AT25M01,
|
||||
|
||||
/* STM geometries */
|
||||
|
||||
EEPROM_M95M02,
|
||||
|
||||
/* Aliases (devices similar to previously defined ones) */
|
||||
|
||||
EEPROM_AT25080B = EEPROM_25XX080B,
|
||||
EEPROM_AT25160B = EEPROM_25XX160B,
|
||||
EEPROM_AT25320B = EEPROM_25XX320,
|
||||
EEPROM_AT25640B = EEPROM_25XX640,
|
||||
EEPROM_AT25128B = EEPROM_25XX128,
|
||||
EEPROM_AT225256B = EEPROM_25XX256,
|
||||
EEPROM_AT25M02 = EEPROM_25XX1024,
|
||||
EEPROM_M95010 = EEPROM_25XX010,
|
||||
EEPROM_M95020 = EEPROM_25XX020,
|
||||
EEPROM_M95040 = EEPROM_25XX040,
|
||||
EEPROM_M95080 = EEPROM_25XX080B,
|
||||
EEPROM_M95160 = EEPROM_25XX160B,
|
||||
EEPROM_M95320 = EEPROM_25XX320,
|
||||
EEPROM_M95640 = EEPROM_25XX640,
|
||||
EEPROM_M95128 = EEPROM_25XX128,
|
||||
EEPROM_M95256 = EEPROM_25XX256,
|
||||
EEPROM_M95512 = EEPROM_AT25512,
|
||||
EEPROM_M95M01 = EEPROM_AT25M01,
|
||||
EEPROM_BR25G256 = EEPROM_25XX256,
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ee24xx_initialize
|
||||
*
|
||||
* Description:
|
||||
* Bind a EEPROM driver to an I2C bus. The user MUST provide a description
|
||||
* of the device geometry, since it is not possible to read this
|
||||
* information from the device (contrary to the SPI flash devices).
|
||||
*
|
||||
* Parameters:
|
||||
* bus - Pointer to the I2C device instance
|
||||
* devaddr - I2C device address
|
||||
* devaddr - Device name
|
||||
* devtype - 24xx device type, the geometry is derived from it
|
||||
* readonly - Flag indicating whether the device should be opened read-only
|
||||
*
|
||||
* Returned Values:
|
||||
* OK on success; A negated errno value is returned on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_I2C_EE_24XX
|
||||
struct i2c_master_s;
|
||||
int ee24xx_initialize(FAR struct i2c_master_s *bus, uint8_t devaddr,
|
||||
FAR char *devname, int devtype, int readonly);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ee25xx_initialize
|
||||
*
|
||||
* Description:
|
||||
* Bind an EEPROM driver to an SPI bus. The user MUST provide a description
|
||||
* of the device geometry, since it is not possible to read this
|
||||
* information from the device (contrary to the SPI flash devices).
|
||||
*
|
||||
* Parameters:
|
||||
* dev - Pointer to the SPI device instance
|
||||
* spi_devid - SPI device ID to manage CS lines in board
|
||||
* devname - Device name
|
||||
* devtype - 25xx device type, the geometry is derived from it
|
||||
* readonly - Sets driver to be readonly
|
||||
*
|
||||
* Returned Values:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_EE_25XX
|
||||
struct spi_dev_s;
|
||||
int ee25xx_initialize(FAR struct spi_dev_s *dev, uint16_t spi_devid,
|
||||
FAR char *devname, enum eeprom_25xx_e devtype,
|
||||
int readonly);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ee25xx_initialize_as_eeprom_dev
|
||||
*
|
||||
* Description:
|
||||
* Create an initialized EEPROM device instance for an xx25xx SPI EEPROM.
|
||||
* The device is not registered in the file system, but created as an
|
||||
* instance that can be bound to other functions.
|
||||
*
|
||||
* Parameters:
|
||||
* dev - Pointer to the SPI device instance
|
||||
* spi_devid - SPI device ID to manage CS lines in board
|
||||
* devtype - 25xx device type, the geometry is derived from it
|
||||
* readonly - Sets driver to be readonly
|
||||
*
|
||||
* Returned Values:
|
||||
* Initialized device structure (success) or NULL (fail)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_MTD_AT25EE
|
||||
FAR struct eeprom_dev_s *ee25xx_initialize_as_eeprom_dev(
|
||||
FAR struct spi_dev_s *dev, uint16_t spi_devid,
|
||||
enum eeprom_25xx_e devtype, int readonly);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ee25xx_teardown
|
||||
*
|
||||
* Description:
|
||||
* Teardown a previously created ee25xx device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - Pointer to the driver instance.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void ee25xx_teardown(FAR struct eeprom_dev_s *dev);
|
||||
|
||||
#endif /* CONFIG_MTD_AT25EE */
|
||||
#endif /* CONFIG_SPI_EE_25XX */
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_EEPROM_EEPROM_H */
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/eeprom/i2c_xx24xx.h
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_EEPROM_I2C_XX24XX_H
|
||||
#define __INCLUDE_NUTTX_EEPROM_I2C_XX24XX_H
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* DO NOT CHANGE ORDER, IT MATCHES CODE IN drivers/eeprom/i2c_xx24xx.c */
|
||||
|
||||
enum eeprom_24xx_e
|
||||
{
|
||||
/* Microchip geometries */
|
||||
|
||||
EEPROM_24XX00,
|
||||
EEPROM_24XX01,
|
||||
EEPROM_24XX02,
|
||||
EEPROM_24XX04,
|
||||
EEPROM_24XX08,
|
||||
EEPROM_24XX16,
|
||||
EEPROM_24XX32,
|
||||
EEPROM_24XX64,
|
||||
EEPROM_24XX128,
|
||||
EEPROM_24XX256,
|
||||
EEPROM_24XX512,
|
||||
EEPROM_24XX1025,
|
||||
EEPROM_24XX1026,
|
||||
EEPROM_24CM02,
|
||||
|
||||
/* Atmel geometries - none... */
|
||||
|
||||
/* STM geometries */
|
||||
|
||||
EEPROM_M24C01,
|
||||
EEPROM_M24C02,
|
||||
EEPROM_M24M02,
|
||||
|
||||
/* Aliases (devices similar to previously defined ones) */
|
||||
|
||||
EEPROM_AT24C01 = EEPROM_24XX01,
|
||||
EEPROM_AT24C02 = EEPROM_24XX02,
|
||||
EEPROM_AT24C04 = EEPROM_24XX04,
|
||||
EEPROM_AT24C08 = EEPROM_24XX08,
|
||||
EEPROM_AT24C16 = EEPROM_24XX16,
|
||||
EEPROM_AT24C32 = EEPROM_24XX32,
|
||||
EEPROM_AT24C64 = EEPROM_24XX64,
|
||||
EEPROM_AT24C128 = EEPROM_24XX128,
|
||||
EEPROM_AT24C256 = EEPROM_24XX256,
|
||||
EEPROM_AT24C512 = EEPROM_24XX512,
|
||||
EEPROM_AT24C1024 = EEPROM_24XX1026,
|
||||
EEPROM_AT24CM02 = EEPROM_24CM02,
|
||||
|
||||
EEPROM_M24C04 = EEPROM_24XX04,
|
||||
EEPROM_M24C08 = EEPROM_24XX08,
|
||||
EEPROM_M24C16 = EEPROM_24XX16,
|
||||
EEPROM_M24C32 = EEPROM_24XX32,
|
||||
EEPROM_M24C64 = EEPROM_24XX64,
|
||||
EEPROM_M24128 = EEPROM_24XX128,
|
||||
EEPROM_M24256 = EEPROM_24XX256,
|
||||
EEPROM_M24512 = EEPROM_24XX512,
|
||||
EEPROM_M24M01 = EEPROM_24XX1026,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ee24xx_initialize
|
||||
*
|
||||
* Description: Bind a EEPROM driver to an I2C bus. The user MUST provide
|
||||
* a description of the device geometry, since it is not possible to read
|
||||
* this information from the device (contrary to the SPI flash devices).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct i2c_master_s;
|
||||
int ee24xx_initialize(FAR struct i2c_master_s *bus, uint8_t devaddr,
|
||||
FAR char *devname, int devtype, int readonly);
|
||||
|
||||
#endif /* __INCLUDE__NUTTX_EEPROM_I2C_XX24XX_H */
|
||||
@@ -1,114 +0,0 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/eeprom/spi_xx25xx.h
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_EEPROM_SPI_XX25XX_H
|
||||
#define __INCLUDE_NUTTX_EEPROM_SPI_XX25XX_H
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* DO NOT CHANGE ORDER, IT MATCHES CODE IN drivers/eeprom/spieeprom.c and
|
||||
* drivers/mtd/at25ee.c
|
||||
*/
|
||||
|
||||
enum eeprom_25xx_e
|
||||
{
|
||||
/* Microchip geometries */
|
||||
|
||||
EEPROM_25XX010,
|
||||
EEPROM_25XX020,
|
||||
EEPROM_25XX040,
|
||||
EEPROM_25XX080A, /* 16 bytes pages */
|
||||
EEPROM_25XX080B, /* 32 bytes pages */
|
||||
EEPROM_25XX160A, /* 16 bytes pages */
|
||||
EEPROM_25XX160B, /* 32 bytes pages */
|
||||
EEPROM_25XX320,
|
||||
EEPROM_25XX640,
|
||||
EEPROM_25XX128,
|
||||
EEPROM_25XX256,
|
||||
EEPROM_25XX512, /* Additional erase commands */
|
||||
EEPROM_25XX1024, /* Additional erase commands */
|
||||
|
||||
/* Atmel geometries */
|
||||
|
||||
EEPROM_AT25010B,
|
||||
EEPROM_AT25020B,
|
||||
EEPROM_AT25040B,
|
||||
EEPROM_AT25512,
|
||||
EEPROM_AT25M01,
|
||||
|
||||
/* STM geometries */
|
||||
|
||||
EEPROM_M95M02,
|
||||
|
||||
/* Aliases (devices similar to previously defined ones) */
|
||||
|
||||
EEPROM_AT25080B = EEPROM_25XX080B,
|
||||
EEPROM_AT25160B = EEPROM_25XX160B,
|
||||
EEPROM_AT25320B = EEPROM_25XX320,
|
||||
EEPROM_AT25640B = EEPROM_25XX640,
|
||||
EEPROM_AT25128B = EEPROM_25XX128,
|
||||
EEPROM_AT225256B = EEPROM_25XX256,
|
||||
EEPROM_AT25M02 = EEPROM_25XX1024,
|
||||
EEPROM_M95010 = EEPROM_25XX010,
|
||||
EEPROM_M95020 = EEPROM_25XX020,
|
||||
EEPROM_M95040 = EEPROM_25XX040,
|
||||
EEPROM_M95080 = EEPROM_25XX080B,
|
||||
EEPROM_M95160 = EEPROM_25XX160B,
|
||||
EEPROM_M95320 = EEPROM_25XX320,
|
||||
EEPROM_M95640 = EEPROM_25XX640,
|
||||
EEPROM_M95128 = EEPROM_25XX128,
|
||||
EEPROM_M95256 = EEPROM_25XX256,
|
||||
EEPROM_M95512 = EEPROM_AT25512,
|
||||
EEPROM_M95M01 = EEPROM_AT25M01,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ee25xx_initialize
|
||||
*
|
||||
* Description:
|
||||
* Bind an EEPROM driver to an SPI bus. The user MUST provide a description
|
||||
* of the device geometry, since it is not possible to read this
|
||||
* information from the device (contrary to the SPI flash devices).
|
||||
*
|
||||
* Parameters:
|
||||
* dev - Pointer to the SPI device instance
|
||||
* spi_devid - SPI device ID to manage CS lines in board
|
||||
* devname - Device name
|
||||
* devtype - 25xx device type, the geometry is derived from it
|
||||
* readonly - Sets driver to be readonly
|
||||
*
|
||||
* Returned Values:
|
||||
* OK on success; A negated errno value is returned on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct spi_dev_s;
|
||||
int ee25xx_initialize(FAR struct spi_dev_s *dev, uint16_t spi_devid,
|
||||
FAR char *devname, int devtype, int readonly);
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_EEPROM_SPI_XX25XX_H */
|
||||
+25
-3
@@ -35,6 +35,10 @@
|
||||
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
#ifdef CONFIG_EEPROM
|
||||
#include <nuttx/eeprom/eeprom.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -429,17 +433,35 @@ FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev);
|
||||
* Input Parameters:
|
||||
* dev - a reference to the spi device structure
|
||||
* spi_devid - SPI device ID to manage CS lines in board
|
||||
* devtype - device type, from include/nuttx/eeprom/spi_xx25xx.h
|
||||
* devtype - device type, see eeprom/eeprom.h
|
||||
* readonly - sets block driver to be readonly
|
||||
*
|
||||
* Returned Value:
|
||||
* Initialised device structure (success) of NULL (fail)
|
||||
* Initialized device structure (success) or NULL (fail)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_MTD_AT25EE
|
||||
FAR struct mtd_dev_s *at25ee_initialize(FAR struct spi_dev_s *dev,
|
||||
uint16_t spi_devid, int devtype,
|
||||
uint16_t spi_devid,
|
||||
enum eeprom_25xx_e devtype,
|
||||
int readonly);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: at25ee_teardown
|
||||
*
|
||||
* Description:
|
||||
* Teardown a previously created at25ee device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - Pointer to the mtd driver instance.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_MTD_AT25EE
|
||||
void at25ee_teardown(FAR struct mtd_dev_s *mtd);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: at24c_uninitialize
|
||||
|
||||
Reference in New Issue
Block a user