forked from Archive/PX4-Autopilot
Fix some W25 driver errors
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5212 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
44a18f5361
commit
eb041b927a
|
@ -362,3 +362,5 @@
|
|||
of CONFIG_EXAMPLE_* to CONFIG_EXAMPLES_*.
|
||||
* Kconfig: Fleshed out apps/examples/adc/Kconfig and apps/examples/wget/Kconfig.
|
||||
There are still a LOT of empty, stub Kconfig files.
|
||||
* Kconfig: Fleshed out apps/examples/buttons/Kconfig. There are still a LOT
|
||||
of empty, stub Kconfig files.
|
||||
|
|
|
@ -60,11 +60,11 @@ examples/buttons
|
|||
This is a simple configuration that may be used to test the board-
|
||||
specific button interfaces. Configuration options:
|
||||
|
||||
CONFIG_ARCH_BUTTONS - Must be defined for button support
|
||||
CONFIG_ARCH_BUTTONS - Must be defined for button support
|
||||
CONFIG_EXAMPLES_BUTTONS_MIN - Lowest button number (MIN=0)
|
||||
CONFIG_EXAMPLES_BUTTONS_MAX - Highest button number (MAX=7)
|
||||
|
||||
CONFIG_ARCH_IRQBUTTONS - Must be defined for interrupting button support
|
||||
CONFIG_ARCH_IRQBUTTONS - Must be defined for interrupting button support
|
||||
CONFIG_EXAMPLES_IRQBUTTONS_MIN - Lowest interrupting button number (MIN=0)
|
||||
CONFIG_EXAMPLES_IRQBUTTONS_MAX - Highest interrupting button number (MAX=7)
|
||||
|
||||
|
|
|
@ -7,7 +7,57 @@ config EXAMPLES_BUTTONS
|
|||
bool "Buttons example"
|
||||
default n
|
||||
---help---
|
||||
Enable the buttons example
|
||||
Enable the buttons example. May require ARCH_BUTTONS on some boards.
|
||||
|
||||
if EXAMPLES_BUTTONS
|
||||
config EXAMPLES_BUTTONS_MIN
|
||||
int "Lowest Button Number"
|
||||
default 0
|
||||
|
||||
config EXAMPLES_BUTTONS_MAX
|
||||
int "Highest Button Number"
|
||||
default 7
|
||||
|
||||
if ARCH_IRQBUTTONS
|
||||
config EXAMPLES_IRQBUTTONS_MIN
|
||||
int "Lowest Interrupting Button Number"
|
||||
default 0
|
||||
|
||||
config EXAMPLES_IRQBUTTONS_MAX
|
||||
int "Highest Interrupting Button Number"
|
||||
default 7
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME0
|
||||
string "Button 0 Name"
|
||||
default "Button 0"
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME1
|
||||
string "Button 1 Name"
|
||||
default "Button 1"
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME2
|
||||
string "Button 2 Name"
|
||||
default "Button 2"
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME3
|
||||
string "Button 3 Name"
|
||||
default "Button 3"
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME4
|
||||
string "Button 4 Name"
|
||||
default "Button 4"
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME5
|
||||
string "Button 5 Name"
|
||||
default "Button 5"
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME6
|
||||
string "Button 6 Name"
|
||||
default "Button 6"
|
||||
|
||||
config EXAMPLES_BUTTONS_NAME7
|
||||
string "Button 7 Name"
|
||||
default "Button 7"
|
||||
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -3463,3 +3463,5 @@
|
|||
by the STM32 watchdog driver.
|
||||
* CONFIG_EXAMPLES_*: To make things consistent, changed all occurrences
|
||||
of CONFIG_EXAMPLE_* to CONFIG_EXAMPLES_*.
|
||||
* drivers/mtd/w25.c and configs/*/src/up_w25.c: Several fixes for the
|
||||
W25 SPI FLASH.
|
||||
|
|
|
@ -96,23 +96,23 @@ int stm32_w25initialize(int minor)
|
|||
#ifdef HAVE_W25
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR struct mtd_dev_s *mtd;
|
||||
#ifndef CONFIG_FS_NXFFS
|
||||
uint8_t devname[12];
|
||||
#ifdef CONFIG_FS_NXFFS
|
||||
char devname[12];
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
spi = up_spiinitialize(2);
|
||||
spi = up_spiinitialize(1);
|
||||
if (!spi)
|
||||
{
|
||||
fdbg("ERROR: Failed to initialize SPI port 2\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Now bind the SPI interface to the SST 25 SPI FLASH driver */
|
||||
/* Now bind the SPI interface to the W25 SPI FLASH driver */
|
||||
|
||||
mtd = sst25_initialize(spi);
|
||||
mtd = w25_initialize(spi);
|
||||
if (!mtd)
|
||||
{
|
||||
fdbg("ERROR: Failed to bind SPI port 2 to the SST 25 FLASH driver\n");
|
||||
|
@ -140,7 +140,7 @@ int stm32_w25initialize(int minor)
|
|||
|
||||
/* Mount the file system at /mnt/w25 */
|
||||
|
||||
snprintf(devname, 12, "/mnt/w25%c", a + minor);
|
||||
snprintf(devname, 12, "/mnt/w25%c", 'a' + minor);
|
||||
ret = mount(NULL, devname, "nxffs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
|
@ -805,7 +805,7 @@ static uint16_t stm32_readnoshift(FAR struct stm32_dev_s *priv, FAR uint16_t *ac
|
|||
|
||||
static void stm32_setcursor(FAR struct stm32_dev_s *priv, uint16_t col, uint16_t row)
|
||||
{
|
||||
if (priv->type = LCD_TYPE_ILI9919)
|
||||
if (priv->type == LCD_TYPE_ILI9919)
|
||||
{
|
||||
stm32_writereg(priv, LCD_REG_78, col); /* GRAM horizontal address */
|
||||
stm32_writereg(priv, LCD_REG_79, row); /* GRAM vertical address */
|
||||
|
|
|
@ -96,23 +96,23 @@ int stm32_w25initialize(int minor)
|
|||
#ifdef HAVE_W25
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR struct mtd_dev_s *mtd;
|
||||
#ifndef CONFIG_FS_NXFFS
|
||||
uint8_t devname[12];
|
||||
#ifdef CONFIG_FS_NXFFS
|
||||
char devname[12];
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
spi = up_spiinitialize(2);
|
||||
spi = up_spiinitialize(1);
|
||||
if (!spi)
|
||||
{
|
||||
fdbg("ERROR: Failed to initialize SPI port 2\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Now bind the SPI interface to the SST 25 SPI FLASH driver */
|
||||
/* Now bind the SPI interface to the W25 SPI FLASH driver */
|
||||
|
||||
mtd = sst25_initialize(spi);
|
||||
mtd = w25_initialize(spi);
|
||||
if (!mtd)
|
||||
{
|
||||
fdbg("ERROR: Failed to bind SPI port 2 to the SST 25 FLASH driver\n");
|
||||
|
@ -140,7 +140,7 @@ int stm32_w25initialize(int minor)
|
|||
|
||||
/* Mount the file system at /mnt/w25 */
|
||||
|
||||
snprintf(devname, 12, "/mnt/w25%c", a + minor);
|
||||
snprintf(devname, 12, "/mnt/w25%c", 'a' + minor);
|
||||
ret = mount(NULL, devname, "nxffs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
|
@ -693,7 +693,7 @@ static void w25_pagewrite(struct w25_dev_s *priv, FAR const uint8_t *buffer,
|
|||
uint8_t status;
|
||||
|
||||
fvdbg("address: %08lx nwords: %d\n", (long)address, (int)nbytes);
|
||||
DEBUGASSERT(priv && buffer && ((uintptr_t)buffer & 0xff) == 0 &&
|
||||
DEBUGASSERT(priv && buffer && (address & 0xff) == 0 &&
|
||||
(nbytes & 0xff) == 0);
|
||||
|
||||
for (; nbytes > 0; nbytes -= W25_PAGE_SIZE)
|
||||
|
@ -955,36 +955,27 @@ static int w25_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks
|
|||
static ssize_t w25_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks,
|
||||
FAR uint8_t *buffer)
|
||||
{
|
||||
#ifdef CONFIG_W25_SECTOR512
|
||||
ssize_t nbytes;
|
||||
|
||||
fvdbg("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks);
|
||||
|
||||
/* On this device, we can handle the block read just like the byte-oriented read */
|
||||
|
||||
#ifdef CONFIG_W25_SECTOR512
|
||||
nbytes = w25_read(dev, startblock << W25_SECTOR512_SHIFT, nblocks << W25_SECTOR512_SHIFT, buffer);
|
||||
if (nbytes > 0)
|
||||
{
|
||||
return nbytes >> W25_SECTOR512_SHIFT;
|
||||
nbytes >>= W25_SECTOR512_SHIFT;
|
||||
}
|
||||
|
||||
return (int)nbytes;
|
||||
#else
|
||||
FAR struct w25_dev_s *priv = (FAR struct w25_dev_s *)dev;
|
||||
ssize_t nbytes;
|
||||
|
||||
fvdbg("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks);
|
||||
|
||||
/* On this device, we can handle the block read just like the byte-oriented read */
|
||||
|
||||
nbytes = w25_read(dev, startblock << W25_SECTOR_SHIFT, nblocks << W25_SECTOR_SHIFT, buffer);
|
||||
if (nbytes > 0)
|
||||
{
|
||||
return nbytes >> W25_SECTOR_SHIFT;
|
||||
nbytes >>= W25_SECTOR_SHIFT;
|
||||
}
|
||||
|
||||
return (int)nbytes;
|
||||
#endif
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
|
|
|
@ -12,31 +12,31 @@ config FS_NXFFS
|
|||
|
||||
if FS_NXFFS
|
||||
config NXFFS_ERASEDSTATE
|
||||
bool "FLASH erased state"
|
||||
default n
|
||||
hex "FLASH erased state"
|
||||
default 0xff
|
||||
---help---
|
||||
The erased state of FLASH.
|
||||
This must have one of the values of 0xff or 0x00.
|
||||
Default: 0xff.
|
||||
|
||||
config NXFFS_PACKTHRESHOLD
|
||||
bool "Re-packing threshold"
|
||||
default n
|
||||
int "Re-packing threshold"
|
||||
default 32
|
||||
---help---
|
||||
When packing flash file data,
|
||||
don't both with file chunks smaller than this number of data bytes.
|
||||
Default: 32.
|
||||
|
||||
config NXFFS_MAXNAMLEN
|
||||
bool "Maximum file name length"
|
||||
default n
|
||||
int "Maximum file name length"
|
||||
default 255
|
||||
---help---
|
||||
The maximum size of an NXFFS file name.
|
||||
Default: 255.
|
||||
|
||||
config NXFFS_TAILTHRESHOLD
|
||||
bool "Tail threshold"
|
||||
default n
|
||||
int "Tail threshold"
|
||||
default 8192
|
||||
---help---
|
||||
clean-up can either mean
|
||||
packing files together toward the end of the file or, if file are
|
||||
|
|
Loading…
Reference in New Issue