Skip to content

Commit

Permalink
Upload serial-flash 1.0.2.17634
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlab-runner committed Sep 26, 2020
1 parent 260c60e commit 8558f20
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 21 deletions.
11 changes: 8 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Provides functions for interacting with an external flash connected through its
* Allows for providing information to the programming tool to program the external memory.

### What Changed?
#### v1.0.2
* Added new function cy_serial_flash_qspi_get_prog_size() to get the programming size
* Minor documentation updates
#### v1.0.1
* Minor update for documentation & branding
#### v1.0.0
Expand All @@ -18,11 +21,13 @@ This version of the Serial Flash library was validated for compatibility with th

| Software and Tools | Version |
| :--- | :----: |
| ModusToolbox Software Environment | 2.0 |
| GCC Compiler | 7.4 |
| IAR Compiler | 8.32 |
| ModusToolbox Software Environment | 2.1 |
| GCC Compiler | 9.2 |
| IAR Compiler | 8.4 |
| ARM Compiler 6 | 6.11 |

Minimum required ModusToolbox Software Environment: v2.0

### More information

* [API Reference Guide](https://cypresssemiconductorco.github.io/serial-flash/html/index.html)
Expand Down
11 changes: 11 additions & 0 deletions cy_serial_flash_qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ size_t cy_serial_flash_qspi_get_erase_size(uint32_t addr)
return (size_t)qspi_block_config.memConfig[MEM_SLOT]->deviceCfg->eraseSize;
}

size_t cy_serial_flash_qspi_get_prog_size(uint32_t addr)
{
CY_UNUSED_PARAMETER(addr);
return (size_t)qspi_block_config.memConfig[MEM_SLOT]->deviceCfg->programSize;
}

cy_rslt_t cy_serial_flash_qspi_read(uint32_t addr, size_t length, uint8_t *buf)
{
/* Cy_SMIF_MemRead() returns error if (addr + length) > total flash size. */
Expand Down Expand Up @@ -215,6 +221,11 @@ cy_rslt_t cy_serial_flash_qspi_enable_xip(bool enable)
return CY_RSLT_SUCCESS;
}

void cy_serial_flash_qspi_set_interrupt_priority(uint8_t priority)
{
NVIC_SetPriority(smif_interrupt_IRQn, priority);
}

