mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Improve m25px driver
This commit is contained in:
committed by
Gregory Nutt
parent
0369facbd5
commit
1951b9df57
+1
-1
Submodule Documentation updated: d1d8974e7a...35343cbe66
@@ -408,6 +408,10 @@ config M25P_SPIMODE
|
|||||||
int "M25P SPI mode"
|
int "M25P SPI mode"
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
|
config M25P_SPIFREQUENCY
|
||||||
|
int "M25P SPI Frequency"
|
||||||
|
default 20000000
|
||||||
|
|
||||||
config M25P_MANUFACTURER
|
config M25P_MANUFACTURER
|
||||||
hex "M25P manufacturers ID"
|
hex "M25P manufacturers ID"
|
||||||
default 0x20
|
default 0x20
|
||||||
|
|||||||
+9
-1
@@ -69,6 +69,10 @@
|
|||||||
# define CONFIG_M25P_SPIMODE SPIDEV_MODE0
|
# define CONFIG_M25P_SPIMODE SPIDEV_MODE0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_M25P_SPIFREQUENCY
|
||||||
|
# define CONFIG_M25P_SPIFREQUENCY 20000000
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Various manufacturers may have produced the parts. 0x20 is the manufacturer ID
|
/* 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
|
* 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.
|
* International MX25 serial FLASH, the correct manufacturer ID would be 0xc2.
|
||||||
@@ -137,6 +141,7 @@
|
|||||||
#define M25P_M25P32_NSECTORS 64
|
#define M25P_M25P32_NSECTORS 64
|
||||||
#define M25P_M25P32_PAGE_SHIFT 8 /* Page size 1 << 8 = 256 */
|
#define M25P_M25P32_PAGE_SHIFT 8 /* Page size 1 << 8 = 256 */
|
||||||
#define M25P_M25P32_NPAGES 16384
|
#define M25P_M25P32_NPAGES 16384
|
||||||
|
#define M25P_M25PX32_SUBSECT_SHIFT 12 /* Sub-Sector size 1 << 12 = 4,096 */
|
||||||
|
|
||||||
/* M25P64 capacity is 8,338,608 bytes:
|
/* M25P64 capacity is 8,338,608 bytes:
|
||||||
* (128 sectors) * (65,536 bytes per sector)
|
* (128 sectors) * (65,536 bytes per sector)
|
||||||
@@ -285,7 +290,7 @@ static void m25p_lock(FAR struct spi_dev_s *dev)
|
|||||||
SPI_SETMODE(dev, CONFIG_M25P_SPIMODE);
|
SPI_SETMODE(dev, CONFIG_M25P_SPIMODE);
|
||||||
SPI_SETBITS(dev, 8);
|
SPI_SETBITS(dev, 8);
|
||||||
(void)SPI_HWFEATURES(dev, 0);
|
(void)SPI_HWFEATURES(dev, 0);
|
||||||
(void)SPI_SETFREQUENCY(dev, 20000000);
|
(void)SPI_SETFREQUENCY(dev, CONFIG_M25P_SPIFREQUENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -383,6 +388,9 @@ static inline int m25p_readid(struct m25p_dev_s *priv)
|
|||||||
priv->nsectors = M25P_M25P32_NSECTORS;
|
priv->nsectors = M25P_M25P32_NSECTORS;
|
||||||
priv->pageshift = M25P_M25P32_PAGE_SHIFT;
|
priv->pageshift = M25P_M25P32_PAGE_SHIFT;
|
||||||
priv->npages = M25P_M25P32_NPAGES;
|
priv->npages = M25P_M25P32_NPAGES;
|
||||||
|
#ifdef CONFIG_M25P_SUBSECTOR_ERASE
|
||||||
|
priv->subsectorshift = M25P_M25PX32_SUBSECT_SHIFT;
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
else if (capacity == M25P_M25P64_CAPACITY)
|
else if (capacity == M25P_M25P64_CAPACITY)
|
||||||
|
|||||||
@@ -852,7 +852,7 @@ void sched_suspend_scheduler(FAR struct tcb_s *tcb);
|
|||||||
* to application code.
|
* to application code.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* tcb - The TCB of the thread to be restarted.
|
* tcb - The TCB of the thread.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
|
|||||||
Reference in New Issue
Block a user