diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-26 13:55:34 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-26 13:55:34 -0600 |
commit | 2f82c57b83185d2fa3346e2c6c105d2712afbfad (patch) | |
tree | 35523f341ca067727402c66cbac1338de01efbf4 /nuttx/include | |
parent | 83e24c358e0971ba9637bfd170c23a002e8a8190 (diff) | |
download | nuttx-2f82c57b83185d2fa3346e2c6c105d2712afbfad.tar.gz nuttx-2f82c57b83185d2fa3346e2c6c105d2712afbfad.tar.bz2 nuttx-2f82c57b83185d2fa3346e2c6c105d2712afbfad.zip |
Add support for generic EEPROM access via a character driver. Add also the EEPROM driver itself. From Sebastien Lorquet
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/eeprom/spi_xx25xx.h | 99 | ||||
-rw-r--r-- | nuttx/include/nuttx/spi/spi.h | 3 |
2 files changed, 101 insertions, 1 deletions
diff --git a/nuttx/include/nuttx/eeprom/spi_xx25xx.h b/nuttx/include/nuttx/eeprom/spi_xx25xx.h new file mode 100644 index 000000000..ec3fcaa2a --- /dev/null +++ b/nuttx/include/nuttx/eeprom/spi_xx25xx.h @@ -0,0 +1,99 @@ +/**************************************************************************** + * include/nuttx/eeprom/m25xx.h + * + * Copyright (C) 2014 Gregory Nutt. 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_M25XX_H +#define __INCLUDE_NUTTX_EEPROM_M25XX_H 1 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* DO NOT CHANGE ORDER, IT MACHES CODE IN drivers/eeprom/spieeprom.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, + EEPROM_25xx1024, + + /* Atmel geometries */ + + EEPROM_AT25010B, + EEPROM_AT25020B, + EEPROM_AT25040B, + + /* 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_AT25512 = EEPROM_25xx512, + EEPROM_AT25M02 = EEPROM_25xx1024, +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: ee25xx_initialize + * + * Description: Bind a 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). + * + ****************************************************************************/ + +struct spi_dev_s; +int ee25xx_initialize(FAR struct spi_dev_s *dev, FAR char *devname, + int devtype, int readonly); + +#endif /* __INCLUDE__NUTTX_EEPROM_M25XX_H */ + diff --git a/nuttx/include/nuttx/spi/spi.h b/nuttx/include/nuttx/spi/spi.h index ace8799cf..7f1c4c784 100644 --- a/nuttx/include/nuttx/spi/spi.h +++ b/nuttx/include/nuttx/spi/spi.h @@ -360,7 +360,8 @@ enum spi_dev_e SPIDEV_EXPANDER, /* Select SPI I/O expander device */ SPIDEV_MUX, /* Select SPI multiplexer device */ SPIDEV_AUDIO_DATA, /* Select SPI audio codec device data port */ - SPIDEV_AUDIO_CTRL /* Select SPI audio codec device control port */ + SPIDEV_AUDIO_CTRL, /* Select SPI audio codec device control port */ + SPIDEV_EEPROM /* Select SPI EEPROM device */ }; /* Certain SPI devices may required differnt clocking modes */ |