#if defined(__cplusplus)
}
#endif
Expand Down
44 changes: 28 additions & 16 deletions cy_serial_flash_qspi.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ extern "C" {
/**
* \brief Initializes the serial flash memory. This function accepts up to 8
* I/Os. Number of I/Os depend on the type of memory interface. Pass NC when an
* I/O is unused.
* I/O is unused.
* Single SPI - (io0, io1) or (io2, io3) or (io4, io5) or (io6, io7)
* Dual SPI - (io0, io1) or (io2, io3) or (io4, io5) or (io6, io7)
* Quad SPI - (io0, io1, io2, io3) or (io4, io5, io6, io7)
* Octal SPI - All 8 I/Os are used.
* Dual SPI - (io0, io1) or (io2, io3) or (io4, io5) or (io6, io7)
* Quad SPI - (io0, io1, io2, io3) or (io4, io5, io6, io7)
* Octal SPI - All 8 I/Os are used.
* \param mem_config Memory configuration to be used for initializing
* \param io0 Data/IO pin 0 connected to the memory, Pass NC when unused.
* \param io1 Data/IO pin 1 connected to the memory, Pass NC when unused.
Expand All @@ -64,24 +64,22 @@ extern "C" {
* \param io7 Data/IO pin 7 connected to the memory, Pass NC when unused.
* \param sclk Clock pin connected to the memory
* \param ssel Slave select pin connected to the memory
* \param hz Clock frequency to be used with the memory. This parameter is
* ignored currently. Change the CLK_HF frequency using either the
Device Configurator tool or the clock driver.
* \param hz Clock frequency to be used with the memory.
* \returns CY_RSLT_SUCCESS if the initialization was successful, an error code
* otherwise.
*/
cy_rslt_t cy_serial_flash_qspi_init(
cy_rslt_t cy_serial_flash_qspi_init(
const cy_stc_smif_mem_config_t* mem_config,
cyhal_gpio_t io0,
cyhal_gpio_t io1,
cyhal_gpio_t io2,
cyhal_gpio_t io0,
cyhal_gpio_t io1,
cyhal_gpio_t io2,
cyhal_gpio_t io3,
cyhal_gpio_t io4,
cyhal_gpio_t io5,
cyhal_gpio_t io6,
cyhal_gpio_t io7,
cyhal_gpio_t io4,
cyhal_gpio_t io5,
cyhal_gpio_t io6,
cyhal_gpio_t io7,
cyhal_gpio_t sclk,
cyhal_gpio_t ssel,
cyhal_gpio_t ssel,
uint32_t hz);

/**
Expand All @@ -103,6 +101,14 @@ size_t cy_serial_flash_qspi_get_size(void);
*/
size_t cy_serial_flash_qspi_get_erase_size(uint32_t addr);

/**
* \brief Returns the page size for programming of the sector to which the given
* address belongs. Address is used only for a memory with hybrid sector size.
* \param addr Address that belongs to the sector for which size is returned.
* \returns Page size in bytes.
*/
size_t cy_serial_flash_qspi_get_prog_size(uint32_t addr);

/**
* \brief Utility function to calculate the starting address of an erase sector
* to which the given address belongs.
Expand Down Expand Up @@ -165,6 +171,12 @@ cy_rslt_t cy_serial_flash_qspi_erase(uint32_t addr, size_t length);
*/
cy_rslt_t cy_serial_flash_qspi_enable_xip(bool enable);

/**
* \brief Changes QSPI interrupt priority
* \param priority interrupt priority to be set
*/
void cy_serial_flash_qspi_set_interrupt_priority(uint8_t priority);

#if defined(__cplusplus)
}
#endif
Expand Down
61 changes: 60 additions & 1 deletion docs/html/group__group__board__libs.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
<tr class="memitem:gacaad29bc13d3a4cd243830980b21c274"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__board__libs.html#gacaad29bc13d3a4cd243830980b21c274">cy_serial_flash_qspi_get_erase_size</a> (uint32_t addr)</td></tr>
<tr class="memdesc:gacaad29bc13d3a4cd243830980b21c274"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the size of the erase sector to which the given address belongs. <a href="#gacaad29bc13d3a4cd243830980b21c274">More...</a><br /></td></tr>
<tr class="separator:gacaad29bc13d3a4cd243830980b21c274"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3b4219e6b1182c0c75704581b6cacc37"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__board__libs.html#ga3b4219e6b1182c0c75704581b6cacc37">cy_serial_flash_qspi_get_prog_size</a> (uint32_t addr)</td></tr>
<tr class="memdesc:ga3b4219e6b1182c0c75704581b6cacc37"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the page size for programming of the sector to which the given address belongs. <a href="#ga3b4219e6b1182c0c75704581b6cacc37">More...</a><br /></td></tr>
<tr class="separator:ga3b4219e6b1182c0c75704581b6cacc37"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1aec27b28a9ce3205ce16e12c4d576b0"><td class="memItemLeft" align="right" valign="top">__STATIC_INLINE uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__board__libs.html#ga1aec27b28a9ce3205ce16e12c4d576b0">cy_serial_flash_get_sector_start_address</a> (uint32_t addr)</td></tr>
<tr class="memdesc:ga1aec27b28a9ce3205ce16e12c4d576b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function to calculate the starting address of an erase sector to which the given address belongs. <a href="#ga1aec27b28a9ce3205ce16e12c4d576b0">More...</a><br /></td></tr>
<tr class="separator:ga1aec27b28a9ce3205ce16e12c4d576b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
Expand All @@ -134,6 +137,9 @@
<tr class="memitem:ga56772d2543b7b7f2c17ed9ddb9db941e"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__board__libs.html#ga56772d2543b7b7f2c17ed9ddb9db941e">cy_serial_flash_qspi_enable_xip</a> (bool enable)</td></tr>
<tr class="memdesc:ga56772d2543b7b7f2c17ed9ddb9db941e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables Execute-in-Place (memory mapped) mode on the MCU. <a href="#ga56772d2543b7b7f2c17ed9ddb9db941e">More...</a><br /></td></tr>
<tr class="separator:ga56772d2543b7b7f2c17ed9ddb9db941e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga818e617f0abbff49f43ee1254d7bc35c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__board__libs.html#ga818e617f0abbff49f43ee1254d7bc35c">cy_serial_flash_qspi_set_interrupt_priority</a> (uint8_t priority)</td></tr>
<tr class="memdesc:ga818e617f0abbff49f43ee1254d7bc35c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Changes QSPI interrupt priority. <a href="#ga818e617f0abbff49f43ee1254d7bc35c">More...</a><br /></td></tr>
<tr class="separator:ga818e617f0abbff49f43ee1254d7bc35c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaa9c587684b8b629a0fde56e786400d82"></a>
Expand Down Expand Up @@ -236,7 +242,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#gaa9c587684b8b629a0fde56e
<tr><td class="paramname">io7</td><td>Data/IO pin 7 connected to the memory, Pass NC when unused. </td></tr>
<tr><td class="paramname">sclk</td><td>Clock pin connected to the memory </td></tr>
<tr><td class="paramname">ssel</td><td>Slave select pin connected to the memory </td></tr>
<tr><td class="paramname">hz</td><td>Clock frequency to be used with the memory. This parameter is ignored currently. Change the CLK_HF frequency using either the Device Configurator tool or the clock driver. </td></tr>
<tr><td class="paramname">hz</td><td>Clock frequency to be used with the memory. </td></tr>
</table>
</dd>
</dl>
Expand Down Expand Up @@ -290,6 +296,33 @@ <h2 class="memtitle"><span class="permalink"><a href="#gacaad29bc13d3a4cd2438309
</dl>
<dl class="section return"><dt>Returns</dt><dd>Erase sector size in bytes. </dd></dl>

</div>
</div>
<a id="ga3b4219e6b1182c0c75704581b6cacc37"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3b4219e6b1182c0c75704581b6cacc37">&#9670;&nbsp;</a></span>cy_serial_flash_qspi_get_prog_size()</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t cy_serial_flash_qspi_get_prog_size </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>addr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">

<p>Returns the page size for programming of the sector to which the given address belongs. </p>
<p>Address is used only for a memory with hybrid sector size. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">addr</td><td>Address that belongs to the sector for which size is returned. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Page size in bytes. </dd></dl>

</div>
</div>
<a id="ga1aec27b28a9ce3205ce16e12c4d576b0"></a>
Expand Down Expand Up @@ -473,6 +506,32 @@ <h2 class="memtitle"><span class="permalink"><a href="#ga56772d2543b7b7f2c17ed9d
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS if the operation was successful. CY_RSLT_SERIAL_FLASH_ERR_UNSUPPORTED if the target does not support XIP. </dd></dl>

</div>
</div>
<a id="ga818e617f0abbff49f43ee1254d7bc35c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga818e617f0abbff49f43ee1254d7bc35c">&#9670;&nbsp;</a></span>cy_serial_flash_qspi_set_interrupt_priority()</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void cy_serial_flash_qspi_set_interrupt_priority </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>priority</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">

<p>Changes QSPI interrupt priority. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">priority</td><td>interrupt priority to be set </td></tr>
</table>
</dd>
</dl>

</div>
</div>
</div><!-- contents -->
Expand Down
2 changes: 2 additions & 0 deletions docs/html/search/all_0.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/html/search/functions_0.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion version.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<version>1.0.1.15154</version>
<version>1.0.2.17634</version>

0 comments on commit 8558f20

Please sign in to comment.