spiFlash: typo
This commit is contained in:
parent
ddcf8fd1b1
commit
dd4e3e40df
|
|
@ -406,7 +406,7 @@ int SPIFlash::disable_protection()
|
||||||
/* convert bp area (status register) to len in byte */
|
/* convert bp area (status register) to len in byte */
|
||||||
uint32_t SPIFlash::bp_to_len(uint8_t bp)
|
uint32_t SPIFlash::bp_to_len(uint8_t bp)
|
||||||
{
|
{
|
||||||
/* 0 -> no sectors protected */
|
/* 0 -> no block protected */
|
||||||
if (bp == 0)
|
if (bp == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -415,16 +415,16 @@ uint32_t SPIFlash::bp_to_len(uint8_t bp)
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
if ((bp & _flash_model->bp_offset[i]))
|
if ((bp & _flash_model->bp_offset[i]))
|
||||||
tmp |= (1 << i);
|
tmp |= (1 << i);
|
||||||
/* bp code is 2^(bp-1) sectors */
|
/* bp code is 2^(bp-1) blocks */
|
||||||
uint16_t nr_sectors = (1 << (tmp-1));
|
uint16_t nr_sectors = (1 << (tmp-1));
|
||||||
|
|
||||||
return nr_sectors * 0x10000;
|
return nr_sectors * 0x10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert len (in byte) to bp (sector protection) */
|
/* convert len (in byte) to bp (block protection) */
|
||||||
uint8_t SPIFlash::len_to_bp(uint32_t len)
|
uint8_t SPIFlash::len_to_bp(uint32_t len)
|
||||||
{
|
{
|
||||||
/* 0 -> no sector to protect */
|
/* 0 -> no block to protect */
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,15 +78,15 @@ class SPIFlash {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief convert bit protect to len in byte
|
* \brief convert block protect to len in byte
|
||||||
* \param[in] bp: byte protection
|
* \param[in] bp: block protection
|
||||||
* \return protect area in byte
|
* \return protect area in byte
|
||||||
*/
|
*/
|
||||||
uint32_t bp_to_len(uint8_t bp);
|
uint32_t bp_to_len(uint8_t bp);
|
||||||
/*!
|
/*!
|
||||||
* \brief convert len (in byte) to corresponding bit protect
|
* \brief convert len (in byte) to corresponding block protect
|
||||||
* \param[in] len: len in byte
|
* \param[in] len: len in byte
|
||||||
* \return bp code (based on chip bp[x] position
|
* \return bp code (based on chip bp[x] position)
|
||||||
*/
|
*/
|
||||||
uint8_t len_to_bp(uint32_t len);
|
uint8_t len_to_bp(uint32_t len);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue