mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
drivers/eeprobom: EEPROM driver for AT24xx compatible EEPROMs.
This commit is contained in:
committed by
Gregory Nutt
parent
2284d045ff
commit
abd3c4a7ea
+20
-2
@@ -5,11 +5,11 @@
|
||||
|
||||
if EEPROM
|
||||
config SPI_EE_25XX
|
||||
bool "Microchip 25xxNNN / Atmel AT25NNN EEPROM devices"
|
||||
bool "Microchip 25xxNNN / Atmel AT25NNN / ST M95NNN SPI EEPROM devices"
|
||||
default n
|
||||
depends on SPI
|
||||
---help---
|
||||
This selection enables support for the Microchip/Atmel SPI EEPROM
|
||||
This selection enables support for the Microchip/Atmel/ST SPI EEPROM
|
||||
devices
|
||||
|
||||
if SPI_EE_25XX
|
||||
@@ -20,4 +20,22 @@ config EE25XX_SPIMODE
|
||||
depends on SPI_EE_25XX
|
||||
|
||||
endif # SPI_EE_25XX
|
||||
|
||||
config I2C_EE_24XX
|
||||
bool "Microchip 24xxNNN / Atmel AT24NNN / ST M24NNN I2C EEPROM devices"
|
||||
default n
|
||||
depends on I2C
|
||||
---help---
|
||||
This selection enables support for the Microchip/Atmel/ST I2C EEPROM
|
||||
devices
|
||||
|
||||
if I2C_EE_24XX
|
||||
|
||||
config EE24XX_FREQUENCY
|
||||
int "I2C EEPROM frequency (100000 or 400000)"
|
||||
default 100000
|
||||
depends on I2C_EE_24XX
|
||||
|
||||
endif # I2C_EE_24XX
|
||||
|
||||
endif # EEPROM
|
||||
|
||||
@@ -37,12 +37,18 @@
|
||||
|
||||
ifeq ($(CONFIG_EEPROM),y)
|
||||
|
||||
# Include the Microchip/Atmel xx25xx driver
|
||||
# Include the Microchip/Atmel/ST xx25xx driver for SPI
|
||||
|
||||
ifeq ($(CONFIG_SPI_EE_25XX),y)
|
||||
CSRCS += spi_xx25xx.c
|
||||
endif
|
||||
|
||||
# Include the Microchip/Atmel/ST xx24xx driver for I2C
|
||||
|
||||
ifeq ($(CONFIG_I2C_EE_24XX),y)
|
||||
CSRCS += i2c_xx24xx.c
|
||||
endif
|
||||
|
||||
# Include build support
|
||||
|
||||
DEPPATH += --dep-path eeprom
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/eeprom/i2c_xx24xx.h
|
||||
*
|
||||
* Copyright (C) 2018 Sebastien Lorquet. All rights reserved.
|
||||
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_EEPROM_I2C_XX24XX_H
|
||||
#define __INCLUDE_NUTTX_EEPROM_I2C_XX24XX_H 1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* DO NOT CHANGE ORDER, IT MACHES 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,
|
||||
|
||||
/* 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_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 */
|
||||
Reference in New Issue
Block a user