|
1 | 1 | /******************************************************************************
|
2 |
| -* File Name: smif_mem.c |
| 2 | +* File Name: smif_mem.h |
3 | 3 | *
|
4 |
| -* Version: 1.0 |
| 4 | +* Version: 2.0 |
5 | 5 | *
|
6 |
| -* Description: This file contains all the function prototypes required for |
7 |
| -* proper operation of QSPI component |
| 6 | +* Description: |
| 7 | +* This is the public interface header for smif_mem.c. This file contains the |
| 8 | +* functions to perform memory operations such as read, write, and erase on an |
| 9 | +* external memory device. |
8 | 10 | *
|
9 | 11 | *******************************************************************************
|
10 | 12 | * Copyright (2018-2019), Cypress Semiconductor Corporation. All rights reserved.
|
11 | 13 | *******************************************************************************
|
12 | 14 | * This software, including source code, documentation and related materials
|
13 |
| -* (“Software”), is owned by Cypress Semiconductor Corporation or one of its |
14 |
| -* subsidiaries (“Cypress”) and is protected by and subject to worldwide patent |
| 15 | +* ("Software"), is owned by Cypress Semiconductor Corporation or one of its |
| 16 | +* subsidiaries ("Cypress") and is protected by and subject to worldwide patent |
15 | 17 | * protection (United States and foreign), United States copyright laws and
|
16 |
| -* international treaty provisions. Therefore, you may use this Software only |
17 |
| -* as provided in the license agreement accompanying the software package from |
18 |
| -* which you obtained this Software (“EULA”). |
| 18 | +* international treaty provisions. Therefore, you may use this Software only as |
| 19 | +* provided in the license agreement accompanying the software package from which |
| 20 | +* you obtained this Software ("EULA"). |
19 | 21 | *
|
20 |
| -* If no EULA applies, Cypress hereby grants you a personal, nonexclusive, |
21 |
| -* non-transferable license to copy, modify, and compile the Software source |
22 |
| -* code solely for use in connection with Cypress’s integrated circuit products. |
23 |
| -* Any reproduction, modification, translation, compilation, or representation |
24 |
| -* of this Software except as specified above is prohibited without the express |
| 22 | +* If no EULA applies, Cypress hereby grants you a personal, non-exclusive, |
| 23 | +* non-transferable license to copy, modify, and compile the Software source code |
| 24 | +* solely for use in connection with Cypress’s integrated circuit products. Any |
| 25 | +* reproduction, modification, translation, compilation, or representation of |
| 26 | +* this Software except as specified above is prohibited without the express |
25 | 27 | * written permission of Cypress.
|
26 | 28 | *
|
27 | 29 | * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
|
28 | 30 | * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
|
29 | 31 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
|
30 | 32 | * reserves the right to make changes to the Software without notice. Cypress
|
31 | 33 | * does not assume any liability arising out of the application or use of the
|
32 |
| -* Software or any product or circuit described in the Software. Cypress does |
33 |
| -* not authorize its products for use in any products where a malfunction or |
34 |
| -* failure of the Cypress product may reasonably be expected to result in |
35 |
| -* significant property damage, injury or death (“High Risk Product”). By |
36 |
| -* including Cypress’s product in a High Risk Product, the manufacturer of such |
37 |
| -* system or application assumes all risk of such use and in doing so agrees to |
38 |
| -* indemnify Cypress against all liability. |
| 34 | +* Software or any product or circuit described in the Software. Cypress does not |
| 35 | +* authorize its products for use in any products where a malfunction or failure |
| 36 | +* of the Cypress product may reasonably be expected to result in significant |
| 37 | +* property damage, injury or death ("High Risk Product"). By including Cypress's |
| 38 | +* product in a High Risk Product, the manufacturer of such system or application |
| 39 | +* assumes all risk of such use and in doing so agrees to indemnify Cypress |
| 40 | +* against all liability. |
39 | 41 | *******************************************************************************/
|
40 |
| -#ifndef SOURCE_SMIF_MEM_H_ |
41 |
| -#define SOURCE_SMIF_MEM_H_ |
| 42 | + |
| 43 | +#ifndef SOURCE_SMIF_MEM_H |
| 44 | +#define SOURCE_SMIF_MEM_H |
42 | 45 |
|
43 | 46 | #include "cy_pdl.h"
|
44 |
| -#include "cycfg.h" |
45 |
| -#include "cycfg_qspi_memslot.h" |
46 | 47 |
|
47 |
| -#include <stdio.h> |
48 |
| -#include <string.h> |
| 48 | + |
| 49 | +/*************************************************************************** |
| 50 | +* Global Constants |
| 51 | +***************************************************************************/ |
| 52 | +/* Set it high enough for the sector erase operation to complete */ |
| 53 | +#define MEMORY_BUSY_CHECK_RETRIES (750ul) |
| 54 | + |
| 55 | +/* Timeout used in polling of the transfer status of SMIF block */ |
| 56 | +#define SMIF_TRANSFER_TIMEOUT (1000ul) /* microseconds */ |
| 57 | + |
49 | 58 |
|
50 | 59 | /***************************************************************************
|
51 | 60 | * Function Prototypes
|
52 | 61 | ***************************************************************************/
|
53 |
| -void CheckStatus(char * msg, uint32_t status); |
54 |
| -void ReadMemory(SMIF_Type *baseaddr, |
55 |
| - cy_stc_smif_context_t *smifContext, |
56 |
| - uint8_t rxBuffer[], |
57 |
| - uint32_t rxSize, |
58 |
| - uint8_t *address); |
59 |
| -void WriteMemory(SMIF_Type *baseaddr, |
60 |
| - cy_stc_smif_context_t *smifContext, |
61 |
| - uint8_t txBuffer[], |
62 |
| - uint32_t txSize, |
63 |
| - uint8_t *address); |
64 |
| -void EraseMemory(SMIF_Type *baseaddr, cy_stc_smif_mem_config_t *memConfig, |
65 |
| - uint8_t *address, |
66 |
| - cy_stc_smif_context_t const *smifContext); |
| 62 | +cy_en_smif_status_t IsMemoryReady(cy_stc_smif_mem_config_t const *memConfig); |
| 63 | +cy_en_smif_status_t IsQuadEnabled(cy_stc_smif_mem_config_t const *memConfig, bool *isQuadEnabled); |
| 64 | +cy_en_smif_status_t EnableQuadMode(cy_stc_smif_mem_config_t const *memConfig); |
| 65 | +cy_en_smif_status_t ReadMemory(cy_stc_smif_mem_config_t const *memConfig, uint8_t address[], uint8_t rxBuffer[], uint32_t rxSize); |
| 66 | +cy_en_smif_status_t WriteMemory(cy_stc_smif_mem_config_t const *memConfig, uint8_t address[], uint8_t txBuffer[], uint32_t txSize); |
| 67 | +cy_en_smif_status_t EraseMemory(cy_stc_smif_mem_config_t const *memConfig, uint8_t address[]); |
| 68 | + |
| 69 | +#endif /* SOURCE_SMIF_MEM_H */ |
| 70 | + |
67 | 71 |
|
68 |
| -#endif /* SOURCE_SMIF_MEM_H_ */ |
|
0 commit comments