diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-11 21:44:00 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-11 21:44:00 +0000 |
commit | fb8e18e23e3997e065de381bf9b6b54e0c6f331f (patch) | |
tree | 0c3fde628a9f6c055b56564c2bf7fb0040567f04 /nuttx/drivers/mtd | |
parent | 260d6c44c8f61cf6bae4b74291825c1eebd17651 (diff) | |
download | px4-nuttx-fb8e18e23e3997e065de381bf9b6b54e0c6f331f.tar.gz px4-nuttx-fb8e18e23e3997e065de381bf9b6b54e0c6f331f.tar.bz2 px4-nuttx-fb8e18e23e3997e065de381bf9b6b54e0c6f331f.zip |
Add a driver for the SST30VF NOR FLASH parts
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5640 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/mtd')
-rw-r--r-- | nuttx/drivers/mtd/Kconfig | 63 | ||||
-rw-r--r-- | nuttx/drivers/mtd/Make.defs | 4 | ||||
-rw-r--r-- | nuttx/drivers/mtd/skeleton.c | 32 |
3 files changed, 71 insertions, 28 deletions
diff --git a/nuttx/drivers/mtd/Kconfig b/nuttx/drivers/mtd/Kconfig index ae656c474..1449a7125 100644 --- a/nuttx/drivers/mtd/Kconfig +++ b/nuttx/drivers/mtd/Kconfig @@ -7,55 +7,60 @@ config MTD_AT24XX default n select I2C +if MTD_AT24XX + config AT24XX_SIZE int "at24xx size(kByte)" default 64 - depends on MTD_AT24XX config AT24XX_ADDR hex "at24xx i2c address" default 0x50 - depends on MTD_AT24XX - + +endif + config MTD_AT45DB bool "SPI-based AT45DB flash" default n select SPI - + +if MTD_AT45DB + config AT45DB_FREQUENCY int "at45db frequency" default 1000000 - depends on MTD_AT45DB - + config AT45DB_PREWAIT bool "enables higher performance write logic" default y - depends on MTD_AT45DB config AT45DB_PWRSAVE bool "enables power save" default n - depends on MTD_AT45DB + +endif config MTD_MP25P bool "SPI-based M25P FLASH" default n select SPI +if MTD_MP25P + config MP25P_SPIMODE int "MP25P SPI mode" default 0 - depends on MTD_MP25P config MP25P_MANUFACTURER hex "MP25P manufacturers ID" default 0x20 - depends on MTD_MP25P ---help--- Various manufacturers may have produced the parts. 0x20 is the manufacturer ID for the STMicro MP25x serial FLASH. If, for example, you are using the a Macronix International MX25 serial FLASH, the correct manufacturer ID would be 0xc2. +endif + config MTD_RAMTRON bool "SPI-based RAMTRON NVRAM Devices FM25V10" default n @@ -72,62 +77,78 @@ config MTD_SST25 default n select SPI +if MTD_SST25 + config SST25_SPIMODE int "SST25 SPI Mode" default 0 - depends on MTD_SST25 config SST25_SPIFREQUENCY int "SST25 SPI Frequency" default 20000000 - depends on MTD_SST25 config SST25_READONLY bool "SST25 Read-Only FLASH" default n - depends on MTD_SST25 config SST25_SECTOR512 bool "Simulate 512 byte Erase Blocks" default n - depends on MTD_SST25 config SST25_SLOWWRITE bool default y - depends on MTD_SST25 config SST25_SLOWREAD bool default n - depends on MTD_SST25 + +endif + +config MTD_SST39FV + bool "SST39FV NOR FLASH" + default n + ---help--- + Selects 16-bit SST NOR FLASH. This includes support for: + + SST39FV1601/SST39FV1602: 2Mb + SST39FV3201/SST39FV3202: 4Mb + +if MTD_SST39FV + +config SST39VF_BASE_ADDRESS + hex "SST39FV bass address" + default 0x00000000 + ---help--- + This is the address where the SST29VF FLASH can be found in memory. + +endif config MTD_W25 bool "SPI-based W25 FLASH" default n select SPI +if MTD_W25 + config W25_SPIMODE int "W25 SPI Mode" default 0 - depends on MTD_W25 config W25_SPIFREQUENCY int "W25 SPI Frequency" default 20000000 - depends on MTD_W25 config W25_READONLY bool "W25 Read-Only FLASH" default n - depends on MTD_W25 config W25_SECTOR512 bool "Simulate 512 byte Erase Blocks" default n - depends on MTD_W25 config W25_SLOWREAD bool default n - depends on MTD_W25 + +endif diff --git a/nuttx/drivers/mtd/Make.defs b/nuttx/drivers/mtd/Make.defs index 3102f1447..350d055f6 100644 --- a/nuttx/drivers/mtd/Make.defs +++ b/nuttx/drivers/mtd/Make.defs @@ -49,6 +49,10 @@ ifeq ($(CONFIG_MTD_SST25),y) CSRCS += sst25.c endif +ifeq ($(CONFIG_MTD_SST39FV),y) +CSRCS += sst39vf.c +endif + ifeq ($(CONFIG_MTD_W25),y) CSRCS += w25.c endif diff --git a/nuttx/drivers/mtd/skeleton.c b/nuttx/drivers/mtd/skeleton.c index a2fb98238..15ddac1ef 100644 --- a/nuttx/drivers/mtd/skeleton.c +++ b/nuttx/drivers/mtd/skeleton.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/mtd/skeleton.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -84,11 +84,12 @@ static int skel_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg); /**************************************************************************** * Private Data ****************************************************************************/ +/* This structure holds the state of the MTD driver */ static struct skel_dev_s g_skeldev = { { skel_erase, skel_rbead, skel_bwrite, skel_read, skel_ioctl }, - /* Initialization of any other implemenation specific data goes here */ + /* Initialization of any other implementation specific data goes here */ }; /**************************************************************************** @@ -97,9 +98,14 @@ static struct skel_dev_s g_skeldev = /**************************************************************************** * Name: skel_erase + * + * Description: + * Erase several blocks, each of the size previously reported. + * ****************************************************************************/ -static int skel_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks) +static int skel_erase(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks) { FAR struct skel_dev_s *priv = (FAR struct skel_dev_s *)dev; @@ -115,6 +121,10 @@ static int skel_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblock /**************************************************************************** * Name: skel_bread + * + * Description: + * Read the specified number of blocks into the user provided buffer. + * ****************************************************************************/ static ssize_t skel_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, @@ -136,6 +146,10 @@ static ssize_t skel_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t nb /**************************************************************************** * Name: skel_bwrite + * + * Description: + * Write the specified number of blocks from the user provided buffer. + * ****************************************************************************/ static ssize_t skel_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, @@ -157,6 +171,10 @@ static ssize_t skel_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t n /**************************************************************************** * Name: skel_read + * + * Description: + * Read the specified number of bytes to the user provided buffer. + * ****************************************************************************/ static ssize_t skel_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, @@ -197,7 +215,7 @@ static int skel_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) { case MTDIOC_GEOMETRY: { - FAR struct mtd_geometry_s *geo = (FARstruct mtd_geometry_s *)arg; + FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)arg; if (geo) { /* Populate the geometry structure with information need to know @@ -236,9 +254,9 @@ static int skel_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) case MTDIOC_BULKERASE: { - /* Erase the entire device */ + /* Erase the entire device */ - ret = OK; + ret = OK; } break; @@ -265,7 +283,7 @@ static int skel_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) * ****************************************************************************/ -void skel_initialize(void) +FAR struct mtd_dev_s *skel_initialize(void) { /* Perform initialization as necessary */ |